4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen, Bob Holcomb
22 * ***** END GPL LICENSE BLOCK *****
25 /** \file blender/makesrna/intern/rna_nodetree.c
33 #include "RNA_define.h"
34 #include "RNA_enum_types.h"
36 #include "rna_internal.h"
38 #include "DNA_material_types.h"
39 #include "DNA_node_types.h"
40 #include "DNA_scene_types.h"
41 #include "DNA_texture_types.h"
43 #include "BKE_animsys.h"
46 #include "BKE_image.h"
47 #include "BKE_texture.h"
50 #include "BLI_utildefines.h"
54 #include "MEM_guardedalloc.h"
57 EnumPropertyItem node_socket_type_items[] = {
58 {SOCK_VALUE, "VALUE", 0, "Value", ""},
59 {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
60 {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
61 {0, NULL, 0, NULL, NULL}};
63 EnumPropertyItem node_math_items[] = {
64 { 0, "ADD", 0, "Add", ""},
65 { 1, "SUBTRACT", 0, "Subtract", ""},
66 { 2, "MULTIPLY", 0, "Multiply", ""},
67 { 3, "DIVIDE", 0, "Divide", ""},
68 { 4, "SINE", 0, "Sine", ""},
69 { 5, "COSINE", 0, "Cosine", ""},
70 { 6, "TANGENT", 0, "Tangent", ""},
71 { 7, "ARCSINE", 0, "Arcsine", ""},
72 { 8, "ARCCOSINE", 0, "Arccosine", ""},
73 { 9, "ARCTANGENT", 0, "Arctangent", ""},
74 {10, "POWER", 0, "Power", ""},
75 {11, "LOGARITHM", 0, "Logarithm", ""},
76 {12, "MINIMUM", 0, "Minimum", ""},
77 {13, "MAXIMUM", 0, "Maximum", ""},
78 {14, "ROUND", 0, "Round", ""},
79 {15, "LESS_THAN", 0, "Less Than", ""},
80 {16, "GREATER_THAN", 0, "Greater Than", ""},
81 {0, NULL, 0, NULL, NULL}};
83 EnumPropertyItem node_vec_math_items[] = {
84 {0, "ADD", 0, "Add", ""},
85 {1, "SUBTRACT", 0, "Subtract", ""},
86 {2, "AVERAGE", 0, "Average", ""},
87 {3, "DOT_PRODUCT", 0, "Dot Product", ""},
88 {4, "CROSS_PRODUCT", 0, "Cross Product", ""},
89 {5, "NORMALIZE", 0, "Normalize", ""},
90 {0, NULL, 0, NULL, NULL}};
92 EnumPropertyItem node_filter_items[] = {
93 {0, "SOFTEN", 0, "Soften", ""},
94 {1, "SHARPEN", 0, "Sharpen", ""},
95 {2, "LAPLACE", 0, "Laplace", ""},
96 {3, "SOBEL", 0, "Sobel", ""},
97 {4, "PREWITT", 0, "Prewitt", ""},
98 {5, "KIRSCH", 0, "Kirsch", ""},
99 {6, "SHADOW", 0, "Shadow", ""},
100 {0, NULL, 0, NULL, NULL}};
104 #include "BLI_linklist.h"
108 #include "RE_pipeline.h"
110 #include "DNA_scene_types.h"
113 static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
115 bNode *node = (bNode*)ptr->data;
119 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
120 case ID: return &RNA_##Category##StructName;
122 #include "rna_nodetree_types.h"
127 return &RNA_NodeGroup;
134 static StructRNA *rna_NodeSocketType_refine(struct PointerRNA *ptr)
136 bNodeSocket *ns= (bNodeSocket*)ptr->data;
140 return &RNA_ValueNodeSocket;
142 return &RNA_VectorNodeSocket;
144 return &RNA_RGBANodeSocket;
146 return &RNA_UnknownType;
150 static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
152 bNodeTree *ntree= (bNodeTree*)ptr->data;
154 switch(ntree->type) {
156 return &RNA_ShaderNodeTree;
158 return &RNA_CompositorNodeTree;
160 return &RNA_TextureNodeTree;
162 return &RNA_UnknownType;
166 static char *rna_Node_path(PointerRNA *ptr)
168 bNode *node= (bNode*)ptr->data;
170 return BLI_sprintfN("nodes[\"%s\"]", node->name);
173 static char *rna_NodeSocket_path(PointerRNA *ptr)
175 bNodeTree *ntree= (bNodeTree*)ptr->id.data;
176 bNodeSocket *sock= (bNodeSocket*)ptr->data;
181 socketindex = BLI_findindex(&ntree->inputs, sock);
182 if (socketindex != -1)
183 return BLI_sprintfN("inputs[%d]", socketindex);
185 socketindex = BLI_findindex(&ntree->outputs, sock);
186 if (socketindex != -1)
187 return BLI_sprintfN("outputs[%d]", socketindex);
190 if (!nodeFindNode(ntree, sock, &node, NULL, NULL)) return NULL;
192 socketindex = BLI_findindex(&node->inputs, sock);
193 if (socketindex != -1)
194 return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", node->name, socketindex);
196 socketindex = BLI_findindex(&node->outputs, sock);
197 if (socketindex != -1)
198 return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", node->name, socketindex);
203 /* Button Set Funcs for Matte Nodes */
204 static void rna_Matte_t1_set(PointerRNA *ptr, float value)
206 bNode *node= (bNode*)ptr->data;
207 NodeChroma *chroma = node->storage;
211 if(value < chroma->t2)
215 static void rna_Matte_t2_set(PointerRNA *ptr, float value)
217 bNode *node= (bNode*)ptr->data;
218 NodeChroma *chroma = node->storage;
220 if(value > chroma->t1)
226 static void rna_Image_start_frame_set(PointerRNA *ptr, int value)
228 bNode *node= (bNode*)ptr->data;
229 NodeImageFile *image = node->storage;
231 CLAMP(value, MINFRAME, image->efra);
235 static void rna_Image_end_frame_set(PointerRNA *ptr, int value)
237 bNode *node= (bNode*)ptr->data;
238 NodeImageFile *image = node->storage;
240 CLAMP(value, image->sfra, MAXFRAME);
244 static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value)
246 bNode *node= (bNode*)ptr->data;
253 node->id= value.data;
255 id_us_plus(node->id);
260 static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node)
262 ED_node_generic_update(bmain, ntree, node);
265 static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
267 bNodeTree *ntree= (bNodeTree*)ptr->id.data;
268 bNode *node= (bNode*)ptr->data;
270 node_update(bmain, scene, ntree, node);
273 static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
275 bNodeTree *ntree= (bNodeTree*)ptr->id.data;
276 bNode *node= (bNode*)ptr->data;
278 nodeGroupVerify((bNodeTree *)node->id);
280 node_update(bmain, scene, ntree, node);
283 static void rna_Node_name_set(PointerRNA *ptr, const char *value)
285 bNodeTree *ntree= (bNodeTree*)ptr->id.data;
286 bNode *node= (bNode*)ptr->data;
287 char oldname[sizeof(node->name)];
289 /* make a copy of the old name first */
290 BLI_strncpy(oldname, node->name, sizeof(node->name));
292 BLI_strncpy(node->name, value, sizeof(node->name));
294 nodeUniqueName(ntree, node);
296 /* fix all the animation data which may link to this */
297 BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name);
300 static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
302 bNodeTree *ntree= (bNodeTree*)ptr->id.data;
303 bNodeSocket *sock= (bNodeSocket*)ptr->data;
306 if (nodeFindNode(ntree, sock, &node, NULL, NULL))
307 node_update(bmain, scene, ntree, node);
310 static void rna_NodeGroupSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
312 bNodeTree *ntree= (bNodeTree*)ptr->id.data;
313 bNodeSocket *sock= (bNodeSocket*)ptr->data;
316 nodeGroupVerify(ntree);
318 if (nodeFindNode(ntree, sock, &node, NULL, NULL))
319 node_update(bmain, scene, ntree, node);
322 static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *max)
324 bNodeSocket *sock= (bNodeSocket*)ptr->data;
330 static void rna_Node_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr)
332 bNode *node= (bNode*)ptr->data;
334 init_mapping((TexMapping *)node->storage);
336 rna_Node_update(bmain, scene, ptr);
339 static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
341 bNode *node= (bNode*)ptr->data;
342 Image *ima = (Image *)node->id;
343 ImageUser *iuser= node->storage;
345 BKE_image_multilayer_index(ima->rr, iuser);
346 BKE_image_signal(ima, iuser, IMA_SIGNAL_SRC_CHANGE);
348 rna_Node_update(bmain, scene, ptr);
351 static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
353 EnumPropertyItem *item= NULL;
354 EnumPropertyItem tmp = {0, "", 0, "", ""};
358 tmp.identifier = rl->name;
361 RNA_enum_item_add(&item, &totitem, &tmp);
365 RNA_enum_item_end(&item, &totitem);
370 static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *C, PointerRNA *ptr, int *free)
372 bNode *node= (bNode*)ptr->data;
373 Image *ima = (Image *)node->id;
374 EnumPropertyItem *item= NULL;
377 if (!ima || !(ima->rr)) return NULL;
379 rl = ima->rr->layers.first;
380 item = renderresult_layers_add_enum(rl);
387 static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *C, PointerRNA *ptr, int *free)
389 bNode *node= (bNode*)ptr->data;
390 Scene *sce = (Scene *)node->id;
391 EnumPropertyItem *item= NULL;
394 if (!sce) return NULL;
396 rl = sce->r.layers.first;
397 item = renderresult_layers_add_enum(rl);
404 static EnumPropertyItem *rna_Node_channel_itemf(bContext *C, PointerRNA *ptr, int *free)
406 bNode *node= (bNode*)ptr->data;
407 EnumPropertyItem *item= NULL;
408 EnumPropertyItem tmp = {0, "", 0, "", ""};
411 switch(node->custom1) {
412 case CMP_NODE_CHANNEL_MATTE_CS_RGB:
413 tmp.identifier= "R"; tmp.name= "R"; tmp.value= 1;
414 RNA_enum_item_add(&item, &totitem, &tmp);
415 tmp.identifier= "G"; tmp.name= "G"; tmp.value= 2;
416 RNA_enum_item_add(&item, &totitem, &tmp);
417 tmp.identifier= "B"; tmp.name= "B"; tmp.value= 3;
418 RNA_enum_item_add(&item, &totitem, &tmp);
420 case CMP_NODE_CHANNEL_MATTE_CS_HSV:
421 tmp.identifier= "H"; tmp.name= "H"; tmp.value= 1;
422 RNA_enum_item_add(&item, &totitem, &tmp);
423 tmp.identifier= "S"; tmp.name= "S"; tmp.value= 2;
424 RNA_enum_item_add(&item, &totitem, &tmp);
425 tmp.identifier= "V"; tmp.name= "V"; tmp.value= 3;
426 RNA_enum_item_add(&item, &totitem, &tmp);
428 case CMP_NODE_CHANNEL_MATTE_CS_YUV:
429 tmp.identifier= "Y"; tmp.name= "Y"; tmp.value= 1;
430 RNA_enum_item_add(&item, &totitem, &tmp);
431 tmp.identifier= "G"; tmp.name= "U"; tmp.value= 2;
432 RNA_enum_item_add(&item, &totitem, &tmp);
433 tmp.identifier= "V"; tmp.name= "V"; tmp.value= 3;
434 RNA_enum_item_add(&item, &totitem, &tmp);
436 case CMP_NODE_CHANNEL_MATTE_CS_YCC:
437 tmp.identifier= "Y"; tmp.name= "Y"; tmp.value= 1;
438 RNA_enum_item_add(&item, &totitem, &tmp);
439 tmp.identifier= "CB"; tmp.name= "Cr"; tmp.value= 2;
440 RNA_enum_item_add(&item, &totitem, &tmp);
441 tmp.identifier= "CR"; tmp.name= "Cb"; tmp.value= 3;
442 RNA_enum_item_add(&item, &totitem, &tmp);
448 RNA_enum_item_end(&item, &totitem);
454 static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
458 if (type == NODE_GROUP && group == NULL) {
459 BKE_reportf(reports, RPT_ERROR, "node type \'GROUP\' missing group argument");
462 node = nodeAddNodeType(ntree, type, group, NULL);
465 BKE_reportf(reports, RPT_ERROR, "Unable to create node");
468 nodeGroupVerify(ntree); /* update group node socket links*/
469 NodeTagChanged(ntree, node);
470 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
473 id_us_plus(&group->id);
479 static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
481 /* raises error on failier */
482 bNode *node= rna_NodeTree_node_new(ntree, C, reports, type, group);
485 if(ELEM4(node->type, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE, CMP_NODE_R_LAYERS)) {
486 /* annoying, find the node tree we are in, scene can be NULL */
488 for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next) {
489 if(scene->nodetree == ntree) {
493 node->id= (ID *)scene;
494 id_us_plus(node->id);
497 ntreeCompositForceHidden(ntree, CTX_data_scene(C));
498 ntreeSolveOrder(ntree);
504 static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
506 /* raises error on failier */
507 bNode *node= rna_NodeTree_node_new(ntree, C, reports, type, group);
510 ntreeTexCheckCyclics(ntree);
516 static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, bNode *node)
518 if (BLI_findindex(&ntree->nodes, node) == -1) {
519 BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in nodetree", node->name);
525 nodeFreeNode(ntree, node);
526 nodeGroupVerify(ntree); /* update group node socket links*/
528 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
532 static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, bNodeSocket *in, bNodeSocket *out)
535 bNode *fromnode= NULL, *tonode= NULL;
536 int from_in_out, to_in_out;
538 nodeFindNode(ntree, in, &fromnode, NULL, &from_in_out);
539 nodeFindNode(ntree, out, &tonode, NULL, &to_in_out);
541 if (&from_in_out == &to_in_out) {
542 BKE_reportf(reports, RPT_ERROR, "Same input/output direction of sockets");
546 /* unlink node input socket */
547 nodeRemSocketLinks(ntree, out);
549 ret= nodeAddLink(ntree, fromnode, in, tonode, out);
552 NodeTagChanged(ntree, tonode);
554 nodeGroupVerify(ntree); /* update group node socket links*/
556 ntreeSolveOrder(ntree);
558 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
563 static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, bNodeLink *link)
565 if (BLI_findindex(&ntree->links, link) == -1) {
566 BKE_reportf(reports, RPT_ERROR, "Unable to locate link in nodetree");
569 nodeRemLink(ntree, link);
570 ntreeSolveOrder(ntree);
571 nodeGroupVerify(ntree); /* update group node socket links*/
573 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
577 static bNodeSocket *rna_NodeTree_input_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type)
579 /* XXX should check if tree is a group here! no good way to do this currently. */
580 bNodeSocket *gsock= nodeGroupAddSocket(ntree, name, type, SOCK_IN);
582 nodeGroupVerify(ntree); /* update group node socket links*/
583 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
587 static bNodeSocket *rna_NodeTree_output_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type)
589 /* XXX should check if tree is a group here! no good way to do this currently. */
590 bNodeSocket *gsock= nodeGroupAddSocket(ntree, name, type, SOCK_OUT);
592 nodeGroupVerify(ntree); /* update group node socket links*/
593 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
597 static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock, int add_link)
603 if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
604 BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
605 else if (in_out!=SOCK_IN)
606 BKE_reportf(reports, RPT_ERROR, "Socket is not an input");
608 /* XXX should check if tree is a group here! no good way to do this currently. */
609 gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_IN);
611 nodeAddLink(ntree, NULL, gsock, node, sock);
613 nodeGroupVerify(ntree); /* update group node socket links*/
614 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
620 static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock, int add_link)
626 if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
627 BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
628 else if (in_out!=SOCK_OUT)
629 BKE_reportf(reports, RPT_ERROR, "Socket is not an output");
631 /* XXX should check if tree is a group here! no good way to do this currently. */
632 gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_OUT);
634 nodeAddLink(ntree, node, sock, NULL, gsock);
636 nodeGroupVerify(ntree); /* update group node socket links*/
637 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
645 static EnumPropertyItem prop_image_layer_items[] = {
646 { 0, "PLACEHOLDER", 0, "Placeholder", ""},
647 {0, NULL, 0, NULL, NULL}};
649 static EnumPropertyItem prop_scene_layer_items[] = {
650 { 0, "PLACEHOLDER", 0, "Placeholder", ""},
651 {0, NULL, 0, NULL, NULL}};
653 static EnumPropertyItem prop_tri_channel_items[] = {
654 { 1, "R", 0, "R", ""},
655 { 2, "G", 0, "G", ""},
656 { 3, "B", 0, "B", ""},
657 {0, NULL, 0, NULL, NULL}};
659 static EnumPropertyItem node_flip_items[] = {
660 {0, "X", 0, "Flip X", ""},
661 {1, "Y", 0, "Flip Y", ""},
662 {2, "XY", 0, "Flip X & Y", ""},
663 {0, NULL, 0, NULL, NULL}};
665 static EnumPropertyItem node_ycc_items[] = {
666 { 0, "ITUBT601", 0, "ITU 601", ""},
667 { 1, "ITUBT709", 0, "ITU 709", ""},
668 { 2, "JFIF", 0, "Jpeg", ""},
669 {0, NULL, 0, NULL, NULL}};
671 #define MaxNodes 1000
677 Category_CompositorNode,
681 typedef struct NodeInfo
685 const char *enum_name;
686 const char *struct_name;
687 const char *base_name;
693 static NodeInfo nodes[MaxNodes];
695 static void reg_node(int ID, int category, const char *enum_name, const char *struct_name,
696 const char *base_name, const char *ui_name, const char *ui_desc)
698 NodeInfo *ni = nodes + ID;
701 ni->category = category;
702 ni->enum_name = enum_name;
703 ni->struct_name = struct_name;
704 ni->base_name = base_name;
705 ni->ui_name = ui_name;
706 ni->ui_desc = ui_desc;
709 static void init(void)
711 memset(nodes, 0, sizeof nodes);
713 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
714 reg_node(ID, Category_##Category, EnumName, STRINGIFY_ARG(Category##StructName), #Category, UIName, UIDesc);
716 #include "rna_nodetree_types.h"
720 reg_node(NODE_GROUP, Category_GroupNode, "GROUP", "NodeGroup", "Node", "Group", "");
723 static StructRNA* def_node(BlenderRNA *brna, int node_id)
726 NodeInfo *node = nodes + node_id;
728 srna = RNA_def_struct(brna, node->struct_name, node->base_name);
729 RNA_def_struct_ui_text(srna, node->ui_name, node->ui_desc);
730 RNA_def_struct_sdna(srna, "bNode");
735 void alloc_node_type_items(EnumPropertyItem *items, int category)
739 EnumPropertyItem *item = items;
741 for(i=0; i<MaxNodes; i++)
742 if(nodes[i].defined && nodes[i].category == category)
745 /*item = items = MEM_callocN(count * sizeof(EnumPropertyItem), "alloc_node_type_items");*/
747 for(i=0; i<MaxNodes; i++) {
748 NodeInfo *node = nodes + i;
749 if(node->defined && node->category == category) {
751 item->identifier = node->enum_name;
752 item->icon = node->icon;
753 item->name = node->ui_name;
754 item->description = node->ui_desc;
760 item->value = NODE_DYNAMIC;
761 item->identifier = "SCRIPT";
763 item->name = "Script";
764 item->description = "";
768 item->value = NODE_GROUP;
769 item->identifier = "GROUP";
771 item->name = "Group";
772 item->description = "";
776 /* NOTE!, increase 'count' when adding items here */
778 memset(item, 0, sizeof(EnumPropertyItem));
782 /* -- Common nodes ---------------------------------------------------------- */
784 static void def_group(StructRNA *srna)
788 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
789 RNA_def_property_pointer_sdna(prop, NULL, "id");
790 RNA_def_property_struct_type(prop, "NodeTree");
791 RNA_def_property_flag(prop, PROP_EDITABLE);
792 RNA_def_property_ui_text(prop, "Node Tree", "");
793 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroup_update");
797 static void def_math(StructRNA *srna)
801 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
802 RNA_def_property_enum_sdna(prop, NULL, "custom1");
803 RNA_def_property_enum_items(prop, node_math_items);
804 RNA_def_property_ui_text(prop, "Operation", "");
805 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
808 static void def_vector_math(StructRNA *srna)
812 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
813 RNA_def_property_enum_sdna(prop, NULL, "custom1");
814 RNA_def_property_enum_items(prop, node_vec_math_items);
815 RNA_def_property_ui_text(prop, "Operation", "");
816 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
819 static void def_rgb_curve(StructRNA *srna)
823 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
824 RNA_def_property_pointer_sdna(prop, NULL, "storage");
825 RNA_def_property_struct_type(prop, "CurveMapping");
826 RNA_def_property_ui_text(prop, "Mapping", "");
827 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
830 static void def_vector_curve(StructRNA *srna)
834 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
835 RNA_def_property_pointer_sdna(prop, NULL, "storage");
836 RNA_def_property_struct_type(prop, "CurveMapping");
837 RNA_def_property_ui_text(prop, "Mapping", "");
838 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
841 static void def_time(StructRNA *srna)
845 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
846 RNA_def_property_pointer_sdna(prop, NULL, "storage");
847 RNA_def_property_struct_type(prop, "CurveMapping");
848 RNA_def_property_ui_text(prop, "Curve", "");
849 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
851 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
852 RNA_def_property_int_sdna(prop, NULL, "custom1");
853 RNA_def_property_ui_text(prop, "Start Frame", "");
854 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
856 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
857 RNA_def_property_int_sdna(prop, NULL, "custom2");
858 RNA_def_property_ui_text(prop, "End Frame", "");
859 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
862 static void def_colorramp(StructRNA *srna)
866 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
867 RNA_def_property_pointer_sdna(prop, NULL, "storage");
868 RNA_def_property_struct_type(prop, "ColorRamp");
869 RNA_def_property_ui_text(prop, "Color Ramp", "");
870 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
873 static void def_mix_rgb(StructRNA *srna)
877 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
878 RNA_def_property_enum_sdna(prop, NULL, "custom1");
879 RNA_def_property_enum_items(prop, ramp_blend_items);
880 RNA_def_property_ui_text(prop, "Blend Type", "");
881 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
883 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
884 RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
885 RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
886 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
889 static void def_texture(StructRNA *srna)
893 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
894 RNA_def_property_pointer_sdna(prop, NULL, "id");
895 RNA_def_property_struct_type(prop, "Texture");
896 RNA_def_property_flag(prop, PROP_EDITABLE);
897 RNA_def_property_ui_text(prop, "Texture", "");
898 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
900 prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
901 RNA_def_property_int_sdna(prop, NULL, "custom1");
902 RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use");
903 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
907 /* -- Shader Nodes ---------------------------------------------------------- */
909 static void def_sh_material(StructRNA *srna)
913 prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
914 RNA_def_property_pointer_sdna(prop, NULL, "id");
915 RNA_def_property_struct_type(prop, "Material");
916 RNA_def_property_flag(prop, PROP_EDITABLE);
917 RNA_def_property_ui_text(prop, "Material", "");
918 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
920 prop = RNA_def_property(srna, "use_diffuse", PROP_BOOLEAN, PROP_NONE);
921 RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF);
922 RNA_def_property_ui_text(prop, "Diffuse", "Material Node outputs Diffuse");
923 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
925 prop = RNA_def_property(srna, "use_specular", PROP_BOOLEAN, PROP_NONE);
926 RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_SPEC);
927 RNA_def_property_ui_text(prop, "Specular", "Material Node outputs Specular");
928 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
930 prop = RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE);
931 RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_NEG);
932 RNA_def_property_ui_text(prop, "Invert Normal", "Material Node uses inverted normal");
933 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
936 static void def_sh_mapping(StructRNA *srna)
940 RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
942 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
943 RNA_def_property_float_sdna(prop, NULL, "loc");
944 RNA_def_property_ui_text(prop, "Location", "Location offset for the input coordinate");
945 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2);
946 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update");
948 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_XYZ); /* Not PROP_EUL, this is already in degrees, not radians */
949 RNA_def_property_float_sdna(prop, NULL, "rot");
950 RNA_def_property_ui_text(prop, "Rotation", "Rotation offset for the input coordinate");
951 RNA_def_property_ui_range(prop, -360.f, 360.f, 1.f, 2);
952 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update");
954 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
955 RNA_def_property_float_sdna(prop, NULL, "size");
956 RNA_def_property_ui_text(prop, "Scale", "Scale adjustment for the input coordinate");
957 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2);
958 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update");
960 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
961 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
962 RNA_def_property_ui_text(prop, "Clamp Minimum", "Clamp the output coordinate to a minimum value");
963 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
965 prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
966 RNA_def_property_float_sdna(prop, NULL, "min");
967 RNA_def_property_ui_text(prop, "Minimum", "Minimum value to clamp coordinate to");
968 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2);
969 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
971 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
972 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
973 RNA_def_property_ui_text(prop, "Clamp Maximum", "Clamp the output coordinate to a maximum value");
974 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
976 prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
977 RNA_def_property_float_sdna(prop, NULL, "max");
978 RNA_def_property_ui_text(prop, "Maximum", "Maximum value to clamp coordinate to");
979 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2);
980 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
983 static void def_sh_geometry(StructRNA *srna)
987 RNA_def_struct_sdna_from(srna, "NodeGeometry", "storage");
989 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
990 RNA_def_property_string_sdna(prop, NULL, "uvname");
991 RNA_def_property_ui_text(prop, "UV Layer", "");
992 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
994 prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
995 RNA_def_property_string_sdna(prop, NULL, "colname");
996 RNA_def_property_ui_text(prop, "Vertex Color Layer", "");
997 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1001 /* -- Compositor Nodes ------------------------------------------------------ */
1003 static void def_cmp_alpha_over(StructRNA *srna)
1008 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
1009 RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
1010 RNA_def_property_ui_text(prop, "Convert Premul", "");
1011 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1013 RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
1015 prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_NONE);
1016 RNA_def_property_float_sdna(prop, NULL, "x");
1017 RNA_def_property_range(prop, 0.0f, 1.0f);
1018 RNA_def_property_ui_text(prop, "Premul", "Mix Factor");
1019 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1022 static void def_cmp_hue_saturation(StructRNA *srna)
1026 RNA_def_struct_sdna_from(srna, "NodeHueSat", "storage");
1028 prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
1029 RNA_def_property_float_sdna(prop, NULL, "hue");
1030 RNA_def_property_range(prop, 0.0f, 1.0f);
1031 RNA_def_property_ui_text(prop, "Hue", "");
1032 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1034 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
1035 RNA_def_property_float_sdna(prop, NULL, "sat");
1036 RNA_def_property_range(prop, 0.0f, 2.0f);
1037 RNA_def_property_ui_text(prop, "Saturation", "");
1038 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1040 prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
1041 RNA_def_property_float_sdna(prop, NULL, "val");
1042 RNA_def_property_range(prop, 0.0f, 2.0f);
1043 RNA_def_property_ui_text(prop, "Value", "");
1044 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1047 static void def_cmp_blur(StructRNA *srna)
1051 static EnumPropertyItem filter_type_items[] = {
1052 {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
1053 {R_FILTER_TENT, "TENT", 0, "Tent", ""},
1054 {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
1055 {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
1056 {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
1057 {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
1058 {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
1059 {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
1060 {0, NULL, 0, NULL, NULL}};
1062 static EnumPropertyItem aspect_correction_type_items[] = {
1063 {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
1064 {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
1065 {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
1066 {0, NULL, 0, NULL, NULL}};
1068 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
1070 prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
1071 RNA_def_property_int_sdna(prop, NULL, "sizex");
1072 RNA_def_property_range(prop, 0, 2048);
1073 RNA_def_property_ui_text(prop, "Size X", "");
1074 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1076 prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
1077 RNA_def_property_int_sdna(prop, NULL, "sizey");
1078 RNA_def_property_range(prop, 0, 2048);
1079 RNA_def_property_ui_text(prop, "Size Y", "");
1080 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1082 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
1083 RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
1084 RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius");
1085 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1087 prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
1088 RNA_def_property_enum_sdna(prop, NULL, "aspect");
1089 RNA_def_property_enum_items(prop, aspect_correction_type_items);
1090 RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
1091 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1093 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
1094 RNA_def_property_float_sdna(prop, NULL, "fac");
1095 RNA_def_property_range(prop, 0.0f, 2.0f);
1096 RNA_def_property_ui_text(prop, "Factor", "");
1097 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1099 prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
1100 RNA_def_property_float_sdna(prop, NULL, "percentx");
1101 RNA_def_property_range(prop, 0.0f, 100.0f);
1102 RNA_def_property_ui_text(prop, "Relative Size X", "");
1103 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1105 prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
1106 RNA_def_property_float_sdna(prop, NULL, "percenty");
1107 RNA_def_property_range(prop, 0.0f, 100.0f);
1108 RNA_def_property_ui_text(prop, "Relative Size Y", "");
1109 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1111 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
1112 RNA_def_property_enum_sdna(prop, NULL, "filtertype");
1113 RNA_def_property_enum_items(prop, filter_type_items);
1114 RNA_def_property_ui_text(prop, "Filter Type", "");
1115 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1117 prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
1118 RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
1119 RNA_def_property_ui_text(prop, "Bokeh", "Uses circular filter (slower)");
1120 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1122 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
1123 RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
1124 RNA_def_property_ui_text(prop, "Gamma", "Applies filter on gamma corrected values");
1125 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1129 static void def_cmp_filter(StructRNA *srna)
1133 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
1134 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1135 RNA_def_property_enum_items(prop, node_filter_items);
1136 RNA_def_property_ui_text(prop, "Filter Type", "");
1137 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1140 static void def_cmp_map_value(StructRNA *srna)
1144 RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
1146 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
1147 RNA_def_property_float_sdna(prop, NULL, "loc");
1148 RNA_def_property_array(prop, 1);
1149 RNA_def_property_range(prop, -1000.0f, 1000.0f);
1150 RNA_def_property_ui_text(prop, "Offset", "");
1151 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1153 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1154 RNA_def_property_float_sdna(prop, NULL, "size");
1155 RNA_def_property_array(prop, 1);
1156 RNA_def_property_range(prop, -1000.0f, 1000.0f);
1157 RNA_def_property_ui_text(prop, "Size", "");
1158 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1160 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
1161 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
1162 RNA_def_property_ui_text(prop, "Use Minimum", "");
1163 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1165 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
1166 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
1167 RNA_def_property_ui_text(prop, "Use Maximum", "");
1168 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1170 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
1171 RNA_def_property_float_sdna(prop, NULL, "min");
1172 RNA_def_property_array(prop, 1);
1173 RNA_def_property_range(prop, -1000.0f, 1000.0f);
1174 RNA_def_property_ui_text(prop, "Minimum", "");
1175 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1177 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
1178 RNA_def_property_float_sdna(prop, NULL, "max");
1179 RNA_def_property_array(prop, 1);
1180 RNA_def_property_range(prop, -1000.0f, 1000.0f);
1181 RNA_def_property_ui_text(prop, "Maximum", "");
1182 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1185 static void def_cmp_vector_blur(StructRNA *srna)
1189 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
1191 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
1192 RNA_def_property_int_sdna(prop, NULL, "samples");
1193 RNA_def_property_range(prop, 1, 256);
1194 RNA_def_property_ui_text(prop, "Samples", "");
1195 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1197 prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
1198 RNA_def_property_int_sdna(prop, NULL, "minspeed");
1199 RNA_def_property_range(prop, 0, 1024);
1200 RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred; used to separate background from foreground");
1201 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1203 prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
1204 RNA_def_property_int_sdna(prop, NULL, "maxspeed");
1205 RNA_def_property_range(prop, 0, 1024);
1206 RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
1207 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1209 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
1210 RNA_def_property_float_sdna(prop, NULL, "fac");
1211 RNA_def_property_range(prop, 0.0f, 2.0f);
1212 RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors; actually 'shutter speed' in frames");
1213 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1215 prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
1216 RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
1217 RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly");
1218 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1221 static void def_cmp_levels(StructRNA *srna)
1225 static EnumPropertyItem channel_items[] = {
1226 {1, "COMBINED_RGB", 0, "C", "Combined RGB"},
1227 {2, "RED", 0, "R", "Red Channel"},
1228 {3, "GREEN", 0, "G", "Green Channel"},
1229 {4, "BLUE", 0, "B", "Blue Channel"},
1230 {5, "LUMINANCE", 0, "L", "Luminance Channel"},
1231 {0, NULL, 0, NULL, NULL}};
1233 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
1234 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1235 RNA_def_property_enum_items(prop, channel_items);
1236 RNA_def_property_ui_text(prop, "Channel", "");
1237 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1240 static void def_cmp_image(StructRNA *srna)
1245 static EnumPropertyItem type_items[] = {
1246 {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
1247 {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
1248 {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
1249 {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
1250 {0, NULL, 0, NULL, NULL}};
1253 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1254 RNA_def_property_pointer_sdna(prop, NULL, "id");
1255 RNA_def_property_struct_type(prop, "Image");
1256 RNA_def_property_flag(prop, PROP_EDITABLE);
1257 RNA_def_property_ui_text(prop, "Image", "");
1258 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1260 RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
1262 prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
1263 RNA_def_property_int_sdna(prop, NULL, "frames");
1264 RNA_def_property_range(prop, 0, MAXFRAMEF);
1265 RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); /* copied from the rna_image.c */
1266 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1268 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
1269 RNA_def_property_int_sdna(prop, NULL, "sfra");
1270 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1271 RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */
1272 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1274 prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
1275 RNA_def_property_int_sdna(prop, NULL, "offset");
1276 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1277 RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); /* copied from the rna_image.c */
1278 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1280 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
1281 RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
1282 RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.c */
1283 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1285 prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
1286 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
1287 RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes"); /* copied from the rna_image.c */
1288 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1290 prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
1291 RNA_def_property_enum_sdna(prop, NULL, "layer");
1292 RNA_def_property_enum_items(prop, prop_image_layer_items);
1293 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf");
1294 RNA_def_property_ui_text(prop, "Layer", "");
1295 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_layer_update");
1298 static void def_cmp_render_layers(StructRNA *srna)
1302 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
1303 RNA_def_property_pointer_sdna(prop, NULL, "id");
1304 RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
1305 RNA_def_property_struct_type(prop, "Scene");
1306 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
1307 RNA_def_property_ui_text(prop, "Scene", "");
1308 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1310 prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
1311 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1312 RNA_def_property_enum_items(prop, prop_scene_layer_items);
1313 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_scene_layer_itemf");
1314 RNA_def_property_ui_text(prop, "Layer", "");
1315 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1318 static void def_cmp_output_file(StructRNA *srna)
1322 static EnumPropertyItem type_items[] = {
1323 {R_TARGA, "TARGA", 0, "Targa", ""},
1324 {R_RAWTGA, "RAW_TARGA", 0, "Targa Raw", ""},
1325 {R_PNG, "PNG", 0, "PNG", ""},
1327 {R_DDS, "DDS", 0, "DirectDraw Surface", ""},
1329 {R_BMP, "BMP", 0, "BMP", ""},
1330 {R_JPEG90, "JPEG", 0, "JPEG", ""},
1331 {R_IRIS, "IRIS", 0, "IRIS", ""},
1332 {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""},
1333 {R_CINEON, "CINEON", 0, "Cineon", ""},
1334 {R_DPX, "DPX", 0, "DPX", ""},
1335 {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
1336 {0, NULL, 0, NULL, NULL}};
1338 static EnumPropertyItem openexr_codec_items[] = {
1339 {0, "NONE", 0, "None", ""},
1340 {1, "PXR24", 0, "Pxr24 (lossy)", ""},
1341 {2, "ZIP", 0, "ZIP (lossless)", ""},
1342 {3, "PIZ", 0, "PIZ (lossless)", ""},
1343 {4, "RLE", 0, "RLE (lossless)", ""},
1344 {0, NULL, 0, NULL, NULL}};
1346 RNA_def_struct_sdna_from(srna, "NodeImageFile", "storage");
1348 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1349 RNA_def_property_string_sdna(prop, NULL, "name");
1350 RNA_def_property_ui_text(prop, "File Path", "Output path for the image, same functionality as render output.");
1351 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1353 prop = RNA_def_property(srna, "image_type", PROP_ENUM, PROP_NONE);
1354 RNA_def_property_enum_sdna(prop, NULL, "imtype");
1355 RNA_def_property_enum_items(prop, type_items);
1356 RNA_def_property_ui_text(prop, "Image Type", "");
1357 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1359 prop = RNA_def_property(srna, "use_exr_half", PROP_BOOLEAN, PROP_NONE);
1360 RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_HALF);
1361 RNA_def_property_ui_text(prop, "Half", "");
1362 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1364 prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
1365 RNA_def_property_enum_sdna(prop, NULL, "codec");
1366 RNA_def_property_enum_items(prop, openexr_codec_items);
1367 RNA_def_property_ui_text(prop, "Codec", "");
1368 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1370 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
1371 RNA_def_property_int_sdna(prop, NULL, "quality");
1372 RNA_def_property_range(prop, 1, 100);
1373 RNA_def_property_ui_text(prop, "Quality", "");
1374 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1376 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
1377 RNA_def_property_int_sdna(prop, NULL, "sfra");
1378 RNA_def_property_int_funcs(prop, NULL, "rna_Image_start_frame_set", NULL);
1379 RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF);
1380 RNA_def_property_ui_text(prop, "Start Frame", "");
1381 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1383 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
1384 RNA_def_property_int_sdna(prop, NULL, "efra");
1385 RNA_def_property_int_funcs(prop, NULL, "rna_Image_end_frame_set", NULL);
1386 RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF);
1387 RNA_def_property_ui_text(prop, "End Frame", "");
1388 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1391 static void def_cmp_dilate_erode(StructRNA *srna)
1395 prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
1396 RNA_def_property_int_sdna(prop, NULL, "custom2");
1397 RNA_def_property_range(prop, -100, 100);
1398 RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
1399 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1402 static void def_cmp_scale(StructRNA *srna)
1406 static EnumPropertyItem space_items[] = {
1407 {0, "RELATIVE", 0, "Relative", ""},
1408 {1, "ABSOLUTE", 0, "Absolute", ""},
1409 {2, "SCENE_SIZE", 0, "Scene Size", ""},
1410 {3, "RENDER_SIZE", 0, "Render Size", ""},
1411 {0, NULL, 0, NULL, NULL}};
1413 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
1414 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1415 RNA_def_property_enum_items(prop, space_items);
1416 RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
1417 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1420 static void def_cmp_rotate(StructRNA *srna)
1424 static EnumPropertyItem rotate_items[] = {
1425 {0, "NEAREST", 0, "Nearest", ""},
1426 {1, "BILINEAR", 0, "Bilinear", ""},
1427 {2, "BICUBIC", 0, "Bicubic", ""},
1428 {0, NULL, 0, NULL, NULL}};
1430 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
1431 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1432 RNA_def_property_enum_items(prop, rotate_items);
1433 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
1434 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1437 static void def_cmp_diff_matte(StructRNA *srna)
1441 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
1443 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
1444 RNA_def_property_float_sdna(prop, NULL, "t1");
1445 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
1446 RNA_def_property_range(prop, 0.0f, 1.0f);
1447 RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
1448 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1450 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
1451 RNA_def_property_float_sdna(prop, NULL, "t2");
1452 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
1453 RNA_def_property_range(prop, 0.0f, 1.0f);
1454 RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed");
1455 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1458 static void def_cmp_color_matte(StructRNA *srna)
1462 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
1464 prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
1465 RNA_def_property_float_sdna(prop, NULL, "t1");
1466 RNA_def_property_range(prop, 0.0f, 1.0f);
1467 RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
1468 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1470 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
1471 RNA_def_property_float_sdna(prop, NULL, "t2");
1472 RNA_def_property_range(prop, 0.0f, 1.0f);
1473 RNA_def_property_ui_text(prop, "S", "Saturation Tolerance for the color");
1474 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1476 prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
1477 RNA_def_property_float_sdna(prop, NULL, "t3");
1478 RNA_def_property_range(prop, 0.0f, 1.0f);
1479 RNA_def_property_ui_text(prop, "V", "Value Tolerance for the color");
1480 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1483 static void def_cmp_distance_matte(StructRNA *srna)
1487 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
1489 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
1490 RNA_def_property_float_sdna(prop, NULL, "t1");
1491 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
1492 RNA_def_property_range(prop, 0.0f, 1.0f);
1493 RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
1494 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1496 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
1497 RNA_def_property_float_sdna(prop, NULL, "t2");
1498 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
1499 RNA_def_property_range(prop, 0.0f, 1.0f);
1500 RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed");
1501 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1504 static void def_cmp_color_spill(StructRNA *srna)
1508 static EnumPropertyItem channel_items[] = {
1509 {1, "R", 0, "R", "Red Spill Suppression"},
1510 {2, "G", 0, "G", "Green Spill Suppression"},
1511 {3, "B", 0, "B", "Blue Spill Suppression"},
1512 {0, NULL, 0, NULL, NULL}};
1514 static EnumPropertyItem limit_channel_items[] = {
1515 {1, "R", 0, "R", "Limit by Red"},
1516 {2, "G", 0, "G", "Limit by Green"},
1517 {3, "B", 0, "B", "Limit by Blue"},
1518 {0, NULL, 0, NULL, NULL}};
1520 static EnumPropertyItem algorithm_items[] = {
1521 {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"},
1522 {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"},
1523 {0, NULL, 0, NULL, NULL}};
1525 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
1526 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1527 RNA_def_property_enum_items(prop, channel_items);
1528 RNA_def_property_ui_text(prop, "Channel", "");
1529 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1531 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
1532 RNA_def_property_enum_sdna(prop, NULL, "custom2");
1533 RNA_def_property_enum_items(prop, algorithm_items);
1534 RNA_def_property_ui_text(prop, "Algorithm", "");
1535 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1537 RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
1539 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
1540 RNA_def_property_enum_sdna(prop, NULL, "limchan");
1541 RNA_def_property_enum_items(prop, limit_channel_items);
1542 RNA_def_property_ui_text(prop, "Limit Channel", "");
1543 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1545 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
1546 RNA_def_property_float_sdna(prop, NULL, "limscale");
1547 RNA_def_property_range(prop, 0.5f, 1.5f);
1548 RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
1549 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1551 prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
1552 RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0);
1553 RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand");
1554 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1556 prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
1557 RNA_def_property_float_sdna(prop, NULL, "uspillr");
1558 RNA_def_property_range(prop, 0.0f, 1.5f);
1559 RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
1560 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1562 prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
1563 RNA_def_property_float_sdna(prop, NULL, "uspillg");
1564 RNA_def_property_range(prop, 0.0f, 1.5f);
1565 RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
1566 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1568 prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
1569 RNA_def_property_float_sdna(prop, NULL, "uspillb");
1570 RNA_def_property_range(prop, 0.0f, 1.5f);
1571 RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
1572 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1575 static void def_cmp_luma_matte(StructRNA *srna)
1579 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
1581 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
1582 RNA_def_property_float_sdna(prop, NULL, "t1");
1583 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
1584 RNA_def_property_range(prop, 0.0f, 1.0f);
1585 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
1586 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1588 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
1589 RNA_def_property_float_sdna(prop, NULL, "t2");
1590 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
1591 RNA_def_property_range(prop, 0.0f, 1.0f);
1592 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
1593 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1596 static void def_cmp_chroma_matte(StructRNA *srna)
1600 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
1602 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
1603 RNA_def_property_float_sdna(prop, NULL, "t1");
1604 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
1605 RNA_def_property_range(prop, 1.0f, 80.0f);
1606 RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
1607 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1609 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
1610 RNA_def_property_float_sdna(prop, NULL, "t2");
1611 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
1612 RNA_def_property_range(prop, 0.0f, 30.0f);
1613 RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
1614 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1616 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
1617 RNA_def_property_float_sdna(prop, NULL, "fsize");
1618 RNA_def_property_range(prop, 0.0f, 1.0f);
1619 RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
1620 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1622 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
1623 RNA_def_property_float_sdna(prop, NULL, "fstrength");
1624 RNA_def_property_range(prop, 0.0f, 1.0f);
1625 RNA_def_property_ui_text(prop, "Gain", "Alpha gain");
1626 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1628 prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
1629 RNA_def_property_float_sdna(prop, NULL, "t3");
1630 RNA_def_property_range(prop, 0.0f, 1.0f);
1631 RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
1632 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1635 static void def_cmp_channel_matte(StructRNA *srna)
1639 static EnumPropertyItem color_space_items[] = {
1640 {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB Color Space"},
1641 {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV Color Space"},
1642 {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"},
1643 {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr Color Space"},
1644 {0, NULL, 0, NULL, NULL}};
1646 static EnumPropertyItem algorithm_items[] = {
1647 {0, "SINGLE", 0, "Single", "Limit by single channel"},
1648 {1, "MAX", 0, "Max", "Limit by max of other channels "},
1649 {0, NULL, 0, NULL, NULL}};
1651 prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
1652 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1653 RNA_def_property_enum_items(prop, color_space_items);
1654 RNA_def_property_ui_text(prop, "Color Space", "");
1655 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1657 prop= RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
1658 RNA_def_property_enum_sdna(prop, NULL, "custom2");
1659 RNA_def_property_enum_items(prop, prop_tri_channel_items);
1660 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
1661 RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
1662 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1664 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
1666 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
1667 RNA_def_property_enum_sdna(prop, NULL, "algorithm");
1668 RNA_def_property_enum_items(prop, algorithm_items);
1669 RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
1670 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1672 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
1673 RNA_def_property_enum_sdna(prop, NULL, "channel");
1674 RNA_def_property_enum_items(prop, prop_tri_channel_items);
1675 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
1676 RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channels value");
1677 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1679 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
1680 RNA_def_property_float_sdna(prop, NULL, "t1");
1681 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
1682 RNA_def_property_range(prop, 0.0f, 1.0f);
1683 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
1684 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1686 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
1687 RNA_def_property_float_sdna(prop, NULL, "t2");
1688 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
1689 RNA_def_property_range(prop, 0.0f, 1.0f);
1690 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
1691 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1694 static void def_cmp_flip(StructRNA *srna)
1698 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
1699 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1700 RNA_def_property_enum_items(prop, node_flip_items);
1701 RNA_def_property_ui_text(prop, "Axis", "");
1702 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1705 static void def_cmp_splitviewer(StructRNA *srna)
1709 static EnumPropertyItem axis_items[] = {
1710 {0, "X", 0, "X", ""},
1711 {1, "Y", 0, "Y", ""},
1712 {0, NULL, 0, NULL, NULL}};
1714 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
1715 RNA_def_property_enum_sdna(prop, NULL, "custom2");
1716 RNA_def_property_enum_items(prop, axis_items);
1717 RNA_def_property_ui_text(prop, "Axis", "");
1718 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1720 prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
1721 RNA_def_property_int_sdna(prop, NULL, "custom1");
1722 RNA_def_property_range(prop, 0, 100);
1723 RNA_def_property_ui_text(prop, "Factor", "");
1724 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1727 static void def_cmp_id_mask(StructRNA *srna)
1731 prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
1732 RNA_def_property_int_sdna(prop, NULL, "custom1");
1733 RNA_def_property_range(prop, 0, 10000);
1734 RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
1735 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1738 static void def_cmp_map_uv(StructRNA *srna)
1742 prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
1743 RNA_def_property_int_sdna(prop, NULL, "custom1");
1744 RNA_def_property_range(prop, 0, 100);
1745 RNA_def_property_ui_text(prop, "Alpha", "");
1746 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1749 static void def_cmp_defocus(StructRNA *srna)
1753 static EnumPropertyItem bokeh_items[] = {
1754 {8, "OCTAGON", 0, "Octagonal", "8 sides"},
1755 {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
1756 {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
1757 {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
1758 {4, "SQUARE", 0, "Square", "4 sides"},
1759 {3, "TRIANGLE", 0, "Triangular", "3 sides"},
1760 {0, "CIRCLE", 0, "Circular", ""},
1761 {0, NULL, 0, NULL, NULL}};
1763 RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
1765 prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
1766 RNA_def_property_enum_sdna(prop, NULL, "bktype");
1767 RNA_def_property_enum_items(prop, bokeh_items);
1768 RNA_def_property_ui_text(prop, "Bokeh Type", "");
1769 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1771 /* TODO: angle in degrees */
1772 prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE);
1773 RNA_def_property_int_sdna(prop, NULL, "rotation");
1774 RNA_def_property_range(prop, 0, 90);
1775 RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees");
1776 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1778 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
1779 RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
1780 RNA_def_property_ui_text(prop, "Gamma Correction", "Enable gamma correction before and after main process");
1781 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1784 prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
1785 RNA_def_property_float_sdna(prop, NULL, "fstop");
1786 RNA_def_property_range(prop, 0.0f, 128.0f);
1787 RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
1788 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1790 prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
1791 RNA_def_property_float_sdna(prop, NULL, "maxblur");
1792 RNA_def_property_range(prop, 0.0f, 10000.0f);
1793 RNA_def_property_ui_text(prop, "Max Blur", "blur limit, maximum CoC radius, 0=no limit");
1794 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1796 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
1797 RNA_def_property_float_sdna(prop, NULL, "bthresh");
1798 RNA_def_property_range(prop, 0.0f, 100.0f);
1799 RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
1800 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1802 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
1803 RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
1804 RNA_def_property_ui_text(prop, "Preview", "Enable sampling mode, useful for preview when using low samplecounts");
1805 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1807 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
1808 RNA_def_property_int_sdna(prop, NULL, "samples");
1809 RNA_def_property_range(prop, 16, 256);
1810 RNA_def_property_ui_text(prop, "Samples", "Number of samples (16=grainy, higher=less noise)");
1811 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1813 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
1814 RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
1815 RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual z-buffer (auto enabled if node not image based, eg. time node)");
1816 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1818 prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
1819 RNA_def_property_float_sdna(prop, NULL, "scale");
1820 RNA_def_property_range(prop, 0.0f, 1000.0f);
1821 RNA_def_property_ui_text(prop, "Z-Scale", "Scales the Z input when not using a z-buffer, controls maximum blur designated by the color white or input value 1");
1822 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1825 static void def_cmp_invert(StructRNA *srna)
1829 prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
1830 RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
1831 RNA_def_property_ui_text(prop, "RGB", "");
1832 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1834 prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
1835 RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
1836 RNA_def_property_ui_text(prop, "Alpha", "");
1837 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1840 static void def_cmp_crop(StructRNA *srna)
1844 prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
1845 RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
1846 RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
1847 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1849 prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
1850 RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
1851 RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
1852 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1854 RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
1856 prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
1857 RNA_def_property_int_sdna(prop, NULL, "x1");
1858 RNA_def_property_range(prop, 0, 10000);
1859 RNA_def_property_ui_text(prop, "X1", "");
1860 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1862 prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
1863 RNA_def_property_int_sdna(prop, NULL, "x2");
1864 RNA_def_property_range(prop, 0, 10000);
1865 RNA_def_property_ui_text(prop, "X2", "");
1866 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1868 prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
1869 RNA_def_property_int_sdna(prop, NULL, "y1");
1870 RNA_def_property_range(prop, 0, 10000);
1871 RNA_def_property_ui_text(prop, "Y1", "");
1872 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1874 prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
1875 RNA_def_property_int_sdna(prop, NULL, "y2");
1876 RNA_def_property_range(prop, 0, 10000);
1877 RNA_def_property_ui_text(prop, "Y2", "");
1878 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1880 prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
1881 RNA_def_property_float_sdna(prop, NULL, "fac_x1");
1882 RNA_def_property_range(prop, 0.0, 1.0);
1883 RNA_def_property_ui_text(prop, "X1", "");
1884 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1886 prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
1887 RNA_def_property_float_sdna(prop, NULL, "fac_x2");
1888 RNA_def_property_range(prop, 0.0, 1.0);
1889 RNA_def_property_ui_text(prop, "X2", "");
1890 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1892 prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
1893 RNA_def_property_float_sdna(prop, NULL, "fac_y1");
1894 RNA_def_property_range(prop, 0.0, 1.0);
1895 RNA_def_property_ui_text(prop, "Y1", "");
1896 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1898 prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
1899 RNA_def_property_float_sdna(prop, NULL, "fac_y2");
1900 RNA_def_property_range(prop, 0.0, 1.0);
1901 RNA_def_property_ui_text(prop, "Y2", "");
1902 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1905 static void def_cmp_dblur(StructRNA *srna)
1909 RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
1911 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1912 RNA_def_property_int_sdna(prop, NULL, "iter");
1913 RNA_def_property_range(prop, 1, 32);
1914 RNA_def_property_ui_text(prop, "Iterations", "");
1915 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1917 prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
1918 RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
1919 RNA_def_property_ui_text(prop, "Wrap", "");
1920 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1922 prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
1923 RNA_def_property_float_sdna(prop, NULL, "center_x");
1924 RNA_def_property_range(prop, 0.0f, 1.0f);
1925 RNA_def_property_ui_text(prop, "Center X", "");
1926 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1928 prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
1929 RNA_def_property_float_sdna(prop, NULL, "center_y");
1930 RNA_def_property_range(prop, 0.0f, 1.0f);
1931 RNA_def_property_ui_text(prop, "Center Y", "");
1932 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1934 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
1935 RNA_def_property_float_sdna(prop, NULL, "distance");
1936 RNA_def_property_range(prop, -1.0f, 1.0f);
1937 RNA_def_property_ui_text(prop, "Distance", "");
1938 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1940 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
1941 RNA_def_property_float_sdna(prop, NULL, "angle");
1942 RNA_def_property_range(prop, 0.0f, 360.0f);
1943 RNA_def_property_ui_text(prop, "Angle", "");
1944 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1946 prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE);
1947 RNA_def_property_float_sdna(prop, NULL, "spin");
1948 RNA_def_property_range(prop, -360.0f, 360.0f);
1949 RNA_def_property_ui_text(prop, "Spin", "");
1950 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1952 prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
1953 RNA_def_property_float_sdna(prop, NULL, "zoom");
1954 RNA_def_property_range(prop, 0.0f, 100.0f);
1955 RNA_def_property_ui_text(prop, "Zoom", "");
1956 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1959 static void def_cmp_bilateral_blur(StructRNA *srna)
1963 RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
1965 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1966 RNA_def_property_int_sdna(prop, NULL, "iter");
1967 RNA_def_property_range(prop, 1, 128);
1968 RNA_def_property_ui_text(prop, "Iterations", "");
1969 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1971 prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
1972 RNA_def_property_float_sdna(prop, NULL, "sigma_color");
1973 RNA_def_property_range(prop, 0.01f, 3.0f);
1974 RNA_def_property_ui_text(prop, "Color Sigma", "");
1975 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1977 prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
1978 RNA_def_property_float_sdna(prop, NULL, "sigma_space");
1979 RNA_def_property_range(prop, 0.01f, 30.0f);
1980 RNA_def_property_ui_text(prop, "Space Sigma", "");
1981 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
1984 static void def_cmp_premul_key(StructRNA *srna)
1988 static EnumPropertyItem type_items[] = {
1989 {0, "KEY_TO_PREMUL", 0, "Key to Premul", ""},
1990 {1, "PREMUL_TO_KEY", 0, "Premul to Key", ""},
1991 {0, NULL, 0, NULL, NULL}};
1993 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
1994 RNA_def_property_enum_sdna(prop, NULL, "custom1");
1995 RNA_def_property_enum_items(prop, type_items);
1996 RNA_def_property_ui_text(prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
1997 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2001 static void def_cmp_glare(StructRNA *srna)
2005 static EnumPropertyItem type_items[] = {
2006 {3, "GHOSTS", 0, "Ghosts", ""},
2007 {2, "STREAKS", 0, "Streaks", ""},
2008 {1, "FOG_GLOW", 0, "Fog Glow", ""},
2009 {0, "SIMPLE_STAR", 0, "Simple Star", ""},
2010 {0, NULL, 0, NULL, NULL}};
2012 static EnumPropertyItem quality_items[] = {
2013 {0, "HIGH", 0, "High", ""},
2014 {1, "MEDIUM", 0, "Medium", ""},
2015 {2, "LOW", 0, "Low", ""},
2016 {0, NULL, 0, NULL, NULL}};
2018 RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
2020 prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
2021 RNA_def_property_enum_sdna(prop, NULL, "type");
2022 RNA_def_property_enum_items(prop, type_items);
2023 RNA_def_property_ui_text(prop, "Glare Type", "");
2024 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2026 prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
2027 RNA_def_property_enum_sdna(prop, NULL, "quality");
2028 RNA_def_property_enum_items(prop, quality_items);
2029 RNA_def_property_ui_text(prop, "Quality", "If not set to high quality, the effect will be applied to a low-res copy of the source image");
2030 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2032 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2033 RNA_def_property_int_sdna(prop, NULL, "iter");
2034 RNA_def_property_range(prop, 2, 5);
2035 RNA_def_property_ui_text(prop, "Iterations", "");
2036 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2038 prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
2039 RNA_def_property_float_sdna(prop, NULL, "colmod");
2040 RNA_def_property_range(prop, 0.0f, 1.0f);
2041 RNA_def_property_ui_text(prop, "Color Modulation", "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
2042 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2044 prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
2045 RNA_def_property_float_sdna(prop, NULL, "mix");
2046 RNA_def_property_range(prop, -1.0f, 1.0f);
2047 RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
2048 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2050 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
2051 RNA_def_property_float_sdna(prop, NULL, "threshold");
2052 RNA_def_property_range(prop, 0.0f, 1000.0f);
2053 RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value");
2054 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2056 prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
2057 RNA_def_property_int_sdna(prop, NULL, "angle");
2058 RNA_def_property_range(prop, 2, 16);
2059 RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
2060 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2062 prop = RNA_def_property(srna, "angle_offset", PROP_INT, PROP_NONE);
2063 RNA_def_property_int_sdna(prop, NULL, "angle_ofs");
2064 RNA_def_property_range(prop, 0, 180);
2065 RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees");
2066 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2068 prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
2069 RNA_def_property_float_sdna(prop, NULL, "fade");
2070 RNA_def_property_range(prop, 0.75f, 1.0f);
2071 RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
2072 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2074 prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
2075 RNA_def_property_boolean_sdna(prop, NULL, "angle", 0);
2076 RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
2077 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2079 prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
2080 RNA_def_property_int_sdna(prop, NULL, "size");
2081 RNA_def_property_range(prop, 6, 9);
2082 RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
2083 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2088 static void def_cmp_tonemap(StructRNA *srna)
2092 static EnumPropertyItem type_items[] = {
2093 {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
2094 {0, "RH_SIMPLE", 0, "Rh Simple", ""},
2095 {0, NULL, 0, NULL, NULL}};
2097 RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
2099 prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
2100 RNA_def_property_enum_sdna(prop, NULL, "type");
2101 RNA_def_property_enum_items(prop, type_items);
2102 RNA_def_property_ui_text(prop, "Tonemap Type", "");
2103 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2105 prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
2106 RNA_def_property_float_sdna(prop, NULL, "key");
2107 RNA_def_property_range(prop, 0.0f, 1.0f);
2108 RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
2109 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2111 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
2112 RNA_def_property_float_sdna(prop, NULL, "offset");
2113 RNA_def_property_range(prop, 0.001f, 10.0f);
2114 RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve");
2115 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2117 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
2118 RNA_def_property_float_sdna(prop, NULL, "gamma");
2119 RNA_def_property_range(prop, 0.001f, 3.0f);
2120 RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
2121 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2123 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
2124 RNA_def_property_float_sdna(prop, NULL, "f");
2125 RNA_def_property_range(prop, -8.0f, 8.0f);
2126 RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
2127 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2129 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
2130 RNA_def_property_float_sdna(prop, NULL, "m");
2131 RNA_def_property_range(prop, 0.0f, 1.0f);
2132 RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
2133 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2135 prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
2136 RNA_def_property_float_sdna(prop, NULL, "a");
2137 RNA_def_property_range(prop, 0.0f, 1.0f);
2138 RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
2139 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2141 prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
2142 RNA_def_property_float_sdna(prop, NULL, "c");
2143 RNA_def_property_range(prop, 0.0f, 1.0f);
2144 RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
2145 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2148 static void def_cmp_lensdist(StructRNA *srna)
2152 RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
2154 prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
2155 RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
2156 RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode. Effect is applied in horizontal direction only");
2157 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2159 prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
2160 RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
2161 RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering; faster, but also noisier");
2162 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2164 prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
2165 RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
2166 RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible");
2167 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2170 static void def_cmp_colorbalance(StructRNA *srna)
2173 static float default_1[3] = {1.f, 1.f, 1.f};
2175 static EnumPropertyItem type_items[] = {
2176 {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
2177 {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"},
2178 {0, NULL, 0, NULL, NULL}};
2180 prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
2181 RNA_def_property_enum_sdna(prop, NULL, "custom1");
2182 RNA_def_property_enum_items(prop, type_items);
2183 RNA_def_property_ui_text(prop, "Correction Formula", "");
2184 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2186 RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
2188 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
2189 RNA_def_property_float_sdna(prop, NULL, "lift");
2190 RNA_def_property_array(prop, 3);
2191 RNA_def_property_float_array_default(prop, default_1);
2192 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
2193 RNA_def_property_ui_text(prop, "Lift", "Correction for Shadows");
2194 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2196 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
2197 RNA_def_property_float_sdna(prop, NULL, "gamma");
2198 RNA_def_property_array(prop, 3);
2199 RNA_def_property_float_array_default(prop, default_1);
2200 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
2201 RNA_def_property_ui_text(prop, "Gamma", "Correction for Midtones");
2202 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2204 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
2205 RNA_def_property_float_sdna(prop, NULL, "gain");
2206 RNA_def_property_array(prop, 3);
2207 RNA_def_property_float_array_default(prop, default_1);
2208 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
2209 RNA_def_property_ui_text(prop, "Gain", "Correction for Highlights");
2210 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2213 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
2214 RNA_def_property_float_sdna(prop, NULL, "lift");
2215 RNA_def_property_array(prop, 3);
2216 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
2217 RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows");
2218 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2220 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
2221 RNA_def_property_float_sdna(prop, NULL, "gamma");
2222 RNA_def_property_array(prop, 3);
2223 RNA_def_property_float_array_default(prop, default_1);
2224 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
2225 RNA_def_property_ui_text(prop, "Power", "Correction for Midtones");
2226 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2228 prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
2229 RNA_def_property_float_sdna(prop, NULL, "gain");
2230 RNA_def_property_array(prop, 3);
2231 RNA_def_property_float_array_default(prop, default_1);
2232 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
2233 RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights");
2234 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2237 static void def_cmp_huecorrect(StructRNA *srna)
2241 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
2242 RNA_def_property_pointer_sdna(prop, NULL, "storage");
2243 RNA_def_property_struct_type(prop, "CurveMapping");
2244 RNA_def_property_ui_text(prop, "Mapping", "");
2245 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2248 static void def_cmp_zcombine(StructRNA *srna)
2252 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
2253 RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
2254 RNA_def_property_ui_text(prop, "Use Alpha", "Takes Alpha channel into account when doing the Z operation");
2255 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2258 static void def_cmp_ycc(StructRNA *srna)
2262 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2263 RNA_def_property_enum_sdna(prop, NULL, "custom1");
2264 RNA_def_property_enum_items(prop, node_ycc_items);
2265 RNA_def_property_ui_text(prop, "Mode", "");
2266 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2270 /* -- Texture Nodes --------------------------------------------------------- */
2272 static void def_tex_output(StructRNA *srna)
2276 RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
2278 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
2279 RNA_def_property_string_sdna(prop, NULL, "name");
2280 RNA_def_property_ui_text(prop, "Output Name", "");
2281 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2284 static void def_tex_image(StructRNA *srna)
2288 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
2289 RNA_def_property_pointer_sdna(prop, NULL, "id");
2290 RNA_def_property_struct_type(prop, "Image");
2291 RNA_def_property_flag(prop, PROP_EDITABLE);
2292 RNA_def_property_ui_text(prop, "Image", "");
2293 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2295 /* is this supposed to be exposed? not sure..
2296 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2297 RNA_def_property_pointer_sdna(prop, NULL, "storage");
2298 RNA_def_property_struct_type(prop, "ImageUser");
2299 RNA_def_property_ui_text(prop, "Settings", "");
2300 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2304 static void def_tex_bricks(StructRNA *srna)
2308 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
2309 RNA_def_property_float_sdna(prop, NULL, "custom3");
2310 RNA_def_property_range(prop, 0.0f, 1.0f);
2311 RNA_def_property_ui_text(prop, "Offset Amount", "");
2312 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2314 prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
2315 RNA_def_property_int_sdna(prop, NULL, "custom1");
2316 RNA_def_property_range(prop, 2, 99);
2317 RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
2318 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2320 prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
2321 RNA_def_property_float_sdna(prop, NULL, "custom4");
2322 RNA_def_property_range(prop, 0.0f, 99.0f);
2323 RNA_def_property_ui_text(prop, "Squash Amount", "");
2324 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2326 prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
2327 RNA_def_property_int_sdna(prop, NULL, "custom2");
2328 RNA_def_property_range(prop, 2, 99);
2329 RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
2330 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2333 /* -------------------------------------------------------------------------- */
2335 static EnumPropertyItem shader_node_type_items[MaxNodes];
2336 static void rna_def_shader_node(BlenderRNA *brna)
2341 alloc_node_type_items(shader_node_type_items, Category_ShaderNode);
2343 srna = RNA_def_struct(brna, "ShaderNode", "Node");
2344 RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
2345 RNA_def_struct_sdna(srna, "bNode");
2347 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2348 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2349 RNA_def_property_enum_items(prop, shader_node_type_items);
2350 RNA_def_property_ui_text(prop, "Type", "");
2353 static EnumPropertyItem compositor_node_type_items[MaxNodes];
2354 static void rna_def_compositor_node(BlenderRNA *brna)
2359 alloc_node_type_items(compositor_node_type_items, Category_CompositorNode);
2361 srna = RNA_def_struct(brna, "CompositorNode", "Node");
2362 RNA_def_struct_ui_text(srna, "Compositor Node", "");
2363 RNA_def_struct_sdna(srna, "bNode");
2365 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2366 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2367 RNA_def_property_enum_items(prop, compositor_node_type_items);
2368 RNA_def_property_ui_text(prop, "Type", "");
2371 static EnumPropertyItem texture_node_type_items[MaxNodes];
2372 static void rna_def_texture_node(BlenderRNA *brna)
2377 alloc_node_type_items(texture_node_type_items, Category_TextureNode);
2379 srna = RNA_def_struct(brna, "TextureNode", "Node");
2380 RNA_def_struct_ui_text(srna, "Texture Node", "");
2381 RNA_def_struct_sdna(srna, "bNode");
2383 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2384 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2385 RNA_def_property_enum_items(prop, texture_node_type_items);
2386 RNA_def_property_ui_text(prop, "Type", "");
2389 /* -------------------------------------------------------------------------- */
2391 static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
2397 RNA_def_property_srna(cprop, "NodeLinks");
2398 srna= RNA_def_struct(brna, "NodeLinks", NULL);
2399 RNA_def_struct_sdna(srna, "bNodeTree");
2400 RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
2402 func= RNA_def_function(srna, "new", "rna_NodeTree_link_new");
2403 RNA_def_function_ui_description(func, "Add a node link to this node tree.");
2404 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2405 parm= RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket.");
2406 RNA_def_property_flag(parm, PROP_REQUIRED);
2407 parm= RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket.");
2408 RNA_def_property_flag(parm, PROP_REQUIRED);
2410 parm= RNA_def_pointer(func, "link", "NodeLink", "", "New node link.");
2411 RNA_def_function_return(func, parm);
2413 func= RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
2414 RNA_def_function_ui_description(func, "remove a node link from the node tree.");
2415 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2416 parm= RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove.");
2417 RNA_def_property_flag(parm, PROP_REQUIRED);
2420 static void rna_def_composite_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
2426 RNA_def_property_srna(cprop, "CompositorNodes");
2427 srna= RNA_def_struct(brna, "CompositorNodes", NULL);
2428 RNA_def_struct_sdna(srna, "bNodeTree");
2429 RNA_def_struct_ui_text(srna, "Compositor Nodes", "Collection of Compositor Nodes");
2431 func= RNA_def_function(srna, "new", "rna_NodeTree_node_composite_new");
2432 RNA_def_function_ui_description(func, "Add a node to this node tree.");
2433 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
2434 parm= RNA_def_enum(func, "type", compositor_node_type_items, 0, "Type", "Type of node to add");
2435 RNA_def_property_flag(parm, PROP_REQUIRED);
2436 RNA_def_pointer(func, "group", "NodeTree", "", "The group tree");
2438 parm= RNA_def_pointer(func, "node", "Node", "", "New node.");
2439 RNA_def_function_return(func, parm);
2441 func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
2442 RNA_def_function_ui_description(func, "remove a node from this node tree.");
2443 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2444 parm= RNA_def_pointer(func, "node", "Node", "", "The node to remove.");
2445 RNA_def_property_flag(parm, PROP_REQUIRED);
2448 static void rna_def_shader_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
2454 RNA_def_property_srna(cprop, "ShaderNodes");
2455 srna= RNA_def_struct(brna, "ShaderNodes", NULL);
2456 RNA_def_struct_sdna(srna, "bNodeTree");
2457 RNA_def_struct_ui_text(srna, "Shader Nodes", "Collection of Shader Nodes");
2459 func= RNA_def_function(srna, "new", "rna_NodeTree_node_new");
2460 RNA_def_function_ui_description(func, "Add a node to this node tree.");
2461 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
2462 parm= RNA_def_enum(func, "type", shader_node_type_items, 0, "Type", "Type of node to add");
2463 RNA_def_property_flag(parm, PROP_REQUIRED);
2464 RNA_def_pointer(func, "group", "NodeTree", "", "The group tree");
2466 parm= RNA_def_pointer(func, "node", "Node", "", "New node.");
2467 RNA_def_function_return(func, parm);
2469 func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
2470 RNA_def_function_ui_description(func, "remove a node from this node tree.");
2471 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2472 parm= RNA_def_pointer(func, "node", "Node", "", "The node to remove.");
2473 RNA_def_property_flag(parm, PROP_REQUIRED);
2476 static void rna_def_texture_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
2482 RNA_def_property_srna(cprop, "TextureNodes");
2483 srna= RNA_def_struct(brna, "TextureNodes", NULL);
2484 RNA_def_struct_sdna(srna, "bNodeTree");
2485 RNA_def_struct_ui_text(srna, "Texture Nodes", "Collection of Texture Nodes");
2487 func= RNA_def_function(srna, "new", "rna_NodeTree_node_texture_new");
2488 RNA_def_function_ui_description(func, "Add a node to this node tree.");
2489 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
2490 parm= RNA_def_enum(func, "type", texture_node_type_items, 0, "Type", "Type of node to add");
2491 RNA_def_property_flag(parm, PROP_REQUIRED);
2492 RNA_def_pointer(func, "group", "NodeTree", "", "The group tree");
2494 parm= RNA_def_pointer(func, "node", "Node", "", "New node.");
2495 RNA_def_function_return(func, parm);
2497 func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
2498 RNA_def_function_ui_description(func, "remove a node from this node tree.");
2499 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2500 parm= RNA_def_pointer(func, "node", "Node", "", "The node to remove.");
2501 RNA_def_property_flag(parm, PROP_REQUIRED);
2504 static void rna_def_node_socket(BlenderRNA *brna)
2509 srna = RNA_def_struct(brna, "NodeSocket", NULL);
2510 RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node");
2511 RNA_def_struct_refine_func(srna, "rna_NodeSocketType_refine");
2512 RNA_def_struct_sdna(srna, "bNodeSocket");
2513 RNA_def_struct_ui_icon(srna, ICON_PLUG);
2514 RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
2516 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2517 /* XXX must be editable for group sockets. if necessary use a special rna definition for these */
2518 // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2519 RNA_def_property_ui_text(prop, "Name", "Socket name");
2520 RNA_def_struct_name_property(srna, prop);
2521 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroupSocket_update");
2523 /* can add back if there is any use in reading them */
2525 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
2526 RNA_def_property_float_sdna(prop, NULL, "ns.min");
2527 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2528 RNA_def_property_ui_text(prop, "Minimum Value", "");
2529 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update");
2531 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
2532 RNA_def_property_float_sdna(prop, NULL, "ns.max");
2533 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2534 RNA_def_property_ui_text(prop, "Maximum Value", "");
2535 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update");
2538 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2539 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2540 RNA_def_property_enum_items(prop, node_socket_type_items);
2541 RNA_def_property_ui_text(prop, "Type", "Node Socket type");
2544 static void rna_def_node_socket_value(BlenderRNA *brna)
2549 srna = RNA_def_struct(brna, "ValueNodeSocket", "NodeSocket");
2550 RNA_def_struct_ui_text(srna, "Value Node Socket", "Input or output socket of a node");
2551 RNA_def_struct_sdna(srna, "bNodeSocket");
2552 RNA_def_struct_ui_icon(srna, ICON_PLUG);
2553 RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
2555 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
2556 RNA_def_property_float_sdna(prop, NULL, "ns.vec");
2557 RNA_def_property_array(prop, 1);
2558 RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached");
2559 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update");
2560 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range");
2563 static void rna_def_node_socket_vector(BlenderRNA *brna)
2568 srna = RNA_def_struct(brna, "VectorNodeSocket", "NodeSocket");
2569 RNA_def_struct_ui_text(srna, "Vector Node Socket", "Input or output socket of a node");
2570 RNA_def_struct_sdna(srna, "bNodeSocket");
2571 RNA_def_struct_ui_icon(srna, ICON_PLUG);
2572 RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
2574 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_XYZ);
2575 RNA_def_property_float_sdna(prop, NULL, "ns.vec");
2576 RNA_def_property_array(prop, 3);
2577 RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached");
2578 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update");
2579 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range");
2582 static void rna_def_node_socket_rgba(BlenderRNA *brna)
2587 srna = RNA_def_struct(brna, "RGBANodeSocket", "NodeSocket");
2588 RNA_def_struct_ui_text(srna, "RGBA Node Socket", "Input or output socket of a node");
2589 RNA_def_struct_sdna(srna, "bNodeSocket");
2590 RNA_def_struct_ui_icon(srna, ICON_PLUG);
2591 RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
2593 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
2594 RNA_def_property_float_sdna(prop, NULL, "ns.vec");
2595 RNA_def_property_array(prop, 4);
2596 RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached");
2597 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update");
2598 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range");
2601 static void rna_def_node(BlenderRNA *brna)
2606 srna = RNA_def_struct(brna, "Node", NULL);
2607 RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
2608 RNA_def_struct_sdna(srna, "bNode");
2609 RNA_def_struct_ui_icon(srna, ICON_NODE);
2610 RNA_def_struct_refine_func(srna, "rna_Node_refine");
2611 RNA_def_struct_path_func(srna, "rna_Node_path");
2613 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
2614 RNA_def_property_float_sdna(prop, NULL, "locx");
2615 RNA_def_property_array(prop, 2);
2616 RNA_def_property_range(prop, -10000.0f, 10000.0f);
2617 RNA_def_property_ui_text(prop, "Location", "");
2618 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
2620 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2621 RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
2622 RNA_def_struct_name_property(srna, prop);
2623 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set");
2624 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
2626 prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
2627 RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
2628 RNA_def_property_struct_type(prop, "NodeSocket");
2629 RNA_def_property_ui_text(prop, "Inputs", "");
2631 prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
2632 RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
2633 RNA_def_property_struct_type(prop, "NodeSocket");
2634 RNA_def_property_ui_text(prop, "Outputs", "");
2636 prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
2637 RNA_def_property_string_sdna(prop, NULL, "label");
2638 RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
2639 RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
2642 static void rna_def_node_link(BlenderRNA *brna)
2647 srna = RNA_def_struct(brna, "NodeLink", NULL);
2648 RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
2649 RNA_def_struct_sdna(srna, "bNodeLink");
2650 RNA_def_struct_ui_icon(srna, ICON_NODE);
2652 prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
2653 RNA_def_property_pointer_sdna(prop, NULL, "fromnode");
2654 RNA_def_property_struct_type(prop, "Node");
2655 RNA_def_property_ui_text(prop, "From node", "");
2657 prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
2658 RNA_def_property_pointer_sdna(prop, NULL, "tonode");
2659 RNA_def_property_struct_type(prop, "Node");
2660 RNA_def_property_ui_text(prop, "To node", "");
2662 prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
2663 RNA_def_property_pointer_sdna(prop, NULL, "fromsock");
2664 RNA_def_property_struct_type(prop, "NodeSocket");
2665 RNA_def_property_ui_text(prop, "From socket", "");
2667 prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
2668 RNA_def_property_pointer_sdna(prop, NULL, "tosock");
2669 RNA_def_property_struct_type(prop, "NodeSocket");
2670 RNA_def_property_ui_text(prop, "To socket", "");
2673 static void rna_def_group_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
2679 RNA_def_property_srna(cprop, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"));
2680 srna= RNA_def_struct(brna, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"), NULL);
2681 RNA_def_struct_sdna(srna, "bNodeTree");
2682 RNA_def_struct_ui_text(srna, "Group Sockets", "Collection of group sockets");
2684 func= RNA_def_function(srna, "new", (in_out==SOCK_IN ? "rna_NodeTree_input_new" : "rna_NodeTree_output_new"));
2685 RNA_def_function_ui_description(func, "Add a socket to the group tree.");
2686 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2687 RNA_def_string(func, "name", "Socket", 32, "Name", "Name of the socket");
2688 RNA_def_enum(func, "type", node_socket_type_items, SOCK_VALUE, "Type", "Type of socket");
2690 parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket.");
2691 RNA_def_function_return(func, parm);
2693 func= RNA_def_function(srna, "expose", (in_out==SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose"));
2694 RNA_def_function_ui_description(func, "Expose an internal socket in the group tree.");
2695 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2696 RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "Internal node socket to expose");
2697 RNA_def_property_flag(parm, PROP_REQUIRED);
2698 RNA_def_boolean(func, "add_link", TRUE, "Add Link", "If TRUE, adds a link to the internal socket");
2700 parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket.");
2701 RNA_def_function_return(func, parm);
2704 static void rna_def_nodetree(BlenderRNA *brna)
2709 static EnumPropertyItem nodetree_type_items[] = {
2710 {NTREE_SHADER, "SHADER", 0, "Shader", ""},
2711 {NTREE_COMPOSIT, "COMPOSITE", 0, "Composite", ""},
2712 {NTREE_TEXTURE, "TEXTURE", 0, "Texture", ""},
2713 {0, NULL, 0, NULL, NULL}};
2715 srna = RNA_def_struct(brna, "NodeTree", "ID");
2716 RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for materials, textures and compositing");
2717 RNA_def_struct_sdna(srna, "bNodeTree");
2718 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
2719 RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
2722 rna_def_animdata_common(srna);
2724 /* NodeLinks Collection */
2725 prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
2726 RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
2727 RNA_def_property_struct_type(prop, "NodeLink");
2728 RNA_def_property_ui_text(prop, "Links", "");
2729 rna_def_nodetree_link_api(brna, prop);
2732 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
2733 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
2734 RNA_def_property_flag(prop, PROP_EDITABLE);
2735 RNA_def_property_struct_type(prop, "GreasePencil");
2736 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
2738 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2739 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2740 RNA_def_property_enum_items(prop, nodetree_type_items);
2741 RNA_def_property_ui_text(prop, "Type", "Node Tree type");
2744 prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
2745 RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
2746 RNA_def_property_struct_type(prop, "NodeSocket");
2747 RNA_def_property_ui_text(prop, "Inputs", "");
2748 rna_def_group_sockets_api(brna, prop, SOCK_IN);
2750 prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
2751 RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
2752 RNA_def_property_struct_type(prop, "NodeSocket");
2753 RNA_def_property_ui_text(prop, "Outputs", "");
2754 rna_def_group_sockets_api(brna, prop, SOCK_OUT);
2757 static void rna_def_composite_nodetree(BlenderRNA *brna)
2762 srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
2763 RNA_def_struct_ui_text(srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
2764 RNA_def_struct_sdna(srna, "bNodeTree");
2765 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
2767 /* Nodes Collection */
2768 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
2769 RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
2770 RNA_def_property_struct_type(prop, "Node");
2771 RNA_def_property_ui_text(prop, "Nodes", "");
2773 rna_def_composite_nodetree_api(brna, prop);
2776 static void rna_def_shader_nodetree(BlenderRNA *brna)
2781 srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
2782 RNA_def_struct_ui_text(srna, "Shader Node Tree", "Node tree consisting of linked nodes used for materials");
2783 RNA_def_struct_sdna(srna, "bNodeTree");
2784 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
2786 /* Nodes Collection */
2787 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
2788 RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
2789 RNA_def_property_struct_type(prop, "Node");
2790 RNA_def_property_ui_text(prop, "Nodes", "");
2792 rna_def_shader_nodetree_api(brna, prop);
2795 static void rna_def_texture_nodetree(BlenderRNA *brna)
2800 srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
2801 RNA_def_struct_ui_text(srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
2802 RNA_def_struct_sdna(srna, "bNodeTree");
2803 RNA_def_struct_ui_icon(srna, ICON_NODETREE);
2805 /* Nodes Collection */
2806 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
2807 RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
2808 RNA_def_property_struct_type(prop, "Node");
2809 RNA_def_property_ui_text(prop, "Nodes", "");
2811 rna_def_texture_nodetree_api(brna, prop);
2814 static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRNA*))
2816 StructRNA *srna = def_node(brna, id);
2822 void RNA_def_nodetree(BlenderRNA *brna)
2825 rna_def_nodetree(brna);
2826 rna_def_node_socket(brna);
2827 rna_def_node_socket_value(brna);
2828 rna_def_node_socket_vector(brna);
2829 rna_def_node_socket_rgba(brna);
2831 rna_def_node_link(brna);
2832 rna_def_shader_node(brna);
2833 rna_def_compositor_node(brna);
2834 rna_def_texture_node(brna);
2835 rna_def_composite_nodetree(brna);
2836 rna_def_shader_nodetree(brna);
2837 rna_def_texture_nodetree(brna);
2838 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
2839 define_specific_node(brna, ID, DefFunc);
2841 #include "rna_nodetree_types.h"
2845 define_specific_node(brna, NODE_GROUP, def_group);