|
Blender
V2.59
|
00001 /* 00002 * $Id: rna_nodetree.c 37331 2011-06-09 11:09:46Z broken $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * Contributor(s): Blender Foundation (2008), Nathan Letwory, Robin Allen, Bob Holcomb 00021 * 00022 * ***** END GPL LICENSE BLOCK ***** 00023 */ 00024 00030 #include <stdlib.h> 00031 #include <string.h> 00032 00033 #include "RNA_define.h" 00034 #include "RNA_enum_types.h" 00035 00036 #include "rna_internal.h" 00037 00038 #include "DNA_material_types.h" 00039 #include "DNA_node_types.h" 00040 #include "DNA_scene_types.h" 00041 #include "DNA_texture_types.h" 00042 00043 #include "BKE_animsys.h" 00044 #include "BKE_main.h" 00045 #include "BKE_node.h" 00046 #include "BKE_image.h" 00047 #include "BKE_texture.h" 00048 00049 #include "BLI_math.h" 00050 #include "BLI_utildefines.h" 00051 00052 #include "WM_types.h" 00053 00054 #include "MEM_guardedalloc.h" 00055 00056 00057 EnumPropertyItem node_socket_type_items[] = { 00058 {SOCK_VALUE, "VALUE", 0, "Value", ""}, 00059 {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, 00060 {SOCK_RGBA, "RGBA", 0, "RGBA", ""}, 00061 {0, NULL, 0, NULL, NULL}}; 00062 00063 EnumPropertyItem node_math_items[] = { 00064 { 0, "ADD", 0, "Add", ""}, 00065 { 1, "SUBTRACT", 0, "Subtract", ""}, 00066 { 2, "MULTIPLY", 0, "Multiply", ""}, 00067 { 3, "DIVIDE", 0, "Divide", ""}, 00068 { 4, "SINE", 0, "Sine", ""}, 00069 { 5, "COSINE", 0, "Cosine", ""}, 00070 { 6, "TANGENT", 0, "Tangent", ""}, 00071 { 7, "ARCSINE", 0, "Arcsine", ""}, 00072 { 8, "ARCCOSINE", 0, "Arccosine", ""}, 00073 { 9, "ARCTANGENT", 0, "Arctangent", ""}, 00074 {10, "POWER", 0, "Power", ""}, 00075 {11, "LOGARITHM", 0, "Logarithm", ""}, 00076 {12, "MINIMUM", 0, "Minimum", ""}, 00077 {13, "MAXIMUM", 0, "Maximum", ""}, 00078 {14, "ROUND", 0, "Round", ""}, 00079 {15, "LESS_THAN", 0, "Less Than", ""}, 00080 {16, "GREATER_THAN", 0, "Greater Than", ""}, 00081 {0, NULL, 0, NULL, NULL}}; 00082 00083 EnumPropertyItem node_vec_math_items[] = { 00084 {0, "ADD", 0, "Add", ""}, 00085 {1, "SUBTRACT", 0, "Subtract", ""}, 00086 {2, "AVERAGE", 0, "Average", ""}, 00087 {3, "DOT_PRODUCT", 0, "Dot Product", ""}, 00088 {4, "CROSS_PRODUCT", 0, "Cross Product", ""}, 00089 {5, "NORMALIZE", 0, "Normalize", ""}, 00090 {0, NULL, 0, NULL, NULL}}; 00091 00092 EnumPropertyItem node_filter_items[] = { 00093 {0, "SOFTEN", 0, "Soften", ""}, 00094 {1, "SHARPEN", 0, "Sharpen", ""}, 00095 {2, "LAPLACE", 0, "Laplace", ""}, 00096 {3, "SOBEL", 0, "Sobel", ""}, 00097 {4, "PREWITT", 0, "Prewitt", ""}, 00098 {5, "KIRSCH", 0, "Kirsch", ""}, 00099 {6, "SHADOW", 0, "Shadow", ""}, 00100 {0, NULL, 0, NULL, NULL}}; 00101 00102 #ifdef RNA_RUNTIME 00103 00104 #include "BLI_linklist.h" 00105 00106 #include "ED_node.h" 00107 00108 #include "RE_pipeline.h" 00109 00110 #include "DNA_scene_types.h" 00111 #include "WM_api.h" 00112 00113 static StructRNA *rna_Node_refine(struct PointerRNA *ptr) 00114 { 00115 bNode *node = (bNode*)ptr->data; 00116 00117 switch(node->type) { 00118 00119 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ 00120 case ID: return &RNA_##Category##StructName; 00121 00122 #include "rna_nodetree_types.h" 00123 00124 #undef DefNode 00125 00126 case NODE_GROUP: 00127 return &RNA_NodeGroup; 00128 00129 default: 00130 return &RNA_Node; 00131 } 00132 } 00133 00134 static StructRNA *rna_NodeSocketType_refine(struct PointerRNA *ptr) 00135 { 00136 bNodeSocket *ns= (bNodeSocket*)ptr->data; 00137 00138 switch(ns->type) { 00139 case SOCK_VALUE: 00140 return &RNA_ValueNodeSocket; 00141 case SOCK_VECTOR: 00142 return &RNA_VectorNodeSocket; 00143 case SOCK_RGBA: 00144 return &RNA_RGBANodeSocket; 00145 default: 00146 return &RNA_UnknownType; 00147 } 00148 } 00149 00150 static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr) 00151 { 00152 bNodeTree *ntree= (bNodeTree*)ptr->data; 00153 00154 switch(ntree->type) { 00155 case NTREE_SHADER: 00156 return &RNA_ShaderNodeTree; 00157 case NTREE_COMPOSIT: 00158 return &RNA_CompositorNodeTree; 00159 case NTREE_TEXTURE: 00160 return &RNA_TextureNodeTree; 00161 default: 00162 return &RNA_UnknownType; 00163 } 00164 } 00165 00166 static char *rna_Node_path(PointerRNA *ptr) 00167 { 00168 bNode *node= (bNode*)ptr->data; 00169 00170 return BLI_sprintfN("nodes[\"%s\"]", node->name); 00171 } 00172 00173 static char *rna_NodeSocket_path(PointerRNA *ptr) 00174 { 00175 bNodeTree *ntree= (bNodeTree*)ptr->id.data; 00176 bNodeSocket *sock= (bNodeSocket*)ptr->data; 00177 bNode *node; 00178 int socketindex; 00179 00180 /* group sockets */ 00181 socketindex = BLI_findindex(&ntree->inputs, sock); 00182 if (socketindex != -1) 00183 return BLI_sprintfN("inputs[%d]", socketindex); 00184 00185 socketindex = BLI_findindex(&ntree->outputs, sock); 00186 if (socketindex != -1) 00187 return BLI_sprintfN("outputs[%d]", socketindex); 00188 00189 /* node sockets */ 00190 if (!nodeFindNode(ntree, sock, &node, NULL, NULL)) return NULL; 00191 00192 socketindex = BLI_findindex(&node->inputs, sock); 00193 if (socketindex != -1) 00194 return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", node->name, socketindex); 00195 00196 socketindex = BLI_findindex(&node->outputs, sock); 00197 if (socketindex != -1) 00198 return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", node->name, socketindex); 00199 00200 return NULL; 00201 } 00202 00203 /* Button Set Funcs for Matte Nodes */ 00204 static void rna_Matte_t1_set(PointerRNA *ptr, float value) 00205 { 00206 bNode *node= (bNode*)ptr->data; 00207 NodeChroma *chroma = node->storage; 00208 00209 chroma->t1 = value; 00210 00211 if(value < chroma->t2) 00212 chroma->t2 = value; 00213 } 00214 00215 static void rna_Matte_t2_set(PointerRNA *ptr, float value) 00216 { 00217 bNode *node= (bNode*)ptr->data; 00218 NodeChroma *chroma = node->storage; 00219 00220 if(value > chroma->t1) 00221 value = chroma->t1; 00222 00223 chroma->t2 = value; 00224 } 00225 00226 static void rna_Image_start_frame_set(PointerRNA *ptr, int value) 00227 { 00228 bNode *node= (bNode*)ptr->data; 00229 NodeImageFile *image = node->storage; 00230 00231 CLAMP(value, MINFRAME, image->efra); 00232 image->sfra= value; 00233 } 00234 00235 static void rna_Image_end_frame_set(PointerRNA *ptr, int value) 00236 { 00237 bNode *node= (bNode*)ptr->data; 00238 NodeImageFile *image = node->storage; 00239 00240 CLAMP(value, image->sfra, MAXFRAME); 00241 image->efra= value; 00242 } 00243 00244 static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value) 00245 { 00246 bNode *node= (bNode*)ptr->data; 00247 00248 if (node->id) { 00249 id_us_min(node->id); 00250 node->id= NULL; 00251 } 00252 00253 node->id= value.data; 00254 00255 id_us_plus(node->id); 00256 } 00257 00258 00259 00260 static void node_update(Main *bmain, Scene *UNUSED(scene), bNodeTree *ntree, bNode *node) 00261 { 00262 ED_node_generic_update(bmain, ntree, node); 00263 } 00264 00265 static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) 00266 { 00267 bNodeTree *ntree= (bNodeTree*)ptr->id.data; 00268 bNode *node= (bNode*)ptr->data; 00269 00270 node_update(bmain, scene, ntree, node); 00271 } 00272 00273 static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr) 00274 { 00275 bNodeTree *ntree= (bNodeTree*)ptr->id.data; 00276 bNode *node= (bNode*)ptr->data; 00277 00278 nodeGroupVerify((bNodeTree *)node->id); 00279 00280 node_update(bmain, scene, ntree, node); 00281 } 00282 00283 static void rna_Node_name_set(PointerRNA *ptr, const char *value) 00284 { 00285 bNodeTree *ntree= (bNodeTree*)ptr->id.data; 00286 bNode *node= (bNode*)ptr->data; 00287 char oldname[sizeof(node->name)]; 00288 00289 /* make a copy of the old name first */ 00290 BLI_strncpy(oldname, node->name, sizeof(node->name)); 00291 /* set new name */ 00292 BLI_strncpy(node->name, value, sizeof(node->name)); 00293 00294 nodeUniqueName(ntree, node); 00295 00296 /* fix all the animation data which may link to this */ 00297 BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name); 00298 } 00299 00300 static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr) 00301 { 00302 bNodeTree *ntree= (bNodeTree*)ptr->id.data; 00303 bNodeSocket *sock= (bNodeSocket*)ptr->data; 00304 bNode *node; 00305 00306 if (nodeFindNode(ntree, sock, &node, NULL, NULL)) 00307 node_update(bmain, scene, ntree, node); 00308 } 00309 00310 static void rna_NodeGroupSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr) 00311 { 00312 bNodeTree *ntree= (bNodeTree*)ptr->id.data; 00313 bNodeSocket *sock= (bNodeSocket*)ptr->data; 00314 bNode *node; 00315 00316 nodeGroupVerify(ntree); 00317 00318 if (nodeFindNode(ntree, sock, &node, NULL, NULL)) 00319 node_update(bmain, scene, ntree, node); 00320 } 00321 00322 static void rna_NodeSocket_defvalue_range(PointerRNA *ptr, float *min, float *max) 00323 { 00324 bNodeSocket *sock= (bNodeSocket*)ptr->data; 00325 00326 *min = sock->ns.min; 00327 *max = sock->ns.max; 00328 } 00329 00330 static void rna_Node_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr) 00331 { 00332 bNode *node= (bNode*)ptr->data; 00333 00334 init_mapping((TexMapping *)node->storage); 00335 00336 rna_Node_update(bmain, scene, ptr); 00337 } 00338 00339 static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) 00340 { 00341 bNode *node= (bNode*)ptr->data; 00342 Image *ima = (Image *)node->id; 00343 ImageUser *iuser= node->storage; 00344 00345 BKE_image_multilayer_index(ima->rr, iuser); 00346 BKE_image_signal(ima, iuser, IMA_SIGNAL_SRC_CHANGE); 00347 00348 rna_Node_update(bmain, scene, ptr); 00349 } 00350 00351 static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) 00352 { 00353 EnumPropertyItem *item= NULL; 00354 EnumPropertyItem tmp = {0, "", 0, "", ""}; 00355 int i=0, totitem=0; 00356 00357 while (rl) { 00358 tmp.identifier = rl->name; 00359 tmp.name= rl->name; 00360 tmp.value = i++; 00361 RNA_enum_item_add(&item, &totitem, &tmp); 00362 rl=rl->next; 00363 } 00364 00365 RNA_enum_item_end(&item, &totitem); 00366 00367 return item; 00368 } 00369 00370 static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) 00371 { 00372 bNode *node= (bNode*)ptr->data; 00373 Image *ima = (Image *)node->id; 00374 EnumPropertyItem *item= NULL; 00375 RenderLayer *rl; 00376 00377 if (!ima || !(ima->rr)) return NULL; 00378 00379 rl = ima->rr->layers.first; 00380 item = renderresult_layers_add_enum(rl); 00381 00382 *free= 1; 00383 00384 return item; 00385 } 00386 00387 static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) 00388 { 00389 bNode *node= (bNode*)ptr->data; 00390 Scene *sce = (Scene *)node->id; 00391 EnumPropertyItem *item= NULL; 00392 RenderLayer *rl; 00393 00394 if (!sce) return NULL; 00395 00396 rl = sce->r.layers.first; 00397 item = renderresult_layers_add_enum(rl); 00398 00399 *free= 1; 00400 00401 return item; 00402 } 00403 00404 static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) 00405 { 00406 bNode *node= (bNode*)ptr->data; 00407 EnumPropertyItem *item= NULL; 00408 EnumPropertyItem tmp = {0, "", 0, "", ""}; 00409 int totitem=0; 00410 00411 switch(node->custom1) { 00412 case CMP_NODE_CHANNEL_MATTE_CS_RGB: 00413 tmp.identifier= "R"; tmp.name= "R"; tmp.value= 1; 00414 RNA_enum_item_add(&item, &totitem, &tmp); 00415 tmp.identifier= "G"; tmp.name= "G"; tmp.value= 2; 00416 RNA_enum_item_add(&item, &totitem, &tmp); 00417 tmp.identifier= "B"; tmp.name= "B"; tmp.value= 3; 00418 RNA_enum_item_add(&item, &totitem, &tmp); 00419 break; 00420 case CMP_NODE_CHANNEL_MATTE_CS_HSV: 00421 tmp.identifier= "H"; tmp.name= "H"; tmp.value= 1; 00422 RNA_enum_item_add(&item, &totitem, &tmp); 00423 tmp.identifier= "S"; tmp.name= "S"; tmp.value= 2; 00424 RNA_enum_item_add(&item, &totitem, &tmp); 00425 tmp.identifier= "V"; tmp.name= "V"; tmp.value= 3; 00426 RNA_enum_item_add(&item, &totitem, &tmp); 00427 break; 00428 case CMP_NODE_CHANNEL_MATTE_CS_YUV: 00429 tmp.identifier= "Y"; tmp.name= "Y"; tmp.value= 1; 00430 RNA_enum_item_add(&item, &totitem, &tmp); 00431 tmp.identifier= "G"; tmp.name= "U"; tmp.value= 2; 00432 RNA_enum_item_add(&item, &totitem, &tmp); 00433 tmp.identifier= "V"; tmp.name= "V"; tmp.value= 3; 00434 RNA_enum_item_add(&item, &totitem, &tmp); 00435 break; 00436 case CMP_NODE_CHANNEL_MATTE_CS_YCC: 00437 tmp.identifier= "Y"; tmp.name= "Y"; tmp.value= 1; 00438 RNA_enum_item_add(&item, &totitem, &tmp); 00439 tmp.identifier= "CB"; tmp.name= "Cr"; tmp.value= 2; 00440 RNA_enum_item_add(&item, &totitem, &tmp); 00441 tmp.identifier= "CR"; tmp.name= "Cb"; tmp.value= 3; 00442 RNA_enum_item_add(&item, &totitem, &tmp); 00443 break; 00444 default: 00445 break; 00446 } 00447 00448 RNA_enum_item_end(&item, &totitem); 00449 *free= 1; 00450 00451 return item; 00452 } 00453 00454 static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), ReportList *reports, int type, bNodeTree *group) 00455 { 00456 bNode *node; 00457 00458 if (type == NODE_GROUP && group == NULL) { 00459 BKE_reportf(reports, RPT_ERROR, "node type \'GROUP\' missing group argument"); 00460 return NULL; 00461 } 00462 node = nodeAddNodeType(ntree, type, group, NULL); 00463 00464 if (node == NULL) { 00465 BKE_reportf(reports, RPT_ERROR, "Unable to create node"); 00466 } 00467 else { 00468 nodeGroupVerify(ntree); /* update group node socket links*/ 00469 NodeTagChanged(ntree, node); 00470 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00471 00472 if (group) 00473 id_us_plus(&group->id); 00474 } 00475 00476 return node; 00477 } 00478 00479 static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group) 00480 { 00481 /* raises error on failier */ 00482 bNode *node= rna_NodeTree_node_new(ntree, C, reports, type, group); 00483 00484 if (node) { 00485 if(ELEM4(node->type, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE, CMP_NODE_R_LAYERS)) { 00486 /* annoying, find the node tree we are in, scene can be NULL */ 00487 Scene *scene; 00488 for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next) { 00489 if(scene->nodetree == ntree) { 00490 break; 00491 } 00492 } 00493 node->id= (ID *)scene; 00494 id_us_plus(node->id); 00495 } 00496 00497 ntreeCompositForceHidden(ntree, CTX_data_scene(C)); 00498 ntreeSolveOrder(ntree); 00499 } 00500 00501 return node; 00502 } 00503 00504 static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group) 00505 { 00506 /* raises error on failier */ 00507 bNode *node= rna_NodeTree_node_new(ntree, C, reports, type, group); 00508 00509 if (node) { 00510 ntreeTexCheckCyclics(ntree); 00511 } 00512 00513 return node; 00514 } 00515 00516 static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, bNode *node) 00517 { 00518 if (BLI_findindex(&ntree->nodes, node) == -1) { 00519 BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in nodetree", node->name); 00520 } 00521 else { 00522 if (node->id) 00523 id_us_min(node->id); 00524 00525 nodeFreeNode(ntree, node); 00526 nodeGroupVerify(ntree); /* update group node socket links*/ 00527 00528 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00529 } 00530 } 00531 00532 static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, bNodeSocket *in, bNodeSocket *out) 00533 { 00534 bNodeLink *ret; 00535 bNode *fromnode= NULL, *tonode= NULL; 00536 int from_in_out, to_in_out; 00537 00538 nodeFindNode(ntree, in, &fromnode, NULL, &from_in_out); 00539 nodeFindNode(ntree, out, &tonode, NULL, &to_in_out); 00540 00541 if (&from_in_out == &to_in_out) { 00542 BKE_reportf(reports, RPT_ERROR, "Same input/output direction of sockets"); 00543 return NULL; 00544 } 00545 00546 /* unlink node input socket */ 00547 nodeRemSocketLinks(ntree, out); 00548 00549 ret= nodeAddLink(ntree, fromnode, in, tonode, out); 00550 00551 if(ret) { 00552 NodeTagChanged(ntree, tonode); 00553 00554 nodeGroupVerify(ntree); /* update group node socket links*/ 00555 00556 ntreeSolveOrder(ntree); 00557 00558 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00559 } 00560 return ret; 00561 } 00562 00563 static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, bNodeLink *link) 00564 { 00565 if (BLI_findindex(&ntree->links, link) == -1) { 00566 BKE_reportf(reports, RPT_ERROR, "Unable to locate link in nodetree"); 00567 } 00568 else { 00569 nodeRemLink(ntree, link); 00570 ntreeSolveOrder(ntree); 00571 nodeGroupVerify(ntree); /* update group node socket links*/ 00572 00573 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00574 } 00575 } 00576 00577 static bNodeSocket *rna_NodeTree_input_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type) 00578 { 00579 /* XXX should check if tree is a group here! no good way to do this currently. */ 00580 bNodeSocket *gsock= nodeGroupAddSocket(ntree, name, type, SOCK_IN); 00581 00582 nodeGroupVerify(ntree); /* update group node socket links*/ 00583 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00584 return gsock; 00585 } 00586 00587 static bNodeSocket *rna_NodeTree_output_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type) 00588 { 00589 /* XXX should check if tree is a group here! no good way to do this currently. */ 00590 bNodeSocket *gsock= nodeGroupAddSocket(ntree, name, type, SOCK_OUT); 00591 00592 nodeGroupVerify(ntree); /* update group node socket links*/ 00593 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00594 return gsock; 00595 } 00596 00597 static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock, int add_link) 00598 { 00599 bNode *node; 00600 bNodeSocket *gsock; 00601 int index, in_out; 00602 00603 if (!nodeFindNode(ntree, sock, &node, &index, &in_out)) 00604 BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree"); 00605 else if (in_out!=SOCK_IN) 00606 BKE_reportf(reports, RPT_ERROR, "Socket is not an input"); 00607 else { 00608 /* XXX should check if tree is a group here! no good way to do this currently. */ 00609 gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_IN); 00610 if (add_link) 00611 nodeAddLink(ntree, NULL, gsock, node, sock); 00612 00613 nodeGroupVerify(ntree); /* update group node socket links*/ 00614 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00615 return gsock; 00616 } 00617 return NULL; 00618 } 00619 00620 static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock, int add_link) 00621 { 00622 bNode *node; 00623 bNodeSocket *gsock; 00624 int index, in_out; 00625 00626 if (!nodeFindNode(ntree, sock, &node, &index, &in_out)) 00627 BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree"); 00628 else if (in_out!=SOCK_OUT) 00629 BKE_reportf(reports, RPT_ERROR, "Socket is not an output"); 00630 else { 00631 /* XXX should check if tree is a group here! no good way to do this currently. */ 00632 gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_OUT); 00633 if (add_link) 00634 nodeAddLink(ntree, node, sock, NULL, gsock); 00635 00636 nodeGroupVerify(ntree); /* update group node socket links*/ 00637 WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); 00638 return gsock; 00639 } 00640 return NULL; 00641 } 00642 00643 #else 00644 00645 static EnumPropertyItem prop_image_layer_items[] = { 00646 { 0, "PLACEHOLDER", 0, "Placeholder", ""}, 00647 {0, NULL, 0, NULL, NULL}}; 00648 00649 static EnumPropertyItem prop_scene_layer_items[] = { 00650 { 0, "PLACEHOLDER", 0, "Placeholder", ""}, 00651 {0, NULL, 0, NULL, NULL}}; 00652 00653 static EnumPropertyItem prop_tri_channel_items[] = { 00654 { 1, "R", 0, "R", ""}, 00655 { 2, "G", 0, "G", ""}, 00656 { 3, "B", 0, "B", ""}, 00657 {0, NULL, 0, NULL, NULL}}; 00658 00659 static EnumPropertyItem node_flip_items[] = { 00660 {0, "X", 0, "Flip X", ""}, 00661 {1, "Y", 0, "Flip Y", ""}, 00662 {2, "XY", 0, "Flip X & Y", ""}, 00663 {0, NULL, 0, NULL, NULL}}; 00664 00665 static EnumPropertyItem node_ycc_items[] = { 00666 { 0, "ITUBT601", 0, "ITU 601", ""}, 00667 { 1, "ITUBT709", 0, "ITU 709", ""}, 00668 { 2, "JFIF", 0, "Jpeg", ""}, 00669 {0, NULL, 0, NULL, NULL}}; 00670 00671 #define MaxNodes 1000 00672 00673 enum 00674 { 00675 Category_GroupNode, 00676 Category_ShaderNode, 00677 Category_CompositorNode, 00678 Category_TextureNode 00679 }; 00680 00681 typedef struct NodeInfo 00682 { 00683 int defined; 00684 int category; 00685 const char *enum_name; 00686 const char *struct_name; 00687 const char *base_name; 00688 int icon; 00689 const char *ui_name; 00690 const char *ui_desc; 00691 } NodeInfo; 00692 00693 static NodeInfo nodes[MaxNodes]; 00694 00695 static void reg_node(int ID, int category, const char *enum_name, const char *struct_name, 00696 const char *base_name, const char *ui_name, const char *ui_desc) 00697 { 00698 NodeInfo *ni = nodes + ID; 00699 00700 ni->defined = 1; 00701 ni->category = category; 00702 ni->enum_name = enum_name; 00703 ni->struct_name = struct_name; 00704 ni->base_name = base_name; 00705 ni->ui_name = ui_name; 00706 ni->ui_desc = ui_desc; 00707 } 00708 00709 static void init(void) 00710 { 00711 memset(nodes, 0, sizeof nodes); 00712 00713 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ 00714 reg_node(ID, Category_##Category, EnumName, STRINGIFY_ARG(Category##StructName), #Category, UIName, UIDesc); 00715 00716 #include "rna_nodetree_types.h" 00717 00718 #undef DefNode 00719 00720 reg_node(NODE_GROUP, Category_GroupNode, "GROUP", "NodeGroup", "Node", "Group", ""); 00721 } 00722 00723 static StructRNA* def_node(BlenderRNA *brna, int node_id) 00724 { 00725 StructRNA *srna; 00726 NodeInfo *node = nodes + node_id; 00727 00728 srna = RNA_def_struct(brna, node->struct_name, node->base_name); 00729 RNA_def_struct_ui_text(srna, node->ui_name, node->ui_desc); 00730 RNA_def_struct_sdna(srna, "bNode"); 00731 00732 return srna; 00733 } 00734 00735 void alloc_node_type_items(EnumPropertyItem *items, int category) 00736 { 00737 int i; 00738 int count = 3; 00739 EnumPropertyItem *item = items; 00740 00741 for(i=0; i<MaxNodes; i++) 00742 if(nodes[i].defined && nodes[i].category == category) 00743 count++; 00744 00745 /*item = items = MEM_callocN(count * sizeof(EnumPropertyItem), "alloc_node_type_items");*/ 00746 00747 for(i=0; i<MaxNodes; i++) { 00748 NodeInfo *node = nodes + i; 00749 if(node->defined && node->category == category) { 00750 item->value = i; 00751 item->identifier = node->enum_name; 00752 item->icon = node->icon; 00753 item->name = node->ui_name; 00754 item->description = node->ui_desc; 00755 00756 item++; 00757 } 00758 } 00759 00760 item->value = NODE_DYNAMIC; 00761 item->identifier = "SCRIPT"; 00762 item->icon = 0; 00763 item->name = "Script"; 00764 item->description = ""; 00765 00766 item++; 00767 00768 item->value = NODE_GROUP; 00769 item->identifier = "GROUP"; 00770 item->icon = 0; 00771 item->name = "Group"; 00772 item->description = ""; 00773 00774 item++; 00775 00776 /* NOTE!, increase 'count' when adding items here */ 00777 00778 memset(item, 0, sizeof(EnumPropertyItem)); 00779 } 00780 00781 00782 /* -- Common nodes ---------------------------------------------------------- */ 00783 00784 static void def_group(StructRNA *srna) 00785 { 00786 PropertyRNA *prop; 00787 00788 prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); 00789 RNA_def_property_pointer_sdna(prop, NULL, "id"); 00790 RNA_def_property_struct_type(prop, "NodeTree"); 00791 RNA_def_property_flag(prop, PROP_EDITABLE); 00792 RNA_def_property_ui_text(prop, "Node Tree", ""); 00793 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroup_update"); 00794 } 00795 00796 00797 static void def_math(StructRNA *srna) 00798 { 00799 PropertyRNA *prop; 00800 00801 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); 00802 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 00803 RNA_def_property_enum_items(prop, node_math_items); 00804 RNA_def_property_ui_text(prop, "Operation", ""); 00805 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00806 } 00807 00808 static void def_vector_math(StructRNA *srna) 00809 { 00810 PropertyRNA *prop; 00811 00812 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); 00813 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 00814 RNA_def_property_enum_items(prop, node_vec_math_items); 00815 RNA_def_property_ui_text(prop, "Operation", ""); 00816 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00817 } 00818 00819 static void def_rgb_curve(StructRNA *srna) 00820 { 00821 PropertyRNA *prop; 00822 00823 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); 00824 RNA_def_property_pointer_sdna(prop, NULL, "storage"); 00825 RNA_def_property_struct_type(prop, "CurveMapping"); 00826 RNA_def_property_ui_text(prop, "Mapping", ""); 00827 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00828 } 00829 00830 static void def_vector_curve(StructRNA *srna) 00831 { 00832 PropertyRNA *prop; 00833 00834 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); 00835 RNA_def_property_pointer_sdna(prop, NULL, "storage"); 00836 RNA_def_property_struct_type(prop, "CurveMapping"); 00837 RNA_def_property_ui_text(prop, "Mapping", ""); 00838 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00839 } 00840 00841 static void def_time(StructRNA *srna) 00842 { 00843 PropertyRNA *prop; 00844 00845 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); 00846 RNA_def_property_pointer_sdna(prop, NULL, "storage"); 00847 RNA_def_property_struct_type(prop, "CurveMapping"); 00848 RNA_def_property_ui_text(prop, "Curve", ""); 00849 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00850 00851 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); 00852 RNA_def_property_int_sdna(prop, NULL, "custom1"); 00853 RNA_def_property_ui_text(prop, "Start Frame", ""); 00854 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00855 00856 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); 00857 RNA_def_property_int_sdna(prop, NULL, "custom2"); 00858 RNA_def_property_ui_text(prop, "End Frame", ""); 00859 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00860 } 00861 00862 static void def_colorramp(StructRNA *srna) 00863 { 00864 PropertyRNA *prop; 00865 00866 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE); 00867 RNA_def_property_pointer_sdna(prop, NULL, "storage"); 00868 RNA_def_property_struct_type(prop, "ColorRamp"); 00869 RNA_def_property_ui_text(prop, "Color Ramp", ""); 00870 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00871 } 00872 00873 static void def_mix_rgb(StructRNA *srna) 00874 { 00875 PropertyRNA *prop; 00876 00877 prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); 00878 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 00879 RNA_def_property_enum_items(prop, ramp_blend_items); 00880 RNA_def_property_ui_text(prop, "Blend Type", ""); 00881 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00882 00883 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); 00884 RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1); 00885 RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation"); 00886 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00887 } 00888 00889 static void def_texture(StructRNA *srna) 00890 { 00891 PropertyRNA *prop; 00892 00893 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); 00894 RNA_def_property_pointer_sdna(prop, NULL, "id"); 00895 RNA_def_property_struct_type(prop, "Texture"); 00896 RNA_def_property_flag(prop, PROP_EDITABLE); 00897 RNA_def_property_ui_text(prop, "Texture", ""); 00898 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00899 00900 prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE); 00901 RNA_def_property_int_sdna(prop, NULL, "custom1"); 00902 RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use"); 00903 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00904 } 00905 00906 00907 /* -- Shader Nodes ---------------------------------------------------------- */ 00908 00909 static void def_sh_material(StructRNA *srna) 00910 { 00911 PropertyRNA *prop; 00912 00913 prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); 00914 RNA_def_property_pointer_sdna(prop, NULL, "id"); 00915 RNA_def_property_struct_type(prop, "Material"); 00916 RNA_def_property_flag(prop, PROP_EDITABLE); 00917 RNA_def_property_ui_text(prop, "Material", ""); 00918 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00919 00920 prop = RNA_def_property(srna, "use_diffuse", PROP_BOOLEAN, PROP_NONE); 00921 RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF); 00922 RNA_def_property_ui_text(prop, "Diffuse", "Material Node outputs Diffuse"); 00923 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00924 00925 prop = RNA_def_property(srna, "use_specular", PROP_BOOLEAN, PROP_NONE); 00926 RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_SPEC); 00927 RNA_def_property_ui_text(prop, "Specular", "Material Node outputs Specular"); 00928 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00929 00930 prop = RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE); 00931 RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_NEG); 00932 RNA_def_property_ui_text(prop, "Invert Normal", "Material Node uses inverted normal"); 00933 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00934 } 00935 00936 static void def_sh_mapping(StructRNA *srna) 00937 { 00938 PropertyRNA *prop; 00939 00940 RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); 00941 00942 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); 00943 RNA_def_property_float_sdna(prop, NULL, "loc"); 00944 RNA_def_property_ui_text(prop, "Location", "Location offset for the input coordinate"); 00945 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); 00946 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); 00947 00948 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_XYZ); /* Not PROP_EUL, this is already in degrees, not radians */ 00949 RNA_def_property_float_sdna(prop, NULL, "rot"); 00950 RNA_def_property_ui_text(prop, "Rotation", "Rotation offset for the input coordinate"); 00951 RNA_def_property_ui_range(prop, -360.f, 360.f, 1.f, 2); 00952 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); 00953 00954 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); 00955 RNA_def_property_float_sdna(prop, NULL, "size"); 00956 RNA_def_property_ui_text(prop, "Scale", "Scale adjustment for the input coordinate"); 00957 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); 00958 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); 00959 00960 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE); 00961 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); 00962 RNA_def_property_ui_text(prop, "Clamp Minimum", "Clamp the output coordinate to a minimum value"); 00963 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00964 00965 prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ); 00966 RNA_def_property_float_sdna(prop, NULL, "min"); 00967 RNA_def_property_ui_text(prop, "Minimum", "Minimum value to clamp coordinate to"); 00968 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); 00969 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00970 00971 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE); 00972 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); 00973 RNA_def_property_ui_text(prop, "Clamp Maximum", "Clamp the output coordinate to a maximum value"); 00974 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00975 00976 prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ); 00977 RNA_def_property_float_sdna(prop, NULL, "max"); 00978 RNA_def_property_ui_text(prop, "Maximum", "Maximum value to clamp coordinate to"); 00979 RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); 00980 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00981 } 00982 00983 static void def_sh_geometry(StructRNA *srna) 00984 { 00985 PropertyRNA *prop; 00986 00987 RNA_def_struct_sdna_from(srna, "NodeGeometry", "storage"); 00988 00989 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); 00990 RNA_def_property_string_sdna(prop, NULL, "uvname"); 00991 RNA_def_property_ui_text(prop, "UV Layer", ""); 00992 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00993 00994 prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE); 00995 RNA_def_property_string_sdna(prop, NULL, "colname"); 00996 RNA_def_property_ui_text(prop, "Vertex Color Layer", ""); 00997 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 00998 } 00999 01000 01001 /* -- Compositor Nodes ------------------------------------------------------ */ 01002 01003 static void def_cmp_alpha_over(StructRNA *srna) 01004 { 01005 PropertyRNA *prop; 01006 01007 // XXX: Tooltip 01008 prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); 01009 RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); 01010 RNA_def_property_ui_text(prop, "Convert Premul", ""); 01011 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01012 01013 RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage"); 01014 01015 prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_NONE); 01016 RNA_def_property_float_sdna(prop, NULL, "x"); 01017 RNA_def_property_range(prop, 0.0f, 1.0f); 01018 RNA_def_property_ui_text(prop, "Premul", "Mix Factor"); 01019 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01020 } 01021 01022 static void def_cmp_hue_saturation(StructRNA *srna) 01023 { 01024 PropertyRNA *prop; 01025 01026 RNA_def_struct_sdna_from(srna, "NodeHueSat", "storage"); 01027 01028 prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE); 01029 RNA_def_property_float_sdna(prop, NULL, "hue"); 01030 RNA_def_property_range(prop, 0.0f, 1.0f); 01031 RNA_def_property_ui_text(prop, "Hue", ""); 01032 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01033 01034 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE); 01035 RNA_def_property_float_sdna(prop, NULL, "sat"); 01036 RNA_def_property_range(prop, 0.0f, 2.0f); 01037 RNA_def_property_ui_text(prop, "Saturation", ""); 01038 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01039 01040 prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE); 01041 RNA_def_property_float_sdna(prop, NULL, "val"); 01042 RNA_def_property_range(prop, 0.0f, 2.0f); 01043 RNA_def_property_ui_text(prop, "Value", ""); 01044 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01045 } 01046 01047 static void def_cmp_blur(StructRNA *srna) 01048 { 01049 PropertyRNA *prop; 01050 01051 static EnumPropertyItem filter_type_items[] = { 01052 {R_FILTER_BOX, "FLAT", 0, "Flat", ""}, 01053 {R_FILTER_TENT, "TENT", 0, "Tent", ""}, 01054 {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""}, 01055 {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""}, 01056 {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""}, 01057 {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""}, 01058 {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""}, 01059 {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""}, 01060 {0, NULL, 0, NULL, NULL}}; 01061 01062 static EnumPropertyItem aspect_correction_type_items[] = { 01063 {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""}, 01064 {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""}, 01065 {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""}, 01066 {0, NULL, 0, NULL, NULL}}; 01067 01068 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage"); 01069 01070 prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE); 01071 RNA_def_property_int_sdna(prop, NULL, "sizex"); 01072 RNA_def_property_range(prop, 0, 2048); 01073 RNA_def_property_ui_text(prop, "Size X", ""); 01074 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01075 01076 prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE); 01077 RNA_def_property_int_sdna(prop, NULL, "sizey"); 01078 RNA_def_property_range(prop, 0, 2048); 01079 RNA_def_property_ui_text(prop, "Size Y", ""); 01080 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01081 01082 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE); 01083 RNA_def_property_boolean_sdna(prop, NULL, "relative", 1); 01084 RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius"); 01085 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01086 01087 prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE); 01088 RNA_def_property_enum_sdna(prop, NULL, "aspect"); 01089 RNA_def_property_enum_items(prop, aspect_correction_type_items); 01090 RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use"); 01091 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01092 01093 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); 01094 RNA_def_property_float_sdna(prop, NULL, "fac"); 01095 RNA_def_property_range(prop, 0.0f, 2.0f); 01096 RNA_def_property_ui_text(prop, "Factor", ""); 01097 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01098 01099 prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE); 01100 RNA_def_property_float_sdna(prop, NULL, "percentx"); 01101 RNA_def_property_range(prop, 0.0f, 100.0f); 01102 RNA_def_property_ui_text(prop, "Relative Size X", ""); 01103 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01104 01105 prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE); 01106 RNA_def_property_float_sdna(prop, NULL, "percenty"); 01107 RNA_def_property_range(prop, 0.0f, 100.0f); 01108 RNA_def_property_ui_text(prop, "Relative Size Y", ""); 01109 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01110 01111 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE); 01112 RNA_def_property_enum_sdna(prop, NULL, "filtertype"); 01113 RNA_def_property_enum_items(prop, filter_type_items); 01114 RNA_def_property_ui_text(prop, "Filter Type", ""); 01115 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01116 01117 prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE); 01118 RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1); 01119 RNA_def_property_ui_text(prop, "Bokeh", "Uses circular filter (slower)"); 01120 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01121 01122 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE); 01123 RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1); 01124 RNA_def_property_ui_text(prop, "Gamma", "Applies filter on gamma corrected values"); 01125 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01126 01127 } 01128 01129 static void def_cmp_filter(StructRNA *srna) 01130 { 01131 PropertyRNA *prop; 01132 01133 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE); 01134 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01135 RNA_def_property_enum_items(prop, node_filter_items); 01136 RNA_def_property_ui_text(prop, "Filter Type", ""); 01137 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01138 } 01139 01140 static void def_cmp_map_value(StructRNA *srna) 01141 { 01142 PropertyRNA *prop; 01143 01144 RNA_def_struct_sdna_from(srna, "TexMapping", "storage"); 01145 01146 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); 01147 RNA_def_property_float_sdna(prop, NULL, "loc"); 01148 RNA_def_property_array(prop, 1); 01149 RNA_def_property_range(prop, -1000.0f, 1000.0f); 01150 RNA_def_property_ui_text(prop, "Offset", ""); 01151 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01152 01153 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); 01154 RNA_def_property_float_sdna(prop, NULL, "size"); 01155 RNA_def_property_array(prop, 1); 01156 RNA_def_property_range(prop, -1000.0f, 1000.0f); 01157 RNA_def_property_ui_text(prop, "Size", ""); 01158 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01159 01160 prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE); 01161 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN); 01162 RNA_def_property_ui_text(prop, "Use Minimum", ""); 01163 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01164 01165 prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE); 01166 RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX); 01167 RNA_def_property_ui_text(prop, "Use Maximum", ""); 01168 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01169 01170 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE); 01171 RNA_def_property_float_sdna(prop, NULL, "min"); 01172 RNA_def_property_array(prop, 1); 01173 RNA_def_property_range(prop, -1000.0f, 1000.0f); 01174 RNA_def_property_ui_text(prop, "Minimum", ""); 01175 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01176 01177 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE); 01178 RNA_def_property_float_sdna(prop, NULL, "max"); 01179 RNA_def_property_array(prop, 1); 01180 RNA_def_property_range(prop, -1000.0f, 1000.0f); 01181 RNA_def_property_ui_text(prop, "Maximum", ""); 01182 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01183 } 01184 01185 static void def_cmp_vector_blur(StructRNA *srna) 01186 { 01187 PropertyRNA *prop; 01188 01189 RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage"); 01190 01191 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); 01192 RNA_def_property_int_sdna(prop, NULL, "samples"); 01193 RNA_def_property_range(prop, 1, 256); 01194 RNA_def_property_ui_text(prop, "Samples", ""); 01195 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01196 01197 prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE); 01198 RNA_def_property_int_sdna(prop, NULL, "minspeed"); 01199 RNA_def_property_range(prop, 0, 1024); 01200 RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred; used to separate background from foreground"); 01201 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01202 01203 prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE); 01204 RNA_def_property_int_sdna(prop, NULL, "maxspeed"); 01205 RNA_def_property_range(prop, 0, 1024); 01206 RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none"); 01207 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01208 01209 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); 01210 RNA_def_property_float_sdna(prop, NULL, "fac"); 01211 RNA_def_property_range(prop, 0.0f, 2.0f); 01212 RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors; actually 'shutter speed' in frames"); 01213 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01214 01215 prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE); 01216 RNA_def_property_boolean_sdna(prop, NULL, "curved", 1); 01217 RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly"); 01218 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01219 } 01220 01221 static void def_cmp_levels(StructRNA *srna) 01222 { 01223 PropertyRNA *prop; 01224 01225 static EnumPropertyItem channel_items[] = { 01226 {1, "COMBINED_RGB", 0, "C", "Combined RGB"}, 01227 {2, "RED", 0, "R", "Red Channel"}, 01228 {3, "GREEN", 0, "G", "Green Channel"}, 01229 {4, "BLUE", 0, "B", "Blue Channel"}, 01230 {5, "LUMINANCE", 0, "L", "Luminance Channel"}, 01231 {0, NULL, 0, NULL, NULL}}; 01232 01233 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); 01234 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01235 RNA_def_property_enum_items(prop, channel_items); 01236 RNA_def_property_ui_text(prop, "Channel", ""); 01237 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01238 } 01239 01240 static void def_cmp_image(StructRNA *srna) 01241 { 01242 PropertyRNA *prop; 01243 01244 /* 01245 static EnumPropertyItem type_items[] = { 01246 {IMA_SRC_FILE, "IMAGE", 0, "Image", ""}, 01247 {IMA_SRC_MOVIE, "MOVIE", "Movie", ""}, 01248 {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""}, 01249 {IMA_SRC_GENERATED, "GENERATED", "Generated", ""}, 01250 {0, NULL, 0, NULL, NULL}}; 01251 */ 01252 01253 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); 01254 RNA_def_property_pointer_sdna(prop, NULL, "id"); 01255 RNA_def_property_struct_type(prop, "Image"); 01256 RNA_def_property_flag(prop, PROP_EDITABLE); 01257 RNA_def_property_ui_text(prop, "Image", ""); 01258 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01259 01260 RNA_def_struct_sdna_from(srna, "ImageUser", "storage"); 01261 01262 prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); 01263 RNA_def_property_int_sdna(prop, NULL, "frames"); 01264 RNA_def_property_range(prop, 0, MAXFRAMEF); 01265 RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); /* copied from the rna_image.c */ 01266 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01267 01268 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); 01269 RNA_def_property_int_sdna(prop, NULL, "sfra"); 01270 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); 01271 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 */ 01272 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01273 01274 prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); 01275 RNA_def_property_int_sdna(prop, NULL, "offset"); 01276 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); 01277 RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); /* copied from the rna_image.c */ 01278 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01279 01280 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE); 01281 RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1); 01282 RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.c */ 01283 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01284 01285 prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE); 01286 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS); 01287 RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes"); /* copied from the rna_image.c */ 01288 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01289 01290 prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE); 01291 RNA_def_property_enum_sdna(prop, NULL, "layer"); 01292 RNA_def_property_enum_items(prop, prop_image_layer_items); 01293 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf"); 01294 RNA_def_property_ui_text(prop, "Layer", ""); 01295 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_layer_update"); 01296 } 01297 01298 static void def_cmp_render_layers(StructRNA *srna) 01299 { 01300 PropertyRNA *prop; 01301 01302 prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); 01303 RNA_def_property_pointer_sdna(prop, NULL, "id"); 01304 RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL); 01305 RNA_def_property_struct_type(prop, "Scene"); 01306 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); 01307 RNA_def_property_ui_text(prop, "Scene", ""); 01308 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01309 01310 prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE); 01311 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01312 RNA_def_property_enum_items(prop, prop_scene_layer_items); 01313 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_scene_layer_itemf"); 01314 RNA_def_property_ui_text(prop, "Layer", ""); 01315 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01316 } 01317 01318 static void def_cmp_output_file(StructRNA *srna) 01319 { 01320 PropertyRNA *prop; 01321 01322 static EnumPropertyItem type_items[] = { 01323 {R_TARGA, "TARGA", 0, "Targa", ""}, 01324 {R_RAWTGA, "RAW_TARGA", 0, "Targa Raw", ""}, 01325 {R_PNG, "PNG", 0, "PNG", ""}, 01326 #ifdef WITH_DDS 01327 {R_DDS, "DDS", 0, "DirectDraw Surface", ""}, 01328 #endif 01329 {R_BMP, "BMP", 0, "BMP", ""}, 01330 {R_JPEG90, "JPEG", 0, "JPEG", ""}, 01331 {R_IRIS, "IRIS", 0, "IRIS", ""}, 01332 {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""}, 01333 {R_CINEON, "CINEON", 0, "Cineon", ""}, 01334 {R_DPX, "DPX", 0, "DPX", ""}, 01335 {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""}, 01336 {0, NULL, 0, NULL, NULL}}; 01337 01338 static EnumPropertyItem openexr_codec_items[] = { 01339 {0, "NONE", 0, "None", ""}, 01340 {1, "PXR24", 0, "Pxr24 (lossy)", ""}, 01341 {2, "ZIP", 0, "ZIP (lossless)", ""}, 01342 {3, "PIZ", 0, "PIZ (lossless)", ""}, 01343 {4, "RLE", 0, "RLE (lossless)", ""}, 01344 {0, NULL, 0, NULL, NULL}}; 01345 01346 RNA_def_struct_sdna_from(srna, "NodeImageFile", "storage"); 01347 01348 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); 01349 RNA_def_property_string_sdna(prop, NULL, "name"); 01350 RNA_def_property_ui_text(prop, "File Path", "Output path for the image, same functionality as render output."); 01351 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01352 01353 prop = RNA_def_property(srna, "image_type", PROP_ENUM, PROP_NONE); 01354 RNA_def_property_enum_sdna(prop, NULL, "imtype"); 01355 RNA_def_property_enum_items(prop, type_items); 01356 RNA_def_property_ui_text(prop, "Image Type", ""); 01357 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01358 01359 prop = RNA_def_property(srna, "use_exr_half", PROP_BOOLEAN, PROP_NONE); 01360 RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_HALF); 01361 RNA_def_property_ui_text(prop, "Half", ""); 01362 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01363 01364 prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE); 01365 RNA_def_property_enum_sdna(prop, NULL, "codec"); 01366 RNA_def_property_enum_items(prop, openexr_codec_items); 01367 RNA_def_property_ui_text(prop, "Codec", ""); 01368 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01369 01370 prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE); 01371 RNA_def_property_int_sdna(prop, NULL, "quality"); 01372 RNA_def_property_range(prop, 1, 100); 01373 RNA_def_property_ui_text(prop, "Quality", ""); 01374 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01375 01376 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); 01377 RNA_def_property_int_sdna(prop, NULL, "sfra"); 01378 RNA_def_property_int_funcs(prop, NULL, "rna_Image_start_frame_set", NULL); 01379 RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF); 01380 RNA_def_property_ui_text(prop, "Start Frame", ""); 01381 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01382 01383 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); 01384 RNA_def_property_int_sdna(prop, NULL, "efra"); 01385 RNA_def_property_int_funcs(prop, NULL, "rna_Image_end_frame_set", NULL); 01386 RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF); 01387 RNA_def_property_ui_text(prop, "End Frame", ""); 01388 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01389 } 01390 01391 static void def_cmp_dilate_erode(StructRNA *srna) 01392 { 01393 PropertyRNA *prop; 01394 01395 prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE); 01396 RNA_def_property_int_sdna(prop, NULL, "custom2"); 01397 RNA_def_property_range(prop, -100, 100); 01398 RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)"); 01399 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01400 } 01401 01402 static void def_cmp_scale(StructRNA *srna) 01403 { 01404 PropertyRNA *prop; 01405 01406 static EnumPropertyItem space_items[] = { 01407 {0, "RELATIVE", 0, "Relative", ""}, 01408 {1, "ABSOLUTE", 0, "Absolute", ""}, 01409 {2, "SCENE_SIZE", 0, "Scene Size", ""}, 01410 {3, "RENDER_SIZE", 0, "Render Size", ""}, 01411 {0, NULL, 0, NULL, NULL}}; 01412 01413 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE); 01414 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01415 RNA_def_property_enum_items(prop, space_items); 01416 RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to"); 01417 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01418 } 01419 01420 static void def_cmp_rotate(StructRNA *srna) 01421 { 01422 PropertyRNA *prop; 01423 01424 static EnumPropertyItem rotate_items[] = { 01425 {0, "NEAREST", 0, "Nearest", ""}, 01426 {1, "BILINEAR", 0, "Bilinear", ""}, 01427 {2, "BICUBIC", 0, "Bicubic", ""}, 01428 {0, NULL, 0, NULL, NULL}}; 01429 01430 prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE); 01431 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01432 RNA_def_property_enum_items(prop, rotate_items); 01433 RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation"); 01434 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01435 } 01436 01437 static void def_cmp_diff_matte(StructRNA *srna) 01438 { 01439 PropertyRNA *prop; 01440 01441 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); 01442 01443 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE); 01444 RNA_def_property_float_sdna(prop, NULL, "t1"); 01445 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); 01446 RNA_def_property_range(prop, 0.0f, 1.0f); 01447 RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed"); 01448 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01449 01450 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); 01451 RNA_def_property_float_sdna(prop, NULL, "t2"); 01452 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); 01453 RNA_def_property_range(prop, 0.0f, 1.0f); 01454 RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed"); 01455 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01456 } 01457 01458 static void def_cmp_color_matte(StructRNA *srna) 01459 { 01460 PropertyRNA *prop; 01461 01462 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); 01463 01464 prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE); 01465 RNA_def_property_float_sdna(prop, NULL, "t1"); 01466 RNA_def_property_range(prop, 0.0f, 1.0f); 01467 RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color"); 01468 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01469 01470 prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE); 01471 RNA_def_property_float_sdna(prop, NULL, "t2"); 01472 RNA_def_property_range(prop, 0.0f, 1.0f); 01473 RNA_def_property_ui_text(prop, "S", "Saturation Tolerance for the color"); 01474 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01475 01476 prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE); 01477 RNA_def_property_float_sdna(prop, NULL, "t3"); 01478 RNA_def_property_range(prop, 0.0f, 1.0f); 01479 RNA_def_property_ui_text(prop, "V", "Value Tolerance for the color"); 01480 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01481 } 01482 01483 static void def_cmp_distance_matte(StructRNA *srna) 01484 { 01485 PropertyRNA *prop; 01486 01487 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); 01488 01489 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE); 01490 RNA_def_property_float_sdna(prop, NULL, "t1"); 01491 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); 01492 RNA_def_property_range(prop, 0.0f, 1.0f); 01493 RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed"); 01494 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01495 01496 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); 01497 RNA_def_property_float_sdna(prop, NULL, "t2"); 01498 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); 01499 RNA_def_property_range(prop, 0.0f, 1.0f); 01500 RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed"); 01501 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01502 } 01503 01504 static void def_cmp_color_spill(StructRNA *srna) 01505 { 01506 PropertyRNA *prop; 01507 01508 static EnumPropertyItem channel_items[] = { 01509 {1, "R", 0, "R", "Red Spill Suppression"}, 01510 {2, "G", 0, "G", "Green Spill Suppression"}, 01511 {3, "B", 0, "B", "Blue Spill Suppression"}, 01512 {0, NULL, 0, NULL, NULL}}; 01513 01514 static EnumPropertyItem limit_channel_items[] = { 01515 {1, "R", 0, "R", "Limit by Red"}, 01516 {2, "G", 0, "G", "Limit by Green"}, 01517 {3, "B", 0, "B", "Limit by Blue"}, 01518 {0, NULL, 0, NULL, NULL}}; 01519 01520 static EnumPropertyItem algorithm_items[] = { 01521 {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"}, 01522 {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"}, 01523 {0, NULL, 0, NULL, NULL}}; 01524 01525 prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE); 01526 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01527 RNA_def_property_enum_items(prop, channel_items); 01528 RNA_def_property_ui_text(prop, "Channel", ""); 01529 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01530 01531 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE); 01532 RNA_def_property_enum_sdna(prop, NULL, "custom2"); 01533 RNA_def_property_enum_items(prop, algorithm_items); 01534 RNA_def_property_ui_text(prop, "Algorithm", ""); 01535 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01536 01537 RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage"); 01538 01539 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE); 01540 RNA_def_property_enum_sdna(prop, NULL, "limchan"); 01541 RNA_def_property_enum_items(prop, limit_channel_items); 01542 RNA_def_property_ui_text(prop, "Limit Channel", ""); 01543 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01544 01545 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE); 01546 RNA_def_property_float_sdna(prop, NULL, "limscale"); 01547 RNA_def_property_range(prop, 0.5f, 1.5f); 01548 RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value"); 01549 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01550 01551 prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE); 01552 RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0); 01553 RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand"); 01554 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01555 01556 prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE); 01557 RNA_def_property_float_sdna(prop, NULL, "uspillr"); 01558 RNA_def_property_range(prop, 0.0f, 1.5f); 01559 RNA_def_property_ui_text(prop, "R", "Red spillmap scale"); 01560 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01561 01562 prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE); 01563 RNA_def_property_float_sdna(prop, NULL, "uspillg"); 01564 RNA_def_property_range(prop, 0.0f, 1.5f); 01565 RNA_def_property_ui_text(prop, "G", "Green spillmap scale"); 01566 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01567 01568 prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE); 01569 RNA_def_property_float_sdna(prop, NULL, "uspillb"); 01570 RNA_def_property_range(prop, 0.0f, 1.5f); 01571 RNA_def_property_ui_text(prop, "B", "Blue spillmap scale"); 01572 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01573 } 01574 01575 static void def_cmp_luma_matte(StructRNA *srna) 01576 { 01577 PropertyRNA *prop; 01578 01579 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); 01580 01581 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); 01582 RNA_def_property_float_sdna(prop, NULL, "t1"); 01583 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); 01584 RNA_def_property_range(prop, 0.0f, 1.0f); 01585 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque"); 01586 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01587 01588 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); 01589 RNA_def_property_float_sdna(prop, NULL, "t2"); 01590 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); 01591 RNA_def_property_range(prop, 0.0f, 1.0f); 01592 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed"); 01593 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01594 } 01595 01596 static void def_cmp_chroma_matte(StructRNA *srna) 01597 { 01598 PropertyRNA *prop; 01599 01600 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); 01601 01602 prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE); 01603 RNA_def_property_float_sdna(prop, NULL, "t1"); 01604 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); 01605 RNA_def_property_range(prop, 1.0f, 80.0f); 01606 RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color"); 01607 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01608 01609 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); 01610 RNA_def_property_float_sdna(prop, NULL, "t2"); 01611 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); 01612 RNA_def_property_range(prop, 0.0f, 30.0f); 01613 RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches"); 01614 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01615 01616 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE); 01617 RNA_def_property_float_sdna(prop, NULL, "fsize"); 01618 RNA_def_property_range(prop, 0.0f, 1.0f); 01619 RNA_def_property_ui_text(prop, "Lift", "Alpha lift"); 01620 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01621 01622 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE); 01623 RNA_def_property_float_sdna(prop, NULL, "fstrength"); 01624 RNA_def_property_range(prop, 0.0f, 1.0f); 01625 RNA_def_property_ui_text(prop, "Gain", "Alpha gain"); 01626 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01627 01628 prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE); 01629 RNA_def_property_float_sdna(prop, NULL, "t3"); 01630 RNA_def_property_range(prop, 0.0f, 1.0f); 01631 RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured"); 01632 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01633 } 01634 01635 static void def_cmp_channel_matte(StructRNA *srna) 01636 { 01637 PropertyRNA *prop; 01638 01639 static EnumPropertyItem color_space_items[] = { 01640 {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB Color Space"}, 01641 {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV Color Space"}, 01642 {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"}, 01643 {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr Color Space"}, 01644 {0, NULL, 0, NULL, NULL}}; 01645 01646 static EnumPropertyItem algorithm_items[] = { 01647 {0, "SINGLE", 0, "Single", "Limit by single channel"}, 01648 {1, "MAX", 0, "Max", "Limit by max of other channels "}, 01649 {0, NULL, 0, NULL, NULL}}; 01650 01651 prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); 01652 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01653 RNA_def_property_enum_items(prop, color_space_items); 01654 RNA_def_property_ui_text(prop, "Color Space", ""); 01655 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01656 01657 prop= RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE); 01658 RNA_def_property_enum_sdna(prop, NULL, "custom2"); 01659 RNA_def_property_enum_items(prop, prop_tri_channel_items); 01660 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf"); 01661 RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte"); 01662 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01663 01664 RNA_def_struct_sdna_from(srna, "NodeChroma", "storage"); 01665 01666 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE); 01667 RNA_def_property_enum_sdna(prop, NULL, "algorithm"); 01668 RNA_def_property_enum_items(prop, algorithm_items); 01669 RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel"); 01670 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01671 01672 prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE); 01673 RNA_def_property_enum_sdna(prop, NULL, "channel"); 01674 RNA_def_property_enum_items(prop, prop_tri_channel_items); 01675 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf"); 01676 RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channels value"); 01677 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01678 01679 prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); 01680 RNA_def_property_float_sdna(prop, NULL, "t1"); 01681 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL); 01682 RNA_def_property_range(prop, 0.0f, 1.0f); 01683 RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque"); 01684 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01685 01686 prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); 01687 RNA_def_property_float_sdna(prop, NULL, "t2"); 01688 RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL); 01689 RNA_def_property_range(prop, 0.0f, 1.0f); 01690 RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed"); 01691 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01692 } 01693 01694 static void def_cmp_flip(StructRNA *srna) 01695 { 01696 PropertyRNA *prop; 01697 01698 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); 01699 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01700 RNA_def_property_enum_items(prop, node_flip_items); 01701 RNA_def_property_ui_text(prop, "Axis", ""); 01702 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01703 } 01704 01705 static void def_cmp_splitviewer(StructRNA *srna) 01706 { 01707 PropertyRNA *prop; 01708 01709 static EnumPropertyItem axis_items[] = { 01710 {0, "X", 0, "X", ""}, 01711 {1, "Y", 0, "Y", ""}, 01712 {0, NULL, 0, NULL, NULL}}; 01713 01714 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); 01715 RNA_def_property_enum_sdna(prop, NULL, "custom2"); 01716 RNA_def_property_enum_items(prop, axis_items); 01717 RNA_def_property_ui_text(prop, "Axis", ""); 01718 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01719 01720 prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR); 01721 RNA_def_property_int_sdna(prop, NULL, "custom1"); 01722 RNA_def_property_range(prop, 0, 100); 01723 RNA_def_property_ui_text(prop, "Factor", ""); 01724 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01725 } 01726 01727 static void def_cmp_id_mask(StructRNA *srna) 01728 { 01729 PropertyRNA *prop; 01730 01731 prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE); 01732 RNA_def_property_int_sdna(prop, NULL, "custom1"); 01733 RNA_def_property_range(prop, 0, 10000); 01734 RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha"); 01735 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01736 } 01737 01738 static void def_cmp_map_uv(StructRNA *srna) 01739 { 01740 PropertyRNA *prop; 01741 01742 prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR); 01743 RNA_def_property_int_sdna(prop, NULL, "custom1"); 01744 RNA_def_property_range(prop, 0, 100); 01745 RNA_def_property_ui_text(prop, "Alpha", ""); 01746 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01747 } 01748 01749 static void def_cmp_defocus(StructRNA *srna) 01750 { 01751 PropertyRNA *prop; 01752 01753 static EnumPropertyItem bokeh_items[] = { 01754 {8, "OCTAGON", 0, "Octagonal", "8 sides"}, 01755 {7, "HEPTAGON", 0, "Heptagonal", "7 sides"}, 01756 {6, "HEXAGON", 0, "Hexagonal", "6 sides"}, 01757 {5, "PENTAGON", 0, "Pentagonal", "5 sides"}, 01758 {4, "SQUARE", 0, "Square", "4 sides"}, 01759 {3, "TRIANGLE", 0, "Triangular", "3 sides"}, 01760 {0, "CIRCLE", 0, "Circular", ""}, 01761 {0, NULL, 0, NULL, NULL}}; 01762 01763 RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage"); 01764 01765 prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE); 01766 RNA_def_property_enum_sdna(prop, NULL, "bktype"); 01767 RNA_def_property_enum_items(prop, bokeh_items); 01768 RNA_def_property_ui_text(prop, "Bokeh Type", ""); 01769 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01770 01771 /* TODO: angle in degrees */ 01772 prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE); 01773 RNA_def_property_int_sdna(prop, NULL, "rotation"); 01774 RNA_def_property_range(prop, 0, 90); 01775 RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees"); 01776 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01777 01778 prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE); 01779 RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1); 01780 RNA_def_property_ui_text(prop, "Gamma Correction", "Enable gamma correction before and after main process"); 01781 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01782 01783 /* TODO */ 01784 prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE); 01785 RNA_def_property_float_sdna(prop, NULL, "fstop"); 01786 RNA_def_property_range(prop, 0.0f, 128.0f); 01787 RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius"); 01788 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01789 01790 prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE); 01791 RNA_def_property_float_sdna(prop, NULL, "maxblur"); 01792 RNA_def_property_range(prop, 0.0f, 10000.0f); 01793 RNA_def_property_ui_text(prop, "Max Blur", "blur limit, maximum CoC radius, 0=no limit"); 01794 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01795 01796 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); 01797 RNA_def_property_float_sdna(prop, NULL, "bthresh"); 01798 RNA_def_property_range(prop, 0.0f, 100.0f); 01799 RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off"); 01800 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01801 01802 prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE); 01803 RNA_def_property_boolean_sdna(prop, NULL, "preview", 1); 01804 RNA_def_property_ui_text(prop, "Preview", "Enable sampling mode, useful for preview when using low samplecounts"); 01805 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01806 01807 prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); 01808 RNA_def_property_int_sdna(prop, NULL, "samples"); 01809 RNA_def_property_range(prop, 16, 256); 01810 RNA_def_property_ui_text(prop, "Samples", "Number of samples (16=grainy, higher=less noise)"); 01811 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01812 01813 prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE); 01814 RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1); 01815 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)"); 01816 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01817 01818 prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE); 01819 RNA_def_property_float_sdna(prop, NULL, "scale"); 01820 RNA_def_property_range(prop, 0.0f, 1000.0f); 01821 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"); 01822 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01823 } 01824 01825 static void def_cmp_invert(StructRNA *srna) 01826 { 01827 PropertyRNA *prop; 01828 01829 prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE); 01830 RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB); 01831 RNA_def_property_ui_text(prop, "RGB", ""); 01832 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01833 01834 prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE); 01835 RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A); 01836 RNA_def_property_ui_text(prop, "Alpha", ""); 01837 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01838 } 01839 01840 static void def_cmp_crop(StructRNA *srna) 01841 { 01842 PropertyRNA *prop; 01843 01844 prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE); 01845 RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); 01846 RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image"); 01847 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01848 01849 prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE); 01850 RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1); 01851 RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image"); 01852 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01853 01854 RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage"); 01855 01856 prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE); 01857 RNA_def_property_int_sdna(prop, NULL, "x1"); 01858 RNA_def_property_range(prop, 0, 10000); 01859 RNA_def_property_ui_text(prop, "X1", ""); 01860 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01861 01862 prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE); 01863 RNA_def_property_int_sdna(prop, NULL, "x2"); 01864 RNA_def_property_range(prop, 0, 10000); 01865 RNA_def_property_ui_text(prop, "X2", ""); 01866 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01867 01868 prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE); 01869 RNA_def_property_int_sdna(prop, NULL, "y1"); 01870 RNA_def_property_range(prop, 0, 10000); 01871 RNA_def_property_ui_text(prop, "Y1", ""); 01872 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01873 01874 prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE); 01875 RNA_def_property_int_sdna(prop, NULL, "y2"); 01876 RNA_def_property_range(prop, 0, 10000); 01877 RNA_def_property_ui_text(prop, "Y2", ""); 01878 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01879 01880 prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE); 01881 RNA_def_property_float_sdna(prop, NULL, "fac_x1"); 01882 RNA_def_property_range(prop, 0.0, 1.0); 01883 RNA_def_property_ui_text(prop, "X1", ""); 01884 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01885 01886 prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE); 01887 RNA_def_property_float_sdna(prop, NULL, "fac_x2"); 01888 RNA_def_property_range(prop, 0.0, 1.0); 01889 RNA_def_property_ui_text(prop, "X2", ""); 01890 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01891 01892 prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE); 01893 RNA_def_property_float_sdna(prop, NULL, "fac_y1"); 01894 RNA_def_property_range(prop, 0.0, 1.0); 01895 RNA_def_property_ui_text(prop, "Y1", ""); 01896 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01897 01898 prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE); 01899 RNA_def_property_float_sdna(prop, NULL, "fac_y2"); 01900 RNA_def_property_range(prop, 0.0, 1.0); 01901 RNA_def_property_ui_text(prop, "Y2", ""); 01902 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01903 } 01904 01905 static void def_cmp_dblur(StructRNA *srna) 01906 { 01907 PropertyRNA *prop; 01908 01909 RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage"); 01910 01911 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); 01912 RNA_def_property_int_sdna(prop, NULL, "iter"); 01913 RNA_def_property_range(prop, 1, 32); 01914 RNA_def_property_ui_text(prop, "Iterations", ""); 01915 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01916 01917 prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE); 01918 RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1); 01919 RNA_def_property_ui_text(prop, "Wrap", ""); 01920 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01921 01922 prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE); 01923 RNA_def_property_float_sdna(prop, NULL, "center_x"); 01924 RNA_def_property_range(prop, 0.0f, 1.0f); 01925 RNA_def_property_ui_text(prop, "Center X", ""); 01926 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01927 01928 prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE); 01929 RNA_def_property_float_sdna(prop, NULL, "center_y"); 01930 RNA_def_property_range(prop, 0.0f, 1.0f); 01931 RNA_def_property_ui_text(prop, "Center Y", ""); 01932 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01933 01934 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); 01935 RNA_def_property_float_sdna(prop, NULL, "distance"); 01936 RNA_def_property_range(prop, -1.0f, 1.0f); 01937 RNA_def_property_ui_text(prop, "Distance", ""); 01938 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01939 01940 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); 01941 RNA_def_property_float_sdna(prop, NULL, "angle"); 01942 RNA_def_property_range(prop, 0.0f, 360.0f); 01943 RNA_def_property_ui_text(prop, "Angle", ""); 01944 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01945 01946 prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE); 01947 RNA_def_property_float_sdna(prop, NULL, "spin"); 01948 RNA_def_property_range(prop, -360.0f, 360.0f); 01949 RNA_def_property_ui_text(prop, "Spin", ""); 01950 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01951 01952 prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE); 01953 RNA_def_property_float_sdna(prop, NULL, "zoom"); 01954 RNA_def_property_range(prop, 0.0f, 100.0f); 01955 RNA_def_property_ui_text(prop, "Zoom", ""); 01956 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01957 } 01958 01959 static void def_cmp_bilateral_blur(StructRNA *srna) 01960 { 01961 PropertyRNA *prop; 01962 01963 RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage"); 01964 01965 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); 01966 RNA_def_property_int_sdna(prop, NULL, "iter"); 01967 RNA_def_property_range(prop, 1, 128); 01968 RNA_def_property_ui_text(prop, "Iterations", ""); 01969 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01970 01971 prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE); 01972 RNA_def_property_float_sdna(prop, NULL, "sigma_color"); 01973 RNA_def_property_range(prop, 0.01f, 3.0f); 01974 RNA_def_property_ui_text(prop, "Color Sigma", ""); 01975 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01976 01977 prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE); 01978 RNA_def_property_float_sdna(prop, NULL, "sigma_space"); 01979 RNA_def_property_range(prop, 0.01f, 30.0f); 01980 RNA_def_property_ui_text(prop, "Space Sigma", ""); 01981 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01982 } 01983 01984 static void def_cmp_premul_key(StructRNA *srna) 01985 { 01986 PropertyRNA *prop; 01987 01988 static EnumPropertyItem type_items[] = { 01989 {0, "KEY_TO_PREMUL", 0, "Key to Premul", ""}, 01990 {1, "PREMUL_TO_KEY", 0, "Premul to Key", ""}, 01991 {0, NULL, 0, NULL, NULL}}; 01992 01993 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); 01994 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 01995 RNA_def_property_enum_items(prop, type_items); 01996 RNA_def_property_ui_text(prop, "Mapping", "Conversion between premultiplied alpha and key alpha"); 01997 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 01998 01999 } 02000 02001 static void def_cmp_glare(StructRNA *srna) 02002 { 02003 PropertyRNA *prop; 02004 02005 static EnumPropertyItem type_items[] = { 02006 {3, "GHOSTS", 0, "Ghosts", ""}, 02007 {2, "STREAKS", 0, "Streaks", ""}, 02008 {1, "FOG_GLOW", 0, "Fog Glow", ""}, 02009 {0, "SIMPLE_STAR", 0, "Simple Star", ""}, 02010 {0, NULL, 0, NULL, NULL}}; 02011 02012 static EnumPropertyItem quality_items[] = { 02013 {0, "HIGH", 0, "High", ""}, 02014 {1, "MEDIUM", 0, "Medium", ""}, 02015 {2, "LOW", 0, "Low", ""}, 02016 {0, NULL, 0, NULL, NULL}}; 02017 02018 RNA_def_struct_sdna_from(srna, "NodeGlare", "storage"); 02019 02020 prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE); 02021 RNA_def_property_enum_sdna(prop, NULL, "type"); 02022 RNA_def_property_enum_items(prop, type_items); 02023 RNA_def_property_ui_text(prop, "Glare Type", ""); 02024 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02025 02026 prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE); 02027 RNA_def_property_enum_sdna(prop, NULL, "quality"); 02028 RNA_def_property_enum_items(prop, quality_items); 02029 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"); 02030 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02031 02032 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); 02033 RNA_def_property_int_sdna(prop, NULL, "iter"); 02034 RNA_def_property_range(prop, 2, 5); 02035 RNA_def_property_ui_text(prop, "Iterations", ""); 02036 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02037 02038 prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE); 02039 RNA_def_property_float_sdna(prop, NULL, "colmod"); 02040 RNA_def_property_range(prop, 0.0f, 1.0f); 02041 RNA_def_property_ui_text(prop, "Color Modulation", "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect"); 02042 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02043 02044 prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE); 02045 RNA_def_property_float_sdna(prop, NULL, "mix"); 02046 RNA_def_property_range(prop, -1.0f, 1.0f); 02047 RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only"); 02048 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02049 02050 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); 02051 RNA_def_property_float_sdna(prop, NULL, "threshold"); 02052 RNA_def_property_range(prop, 0.0f, 1000.0f); 02053 RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value"); 02054 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02055 02056 prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE); 02057 RNA_def_property_int_sdna(prop, NULL, "angle"); 02058 RNA_def_property_range(prop, 2, 16); 02059 RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks"); 02060 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02061 02062 prop = RNA_def_property(srna, "angle_offset", PROP_INT, PROP_NONE); 02063 RNA_def_property_int_sdna(prop, NULL, "angle_ofs"); 02064 RNA_def_property_range(prop, 0, 180); 02065 RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees"); 02066 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02067 02068 prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE); 02069 RNA_def_property_float_sdna(prop, NULL, "fade"); 02070 RNA_def_property_range(prop, 0.75f, 1.0f); 02071 RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor"); 02072 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02073 02074 prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE); 02075 RNA_def_property_boolean_sdna(prop, NULL, "angle", 0); 02076 RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset"); 02077 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02078 02079 prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE); 02080 RNA_def_property_int_sdna(prop, NULL, "size"); 02081 RNA_def_property_range(prop, 6, 9); 02082 RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)"); 02083 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02084 02085 /* TODO */ 02086 } 02087 02088 static void def_cmp_tonemap(StructRNA *srna) 02089 { 02090 PropertyRNA *prop; 02091 02092 static EnumPropertyItem type_items[] = { 02093 {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""}, 02094 {0, "RH_SIMPLE", 0, "Rh Simple", ""}, 02095 {0, NULL, 0, NULL, NULL}}; 02096 02097 RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage"); 02098 02099 prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE); 02100 RNA_def_property_enum_sdna(prop, NULL, "type"); 02101 RNA_def_property_enum_items(prop, type_items); 02102 RNA_def_property_ui_text(prop, "Tonemap Type", ""); 02103 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02104 02105 prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE); 02106 RNA_def_property_float_sdna(prop, NULL, "key"); 02107 RNA_def_property_range(prop, 0.0f, 1.0f); 02108 RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to"); 02109 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02110 02111 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); 02112 RNA_def_property_float_sdna(prop, NULL, "offset"); 02113 RNA_def_property_range(prop, 0.001f, 10.0f); 02114 RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve"); 02115 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02116 02117 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); 02118 RNA_def_property_float_sdna(prop, NULL, "gamma"); 02119 RNA_def_property_range(prop, 0.001f, 3.0f); 02120 RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1"); 02121 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02122 02123 prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE); 02124 RNA_def_property_float_sdna(prop, NULL, "f"); 02125 RNA_def_property_range(prop, -8.0f, 8.0f); 02126 RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter"); 02127 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02128 02129 prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE); 02130 RNA_def_property_float_sdna(prop, NULL, "m"); 02131 RNA_def_property_range(prop, 0.0f, 1.0f); 02132 RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image"); 02133 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02134 02135 prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE); 02136 RNA_def_property_float_sdna(prop, NULL, "a"); 02137 RNA_def_property_range(prop, 0.0f, 1.0f); 02138 RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity"); 02139 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02140 02141 prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE); 02142 RNA_def_property_float_sdna(prop, NULL, "c"); 02143 RNA_def_property_range(prop, 0.0f, 1.0f); 02144 RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent"); 02145 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02146 } 02147 02148 static void def_cmp_lensdist(StructRNA *srna) 02149 { 02150 PropertyRNA *prop; 02151 02152 RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage"); 02153 02154 prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE); 02155 RNA_def_property_boolean_sdna(prop, NULL, "proj", 1); 02156 RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode. Effect is applied in horizontal direction only"); 02157 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02158 02159 prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE); 02160 RNA_def_property_boolean_sdna(prop, NULL, "jit", 1); 02161 RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering; faster, but also noisier"); 02162 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02163 02164 prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE); 02165 RNA_def_property_boolean_sdna(prop, NULL, "fit", 1); 02166 RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible"); 02167 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02168 } 02169 02170 static void def_cmp_colorbalance(StructRNA *srna) 02171 { 02172 PropertyRNA *prop; 02173 static float default_1[3] = {1.f, 1.f, 1.f}; 02174 02175 static EnumPropertyItem type_items[] = { 02176 {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""}, 02177 {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"}, 02178 {0, NULL, 0, NULL, NULL}}; 02179 02180 prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE); 02181 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 02182 RNA_def_property_enum_items(prop, type_items); 02183 RNA_def_property_ui_text(prop, "Correction Formula", ""); 02184 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02185 02186 RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage"); 02187 02188 prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA); 02189 RNA_def_property_float_sdna(prop, NULL, "lift"); 02190 RNA_def_property_array(prop, 3); 02191 RNA_def_property_float_array_default(prop, default_1); 02192 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); 02193 RNA_def_property_ui_text(prop, "Lift", "Correction for Shadows"); 02194 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02195 02196 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA); 02197 RNA_def_property_float_sdna(prop, NULL, "gamma"); 02198 RNA_def_property_array(prop, 3); 02199 RNA_def_property_float_array_default(prop, default_1); 02200 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); 02201 RNA_def_property_ui_text(prop, "Gamma", "Correction for Midtones"); 02202 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02203 02204 prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA); 02205 RNA_def_property_float_sdna(prop, NULL, "gain"); 02206 RNA_def_property_array(prop, 3); 02207 RNA_def_property_float_array_default(prop, default_1); 02208 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); 02209 RNA_def_property_ui_text(prop, "Gain", "Correction for Highlights"); 02210 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02211 02212 02213 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA); 02214 RNA_def_property_float_sdna(prop, NULL, "lift"); 02215 RNA_def_property_array(prop, 3); 02216 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3); 02217 RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows"); 02218 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02219 02220 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA); 02221 RNA_def_property_float_sdna(prop, NULL, "gamma"); 02222 RNA_def_property_array(prop, 3); 02223 RNA_def_property_float_array_default(prop, default_1); 02224 RNA_def_property_range(prop, 0.f, FLT_MAX); 02225 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); 02226 RNA_def_property_ui_text(prop, "Power", "Correction for Midtones"); 02227 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02228 02229 prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA); 02230 RNA_def_property_float_sdna(prop, NULL, "gain"); 02231 RNA_def_property_array(prop, 3); 02232 RNA_def_property_float_array_default(prop, default_1); 02233 RNA_def_property_range(prop, 0.f, FLT_MAX); 02234 RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); 02235 RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights"); 02236 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02237 } 02238 02239 static void def_cmp_huecorrect(StructRNA *srna) 02240 { 02241 PropertyRNA *prop; 02242 02243 prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE); 02244 RNA_def_property_pointer_sdna(prop, NULL, "storage"); 02245 RNA_def_property_struct_type(prop, "CurveMapping"); 02246 RNA_def_property_ui_text(prop, "Mapping", ""); 02247 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02248 } 02249 02250 static void def_cmp_zcombine(StructRNA *srna) 02251 { 02252 PropertyRNA *prop; 02253 02254 prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); 02255 RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0); 02256 RNA_def_property_ui_text(prop, "Use Alpha", "Takes Alpha channel into account when doing the Z operation"); 02257 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02258 } 02259 02260 static void def_cmp_ycc(StructRNA *srna) 02261 { 02262 PropertyRNA *prop; 02263 02264 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); 02265 RNA_def_property_enum_sdna(prop, NULL, "custom1"); 02266 RNA_def_property_enum_items(prop, node_ycc_items); 02267 RNA_def_property_ui_text(prop, "Mode", ""); 02268 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02269 } 02270 02271 02272 /* -- Texture Nodes --------------------------------------------------------- */ 02273 02274 static void def_tex_output(StructRNA *srna) 02275 { 02276 PropertyRNA *prop; 02277 02278 RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage"); 02279 02280 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE); 02281 RNA_def_property_string_sdna(prop, NULL, "name"); 02282 RNA_def_property_ui_text(prop, "Output Name", ""); 02283 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02284 } 02285 02286 static void def_tex_image(StructRNA *srna) 02287 { 02288 PropertyRNA *prop; 02289 02290 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); 02291 RNA_def_property_pointer_sdna(prop, NULL, "id"); 02292 RNA_def_property_struct_type(prop, "Image"); 02293 RNA_def_property_flag(prop, PROP_EDITABLE); 02294 RNA_def_property_ui_text(prop, "Image", ""); 02295 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02296 02297 /* is this supposed to be exposed? not sure.. 02298 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); 02299 RNA_def_property_pointer_sdna(prop, NULL, "storage"); 02300 RNA_def_property_struct_type(prop, "ImageUser"); 02301 RNA_def_property_ui_text(prop, "Settings", ""); 02302 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02303 */ 02304 } 02305 02306 static void def_tex_bricks(StructRNA *srna) 02307 { 02308 PropertyRNA *prop; 02309 02310 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); 02311 RNA_def_property_float_sdna(prop, NULL, "custom3"); 02312 RNA_def_property_range(prop, 0.0f, 1.0f); 02313 RNA_def_property_ui_text(prop, "Offset Amount", ""); 02314 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02315 02316 prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE); 02317 RNA_def_property_int_sdna(prop, NULL, "custom1"); 02318 RNA_def_property_range(prop, 2, 99); 02319 RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows"); 02320 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02321 02322 prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE); 02323 RNA_def_property_float_sdna(prop, NULL, "custom4"); 02324 RNA_def_property_range(prop, 0.0f, 99.0f); 02325 RNA_def_property_ui_text(prop, "Squash Amount", ""); 02326 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02327 02328 prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE); 02329 RNA_def_property_int_sdna(prop, NULL, "custom2"); 02330 RNA_def_property_range(prop, 2, 99); 02331 RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows"); 02332 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02333 } 02334 02335 /* -------------------------------------------------------------------------- */ 02336 02337 static EnumPropertyItem shader_node_type_items[MaxNodes]; 02338 static void rna_def_shader_node(BlenderRNA *brna) 02339 { 02340 StructRNA *srna; 02341 PropertyRNA *prop; 02342 02343 alloc_node_type_items(shader_node_type_items, Category_ShaderNode); 02344 02345 srna = RNA_def_struct(brna, "ShaderNode", "Node"); 02346 RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node"); 02347 RNA_def_struct_sdna(srna, "bNode"); 02348 02349 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 02350 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02351 RNA_def_property_enum_items(prop, shader_node_type_items); 02352 RNA_def_property_ui_text(prop, "Type", ""); 02353 } 02354 02355 static EnumPropertyItem compositor_node_type_items[MaxNodes]; 02356 static void rna_def_compositor_node(BlenderRNA *brna) 02357 { 02358 StructRNA *srna; 02359 PropertyRNA *prop; 02360 02361 alloc_node_type_items(compositor_node_type_items, Category_CompositorNode); 02362 02363 srna = RNA_def_struct(brna, "CompositorNode", "Node"); 02364 RNA_def_struct_ui_text(srna, "Compositor Node", ""); 02365 RNA_def_struct_sdna(srna, "bNode"); 02366 02367 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 02368 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02369 RNA_def_property_enum_items(prop, compositor_node_type_items); 02370 RNA_def_property_ui_text(prop, "Type", ""); 02371 } 02372 02373 static EnumPropertyItem texture_node_type_items[MaxNodes]; 02374 static void rna_def_texture_node(BlenderRNA *brna) 02375 { 02376 StructRNA *srna; 02377 PropertyRNA *prop; 02378 02379 alloc_node_type_items(texture_node_type_items, Category_TextureNode); 02380 02381 srna = RNA_def_struct(brna, "TextureNode", "Node"); 02382 RNA_def_struct_ui_text(srna, "Texture Node", ""); 02383 RNA_def_struct_sdna(srna, "bNode"); 02384 02385 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 02386 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02387 RNA_def_property_enum_items(prop, texture_node_type_items); 02388 RNA_def_property_ui_text(prop, "Type", ""); 02389 } 02390 02391 /* -------------------------------------------------------------------------- */ 02392 02393 static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop) 02394 { 02395 StructRNA *srna; 02396 PropertyRNA *parm; 02397 FunctionRNA *func; 02398 02399 RNA_def_property_srna(cprop, "NodeLinks"); 02400 srna= RNA_def_struct(brna, "NodeLinks", NULL); 02401 RNA_def_struct_sdna(srna, "bNodeTree"); 02402 RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links"); 02403 02404 func= RNA_def_function(srna, "new", "rna_NodeTree_link_new"); 02405 RNA_def_function_ui_description(func, "Add a node link to this node tree."); 02406 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02407 parm= RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket."); 02408 RNA_def_property_flag(parm, PROP_REQUIRED); 02409 parm= RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket."); 02410 RNA_def_property_flag(parm, PROP_REQUIRED); 02411 /* return */ 02412 parm= RNA_def_pointer(func, "link", "NodeLink", "", "New node link."); 02413 RNA_def_function_return(func, parm); 02414 02415 func= RNA_def_function(srna, "remove", "rna_NodeTree_link_remove"); 02416 RNA_def_function_ui_description(func, "remove a node link from the node tree."); 02417 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02418 parm= RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove."); 02419 RNA_def_property_flag(parm, PROP_REQUIRED); 02420 } 02421 02422 static void rna_def_composite_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop) 02423 { 02424 StructRNA *srna; 02425 PropertyRNA *parm; 02426 FunctionRNA *func; 02427 02428 RNA_def_property_srna(cprop, "CompositorNodes"); 02429 srna= RNA_def_struct(brna, "CompositorNodes", NULL); 02430 RNA_def_struct_sdna(srna, "bNodeTree"); 02431 RNA_def_struct_ui_text(srna, "Compositor Nodes", "Collection of Compositor Nodes"); 02432 02433 func= RNA_def_function(srna, "new", "rna_NodeTree_node_composite_new"); 02434 RNA_def_function_ui_description(func, "Add a node to this node tree."); 02435 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); 02436 parm= RNA_def_enum(func, "type", compositor_node_type_items, 0, "Type", "Type of node to add"); 02437 RNA_def_property_flag(parm, PROP_REQUIRED); 02438 RNA_def_pointer(func, "group", "NodeTree", "", "The group tree"); 02439 /* return value */ 02440 parm= RNA_def_pointer(func, "node", "Node", "", "New node."); 02441 RNA_def_function_return(func, parm); 02442 02443 func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove"); 02444 RNA_def_function_ui_description(func, "remove a node from this node tree."); 02445 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02446 parm= RNA_def_pointer(func, "node", "Node", "", "The node to remove."); 02447 RNA_def_property_flag(parm, PROP_REQUIRED); 02448 } 02449 02450 static void rna_def_shader_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop) 02451 { 02452 StructRNA *srna; 02453 PropertyRNA *parm; 02454 FunctionRNA *func; 02455 02456 RNA_def_property_srna(cprop, "ShaderNodes"); 02457 srna= RNA_def_struct(brna, "ShaderNodes", NULL); 02458 RNA_def_struct_sdna(srna, "bNodeTree"); 02459 RNA_def_struct_ui_text(srna, "Shader Nodes", "Collection of Shader Nodes"); 02460 02461 func= RNA_def_function(srna, "new", "rna_NodeTree_node_new"); 02462 RNA_def_function_ui_description(func, "Add a node to this node tree."); 02463 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); 02464 parm= RNA_def_enum(func, "type", shader_node_type_items, 0, "Type", "Type of node to add"); 02465 RNA_def_property_flag(parm, PROP_REQUIRED); 02466 RNA_def_pointer(func, "group", "NodeTree", "", "The group tree"); 02467 /* return value */ 02468 parm= RNA_def_pointer(func, "node", "Node", "", "New node."); 02469 RNA_def_function_return(func, parm); 02470 02471 func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove"); 02472 RNA_def_function_ui_description(func, "remove a node from this node tree."); 02473 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02474 parm= RNA_def_pointer(func, "node", "Node", "", "The node to remove."); 02475 RNA_def_property_flag(parm, PROP_REQUIRED); 02476 } 02477 02478 static void rna_def_texture_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop) 02479 { 02480 StructRNA *srna; 02481 PropertyRNA *parm; 02482 FunctionRNA *func; 02483 02484 RNA_def_property_srna(cprop, "TextureNodes"); 02485 srna= RNA_def_struct(brna, "TextureNodes", NULL); 02486 RNA_def_struct_sdna(srna, "bNodeTree"); 02487 RNA_def_struct_ui_text(srna, "Texture Nodes", "Collection of Texture Nodes"); 02488 02489 func= RNA_def_function(srna, "new", "rna_NodeTree_node_texture_new"); 02490 RNA_def_function_ui_description(func, "Add a node to this node tree."); 02491 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); 02492 parm= RNA_def_enum(func, "type", texture_node_type_items, 0, "Type", "Type of node to add"); 02493 RNA_def_property_flag(parm, PROP_REQUIRED); 02494 RNA_def_pointer(func, "group", "NodeTree", "", "The group tree"); 02495 /* return value */ 02496 parm= RNA_def_pointer(func, "node", "Node", "", "New node."); 02497 RNA_def_function_return(func, parm); 02498 02499 func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove"); 02500 RNA_def_function_ui_description(func, "remove a node from this node tree."); 02501 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02502 parm= RNA_def_pointer(func, "node", "Node", "", "The node to remove."); 02503 RNA_def_property_flag(parm, PROP_REQUIRED); 02504 } 02505 02506 static void rna_def_node_socket(BlenderRNA *brna) 02507 { 02508 StructRNA *srna; 02509 PropertyRNA *prop; 02510 02511 srna = RNA_def_struct(brna, "NodeSocket", NULL); 02512 RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node"); 02513 RNA_def_struct_refine_func(srna, "rna_NodeSocketType_refine"); 02514 RNA_def_struct_sdna(srna, "bNodeSocket"); 02515 RNA_def_struct_ui_icon(srna, ICON_PLUG); 02516 RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); 02517 02518 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 02519 /* XXX must be editable for group sockets. if necessary use a special rna definition for these */ 02520 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02521 RNA_def_property_ui_text(prop, "Name", "Socket name"); 02522 RNA_def_struct_name_property(srna, prop); 02523 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroupSocket_update"); 02524 02525 /* can add back if there is any use in reading them */ 02526 #if 0 02527 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE); 02528 RNA_def_property_float_sdna(prop, NULL, "ns.min"); 02529 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02530 RNA_def_property_ui_text(prop, "Minimum Value", ""); 02531 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); 02532 02533 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE); 02534 RNA_def_property_float_sdna(prop, NULL, "ns.max"); 02535 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02536 RNA_def_property_ui_text(prop, "Maximum Value", ""); 02537 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); 02538 #endif 02539 02540 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 02541 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02542 RNA_def_property_enum_items(prop, node_socket_type_items); 02543 RNA_def_property_ui_text(prop, "Type", "Node Socket type"); 02544 } 02545 02546 static void rna_def_node_socket_value(BlenderRNA *brna) 02547 { 02548 StructRNA *srna; 02549 PropertyRNA *prop; 02550 02551 srna = RNA_def_struct(brna, "ValueNodeSocket", "NodeSocket"); 02552 RNA_def_struct_ui_text(srna, "Value Node Socket", "Input or output socket of a node"); 02553 RNA_def_struct_sdna(srna, "bNodeSocket"); 02554 RNA_def_struct_ui_icon(srna, ICON_PLUG); 02555 RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); 02556 02557 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE); 02558 RNA_def_property_float_sdna(prop, NULL, "ns.vec"); 02559 RNA_def_property_array(prop, 1); 02560 RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached"); 02561 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); 02562 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range"); 02563 } 02564 02565 static void rna_def_node_socket_vector(BlenderRNA *brna) 02566 { 02567 StructRNA *srna; 02568 PropertyRNA *prop; 02569 02570 srna = RNA_def_struct(brna, "VectorNodeSocket", "NodeSocket"); 02571 RNA_def_struct_ui_text(srna, "Vector Node Socket", "Input or output socket of a node"); 02572 RNA_def_struct_sdna(srna, "bNodeSocket"); 02573 RNA_def_struct_ui_icon(srna, ICON_PLUG); 02574 RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); 02575 02576 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_XYZ); 02577 RNA_def_property_float_sdna(prop, NULL, "ns.vec"); 02578 RNA_def_property_array(prop, 3); 02579 RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached"); 02580 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); 02581 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range"); 02582 } 02583 02584 static void rna_def_node_socket_rgba(BlenderRNA *brna) 02585 { 02586 StructRNA *srna; 02587 PropertyRNA *prop; 02588 02589 srna = RNA_def_struct(brna, "RGBANodeSocket", "NodeSocket"); 02590 RNA_def_struct_ui_text(srna, "RGBA Node Socket", "Input or output socket of a node"); 02591 RNA_def_struct_sdna(srna, "bNodeSocket"); 02592 RNA_def_struct_ui_icon(srna, ICON_PLUG); 02593 RNA_def_struct_path_func(srna, "rna_NodeSocket_path"); 02594 02595 prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR); 02596 RNA_def_property_float_sdna(prop, NULL, "ns.vec"); 02597 RNA_def_property_array(prop, 4); 02598 RNA_def_property_ui_text(prop, "Default Value", "Default value of the socket when no link is attached"); 02599 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update"); 02600 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocket_defvalue_range"); 02601 } 02602 02603 static void rna_def_node(BlenderRNA *brna) 02604 { 02605 StructRNA *srna; 02606 PropertyRNA *prop; 02607 02608 srna = RNA_def_struct(brna, "Node", NULL); 02609 RNA_def_struct_ui_text(srna, "Node", "Node in a node tree"); 02610 RNA_def_struct_sdna(srna, "bNode"); 02611 RNA_def_struct_ui_icon(srna, ICON_NODE); 02612 RNA_def_struct_refine_func(srna, "rna_Node_refine"); 02613 RNA_def_struct_path_func(srna, "rna_Node_path"); 02614 02615 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ); 02616 RNA_def_property_float_sdna(prop, NULL, "locx"); 02617 RNA_def_property_array(prop, 2); 02618 RNA_def_property_range(prop, -10000.0f, 10000.0f); 02619 RNA_def_property_ui_text(prop, "Location", ""); 02620 RNA_def_property_update(prop, NC_NODE, "rna_Node_update"); 02621 02622 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 02623 RNA_def_property_ui_text(prop, "Name", "Unique node identifier"); 02624 RNA_def_struct_name_property(srna, prop); 02625 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set"); 02626 RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 02627 02628 prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); 02629 RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); 02630 RNA_def_property_struct_type(prop, "NodeSocket"); 02631 RNA_def_property_ui_text(prop, "Inputs", ""); 02632 02633 prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE); 02634 RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL); 02635 RNA_def_property_struct_type(prop, "NodeSocket"); 02636 RNA_def_property_ui_text(prop, "Outputs", ""); 02637 02638 prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE); 02639 RNA_def_property_string_sdna(prop, NULL, "label"); 02640 RNA_def_property_ui_text(prop, "Label", "Optional custom node label"); 02641 RNA_def_property_update(prop, NC_NODE, "rna_Node_update"); 02642 } 02643 02644 static void rna_def_node_link(BlenderRNA *brna) 02645 { 02646 StructRNA *srna; 02647 PropertyRNA *prop; 02648 02649 srna = RNA_def_struct(brna, "NodeLink", NULL); 02650 RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree"); 02651 RNA_def_struct_sdna(srna, "bNodeLink"); 02652 RNA_def_struct_ui_icon(srna, ICON_NODE); 02653 02654 prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE); 02655 RNA_def_property_pointer_sdna(prop, NULL, "fromnode"); 02656 RNA_def_property_struct_type(prop, "Node"); 02657 RNA_def_property_ui_text(prop, "From node", ""); 02658 02659 prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE); 02660 RNA_def_property_pointer_sdna(prop, NULL, "tonode"); 02661 RNA_def_property_struct_type(prop, "Node"); 02662 RNA_def_property_ui_text(prop, "To node", ""); 02663 02664 prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE); 02665 RNA_def_property_pointer_sdna(prop, NULL, "fromsock"); 02666 RNA_def_property_struct_type(prop, "NodeSocket"); 02667 RNA_def_property_ui_text(prop, "From socket", ""); 02668 02669 prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE); 02670 RNA_def_property_pointer_sdna(prop, NULL, "tosock"); 02671 RNA_def_property_struct_type(prop, "NodeSocket"); 02672 RNA_def_property_ui_text(prop, "To socket", ""); 02673 } 02674 02675 static void rna_def_group_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out) 02676 { 02677 StructRNA *srna; 02678 PropertyRNA *parm; 02679 FunctionRNA *func; 02680 02681 RNA_def_property_srna(cprop, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs")); 02682 srna= RNA_def_struct(brna, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"), NULL); 02683 RNA_def_struct_sdna(srna, "bNodeTree"); 02684 RNA_def_struct_ui_text(srna, "Group Sockets", "Collection of group sockets"); 02685 02686 func= RNA_def_function(srna, "new", (in_out==SOCK_IN ? "rna_NodeTree_input_new" : "rna_NodeTree_output_new")); 02687 RNA_def_function_ui_description(func, "Add a socket to the group tree."); 02688 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02689 RNA_def_string(func, "name", "Socket", 32, "Name", "Name of the socket"); 02690 RNA_def_enum(func, "type", node_socket_type_items, SOCK_VALUE, "Type", "Type of socket"); 02691 /* return value */ 02692 parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket."); 02693 RNA_def_function_return(func, parm); 02694 02695 func= RNA_def_function(srna, "expose", (in_out==SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose")); 02696 RNA_def_function_ui_description(func, "Expose an internal socket in the group tree."); 02697 RNA_def_function_flag(func, FUNC_USE_REPORTS); 02698 RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "Internal node socket to expose"); 02699 RNA_def_property_flag(parm, PROP_REQUIRED); 02700 RNA_def_boolean(func, "add_link", TRUE, "Add Link", "If TRUE, adds a link to the internal socket"); 02701 /* return value */ 02702 parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket."); 02703 RNA_def_function_return(func, parm); 02704 } 02705 02706 static void rna_def_nodetree(BlenderRNA *brna) 02707 { 02708 StructRNA *srna; 02709 PropertyRNA *prop; 02710 02711 static EnumPropertyItem nodetree_type_items[] = { 02712 {NTREE_SHADER, "SHADER", 0, "Shader", ""}, 02713 {NTREE_COMPOSIT, "COMPOSITE", 0, "Composite", ""}, 02714 {NTREE_TEXTURE, "TEXTURE", 0, "Texture", ""}, 02715 {0, NULL, 0, NULL, NULL}}; 02716 02717 srna = RNA_def_struct(brna, "NodeTree", "ID"); 02718 RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for materials, textures and compositing"); 02719 RNA_def_struct_sdna(srna, "bNodeTree"); 02720 RNA_def_struct_ui_icon(srna, ICON_NODETREE); 02721 RNA_def_struct_refine_func(srna, "rna_NodeTree_refine"); 02722 02723 /* AnimData */ 02724 rna_def_animdata_common(srna); 02725 02726 /* NodeLinks Collection */ 02727 prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE); 02728 RNA_def_property_collection_sdna(prop, NULL, "links", NULL); 02729 RNA_def_property_struct_type(prop, "NodeLink"); 02730 RNA_def_property_ui_text(prop, "Links", ""); 02731 rna_def_nodetree_link_api(brna, prop); 02732 02733 /* Grease Pencil */ 02734 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); 02735 RNA_def_property_pointer_sdna(prop, NULL, "gpd"); 02736 RNA_def_property_flag(prop, PROP_EDITABLE); 02737 RNA_def_property_struct_type(prop, "GreasePencil"); 02738 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock"); 02739 02740 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 02741 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 02742 RNA_def_property_enum_items(prop, nodetree_type_items); 02743 RNA_def_property_ui_text(prop, "Type", "Node Tree type"); 02744 02745 /* group sockets */ 02746 prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); 02747 RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); 02748 RNA_def_property_struct_type(prop, "NodeSocket"); 02749 RNA_def_property_ui_text(prop, "Inputs", ""); 02750 rna_def_group_sockets_api(brna, prop, SOCK_IN); 02751 02752 prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE); 02753 RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL); 02754 RNA_def_property_struct_type(prop, "NodeSocket"); 02755 RNA_def_property_ui_text(prop, "Outputs", ""); 02756 rna_def_group_sockets_api(brna, prop, SOCK_OUT); 02757 } 02758 02759 static void rna_def_composite_nodetree(BlenderRNA *brna) 02760 { 02761 StructRNA *srna; 02762 PropertyRNA *prop; 02763 02764 srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree"); 02765 RNA_def_struct_ui_text(srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing"); 02766 RNA_def_struct_sdna(srna, "bNodeTree"); 02767 RNA_def_struct_ui_icon(srna, ICON_NODETREE); 02768 02769 /* Nodes Collection */ 02770 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE); 02771 RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL); 02772 RNA_def_property_struct_type(prop, "Node"); 02773 RNA_def_property_ui_text(prop, "Nodes", ""); 02774 02775 rna_def_composite_nodetree_api(brna, prop); 02776 } 02777 02778 static void rna_def_shader_nodetree(BlenderRNA *brna) 02779 { 02780 StructRNA *srna; 02781 PropertyRNA *prop; 02782 02783 srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree"); 02784 RNA_def_struct_ui_text(srna, "Shader Node Tree", "Node tree consisting of linked nodes used for materials"); 02785 RNA_def_struct_sdna(srna, "bNodeTree"); 02786 RNA_def_struct_ui_icon(srna, ICON_NODETREE); 02787 02788 /* Nodes Collection */ 02789 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE); 02790 RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL); 02791 RNA_def_property_struct_type(prop, "Node"); 02792 RNA_def_property_ui_text(prop, "Nodes", ""); 02793 02794 rna_def_shader_nodetree_api(brna, prop); 02795 } 02796 02797 static void rna_def_texture_nodetree(BlenderRNA *brna) 02798 { 02799 StructRNA *srna; 02800 PropertyRNA *prop; 02801 02802 srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree"); 02803 RNA_def_struct_ui_text(srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures"); 02804 RNA_def_struct_sdna(srna, "bNodeTree"); 02805 RNA_def_struct_ui_icon(srna, ICON_NODETREE); 02806 02807 /* Nodes Collection */ 02808 prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE); 02809 RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL); 02810 RNA_def_property_struct_type(prop, "Node"); 02811 RNA_def_property_ui_text(prop, "Nodes", ""); 02812 02813 rna_def_texture_nodetree_api(brna, prop); 02814 } 02815 02816 static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRNA*)) 02817 { 02818 StructRNA *srna = def_node(brna, id); 02819 02820 if(func) 02821 func(srna); 02822 } 02823 02824 void RNA_def_nodetree(BlenderRNA *brna) 02825 { 02826 init(); 02827 rna_def_nodetree(brna); 02828 rna_def_node_socket(brna); 02829 rna_def_node_socket_value(brna); 02830 rna_def_node_socket_vector(brna); 02831 rna_def_node_socket_rgba(brna); 02832 rna_def_node(brna); 02833 rna_def_node_link(brna); 02834 rna_def_shader_node(brna); 02835 rna_def_compositor_node(brna); 02836 rna_def_texture_node(brna); 02837 rna_def_composite_nodetree(brna); 02838 rna_def_shader_nodetree(brna); 02839 rna_def_texture_nodetree(brna); 02840 #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ 02841 define_specific_node(brna, ID, DefFunc); 02842 02843 #include "rna_nodetree_types.h" 02844 02845 #undef DefNode 02846 02847 define_specific_node(brna, NODE_GROUP, def_group); 02848 } 02849 02850 #endif 02851