diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 363 |
1 files changed, 309 insertions, 54 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 99ae1b85e0c..cbd677582a9 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -37,6 +37,7 @@ #include "BKE_animsys.h" #include "BKE_attribute.h" +#include "BKE_cryptomatte.h" #include "BKE_image.h" #include "BKE_node.h" #include "BKE_texture.h" @@ -85,6 +86,7 @@ static const EnumPropertyItem node_socket_type_items[] = { {SOCK_OBJECT, "OBJECT", 0, "Object", ""}, {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""}, + {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -98,6 +100,7 @@ static const EnumPropertyItem node_socket_data_type_items[] = { {SOCK_OBJECT, "OBJECT", 0, "Object", ""}, {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""}, + {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -272,32 +275,32 @@ const EnumPropertyItem rna_enum_node_float_compare_items[] = { {NODE_FLOAT_COMPARE_LESS_THAN, "LESS_THAN", 0, - "A < B", + "Less Than", "True when the first input is smaller than second input"}, {NODE_FLOAT_COMPARE_LESS_EQUAL, "LESS_EQUAL", 0, - "A <= B", + "Less Than or Equal", "True when the first input is smaller than the second input or equal"}, {NODE_FLOAT_COMPARE_GREATER_THAN, "GREATER_THAN", 0, - "A > B", + "Greater Than", "True when the first input is greater than the second input"}, {NODE_FLOAT_COMPARE_GREATER_EQUAL, "GREATER_EQUAL", 0, - "A >= B", + "Greater Than or Equal", "True when the first input is greater than the second input or equal"}, {NODE_FLOAT_COMPARE_EQUAL, "EQUAL", 0, - "A = B", + "Equal", "True when both inputs are approximately equal"}, {NODE_FLOAT_COMPARE_NOT_EQUAL, "NOT_EQUAL", 0, - "A != B", + "Not Equal", "True when both inputs are not approximately equal"}, {0, NULL, 0, NULL, NULL}, }; @@ -423,15 +426,65 @@ static const EnumPropertyItem rna_node_geometry_triangulate_ngon_method_items[] {0, NULL, 0, NULL, NULL}, }; -static const EnumPropertyItem rna_node_geometry_attribute_input_a_items[] = { - {0, "FLOAT", 0, "Float", ""}, - {GEO_NODE_USE_ATTRIBUTE_A, "ATTRIBUTE", 0, "Attribute", ""}, +# define ITEM_ATTRIBUTE \ + { \ + GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE, "ATTRIBUTE", 0, "Attribute", "" \ + } +# define ITEM_FLOAT \ + { \ + GEO_NODE_ATTRIBUTE_INPUT_FLOAT, "FLOAT", 0, "Float", "" \ + } +# define ITEM_VECTOR \ + { \ + GEO_NODE_ATTRIBUTE_INPUT_VECTOR, "VECTOR", 0, "Vector", "" \ + } +# define ITEM_COLOR \ + { \ + GEO_NODE_ATTRIBUTE_INPUT_COLOR, "COLOR", 0, "Color", "" \ + } +# define ITEM_BOOLEAN \ + { \ + GEO_NODE_ATTRIBUTE_INPUT_BOOLEAN, "BOOLEAN", 0, "Boolean", "" \ + } + +static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_float[] = { + ITEM_ATTRIBUTE, + ITEM_FLOAT, {0, NULL, 0, NULL, NULL}, }; +static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_boolean[] = { + ITEM_ATTRIBUTE, + ITEM_FLOAT, + ITEM_VECTOR, + ITEM_COLOR, + {0, NULL, 0, NULL, NULL}, +}; +static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_any[] = { + ITEM_ATTRIBUTE, + ITEM_FLOAT, + ITEM_VECTOR, + ITEM_COLOR, + ITEM_BOOLEAN, + {0, NULL, 0, NULL, NULL}, +}; + +# undef ITEM_ATTRIBUTE +# undef ITEM_FLOAT +# undef ITEM_VECTOR +# undef ITEM_COLOR +# undef ITEM_BOOLEAN -static const EnumPropertyItem rna_node_geometry_attribute_input_b_items[] = { - {0, "FLOAT", 0, "Float", ""}, - {GEO_NODE_USE_ATTRIBUTE_B, "ATTRIBUTE", 0, "Attribute", ""}, +static const EnumPropertyItem rna_node_geometry_point_distribute_method_items[] = { + {GEO_NODE_POINT_DISTRIBUTE_RANDOM, + "RANDOM", + 0, + "Random", + "Distribute points randomly on the surface"}, + {GEO_NODE_POINT_DISTRIBUTE_POISSON, + "POISSON", + 0, + "Poisson Disk", + "Project points on the surface evenly with a Poisson disk distribution"}, {0, NULL, 0, NULL, NULL}, }; @@ -1457,7 +1510,7 @@ static char *rna_Node_path(PointerRNA *ptr) bNode *node = (bNode *)ptr->data; char name_esc[sizeof(node->name) * 2]; - BLI_strescape(name_esc, node->name, sizeof(name_esc)); + BLI_str_escape(name_esc, node->name, sizeof(name_esc)); return BLI_sprintfN("nodes[\"%s\"]", name_esc); } @@ -1484,7 +1537,7 @@ char *rna_Node_ImageUser_path(PointerRNA *ptr) continue; } - BLI_strescape(name_esc, node->name, sizeof(name_esc)); + BLI_str_escape(name_esc, node->name, sizeof(name_esc)); return BLI_sprintfN("nodes[\"%s\"].image_user", name_esc); } @@ -1859,7 +1912,7 @@ static const EnumPropertyItem *itemf_function_check( static bool attribute_random_type_supported(const EnumPropertyItem *item) { - return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3); + return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL); } static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_type_itemf( bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) @@ -1879,6 +1932,30 @@ static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_domain_itemf( return itemf_function_check(rna_enum_attribute_domain_items, attribute_random_domain_supported); } +static bool attribute_fill_type_supported(const EnumPropertyItem *item) +{ + return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_COLOR, CD_PROP_BOOL); +} +static const EnumPropertyItem *rna_GeometryNodeAttributeFill_type_itemf(bContext *UNUSED(C), + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *r_free) +{ + *r_free = true; + return itemf_function_check(rna_enum_attribute_type_items, attribute_fill_type_supported); +} + +static bool attribute_fill_domain_supported(const EnumPropertyItem *item) +{ + return item->value == ATTR_DOMAIN_POINT; +} +static const EnumPropertyItem *rna_GeometryNodeAttributeFill_domain_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + *r_free = true; + return itemf_function_check(rna_enum_attribute_domain_items, attribute_fill_domain_supported); +} + static bool attribute_math_operation_supported(const EnumPropertyItem *item) { return ELEM(item->value, @@ -2463,7 +2540,7 @@ static char *rna_NodeSocket_path(PointerRNA *ptr) return NULL; } - BLI_strescape(name_esc, node->name, sizeof(name_esc)); + BLI_str_escape(name_esc, node->name, sizeof(name_esc)); if (sock->in_out == SOCK_IN) { return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", name_esc, socketindex); @@ -3586,33 +3663,26 @@ static void rna_NodeCryptomatte_matte_get(PointerRNA *ptr, char *value) { bNode *node = (bNode *)ptr->data; NodeCryptomatte *nc = node->storage; - - strcpy(value, (nc->matte_id) ? nc->matte_id : ""); + char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc); + strcpy(value, matte_id); + MEM_freeN(matte_id); } static int rna_NodeCryptomatte_matte_length(PointerRNA *ptr) { bNode *node = (bNode *)ptr->data; NodeCryptomatte *nc = node->storage; - - return (nc->matte_id) ? strlen(nc->matte_id) : 0; + char *matte_id = BKE_cryptomatte_entries_to_matte_id(nc); + int result = strlen(matte_id); + MEM_freeN(matte_id); + return result; } static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value) { bNode *node = (bNode *)ptr->data; NodeCryptomatte *nc = node->storage; - - if (nc->matte_id) { - MEM_freeN(nc->matte_id); - } - - if (value && value[0]) { - nc->matte_id = BLI_strdup(value); - } - else { - nc->matte_id = NULL; - } + BKE_cryptomatte_matte_id_to_entries(NULL, nc, value); } static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -4268,7 +4338,7 @@ static void def_math(StructRNA *srna) prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MATH_CLAMP); - RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range"); + RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -4387,7 +4457,7 @@ static void def_mix_rgb(StructRNA *srna) prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MIXRGB_CLAMP); - RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range"); + RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -4410,6 +4480,19 @@ static void def_texture(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_fn_input_vector(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeInputVector", "storage"); + + prop = RNA_def_property(srna, "vector", PROP_FLOAT, PROP_XYZ); + RNA_def_property_array(prop, 3); + RNA_def_property_float_sdna(prop, NULL, "vector"); + RNA_def_property_ui_text(prop, "Vector", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + /* -- Shader Nodes ---------------------------------------------------------- */ static void def_sh_output(StructRNA *srna) @@ -5139,12 +5222,12 @@ static void def_sh_tex_pointdensity(StructRNA *srna) "PARTICLE_AGE", 0, "Particle Age", - "Lifetime mapped as 0.0 - 1.0 intensity"}, + "Lifetime mapped as 0.0 to 1.0 intensity"}, {SHD_POINTDENSITY_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", - "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"}, + "Particle speed (absolute magnitude of velocity) mapped as 0.0 to 1.0 intensity"}, {SHD_POINTDENSITY_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, @@ -5728,7 +5811,7 @@ static void def_cmp_alpha_over(StructRNA *srna) /* XXX: Tooltip */ prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); - RNA_def_property_ui_text(prop, "Convert Premul", ""); + RNA_def_property_ui_text(prop, "Convert Premultiplied", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage"); @@ -5736,7 +5819,7 @@ static void def_cmp_alpha_over(StructRNA *srna) prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "x"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Premul", "Mix Factor"); + RNA_def_property_ui_text(prop, "Premultiplied", "Mix Factor"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -5899,7 +5982,7 @@ static void def_cmp_map_range(StructRNA *srna) prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); - RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range"); + RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0.0 to 1.0 range"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -6552,7 +6635,7 @@ static void def_cmp_brightcontrast(StructRNA *srna) prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1); - RNA_def_property_ui_text(prop, "Convert Premul", "Keep output image premultiplied alpha"); + RNA_def_property_ui_text(prop, "Convert Premultiplied", "Keep output image premultiplied alpha"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -6612,7 +6695,7 @@ static void def_cmp_channel_matte(StructRNA *srna) static const EnumPropertyItem algorithm_items[] = { {0, "SINGLE", 0, "Single", "Limit by single channel"}, - {1, "MAX", 0, "Max", "Limit by max of other channels"}, + {1, "MAX", 0, "Max", "Limit by maximum of other channels"}, {0, NULL, 0, NULL, NULL}, }; @@ -6799,8 +6882,8 @@ static void def_cmp_defocus(StructRNA *srna) RNA_def_property_range(prop, 0.0f, 128.0f); RNA_def_property_ui_text( prop, - "F-stop", - "Amount of focal blur, 128=infinity=perfect focus, half the value doubles " + "F-Stop", + "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles " "the blur radius"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); @@ -6816,7 +6899,7 @@ static void def_cmp_defocus(StructRNA *srna) RNA_def_property_ui_text( prop, "Threshold", - "CoC radius threshold, prevents background bleed on in-focus midground, 0=off"); + "CoC radius threshold, prevents background bleed on in-focus midground, 0 is disabled"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE); @@ -7007,8 +7090,8 @@ static void def_cmp_premul_key(StructRNA *srna) PropertyRNA *prop; static const EnumPropertyItem type_items[] = { - {0, "STRAIGHT_TO_PREMUL", 0, "Straight to Premul", ""}, - {1, "PREMUL_TO_STRAIGHT", 0, "Premul to Straight", ""}, + {0, "STRAIGHT_TO_PREMUL", 0, "To Premultiplied", "Convert straight to premultiplied"}, + {1, "PREMUL_TO_STRAIGHT", 0, "To Straight", "Convert premultiplied to straight"}, {0, NULL, 0, NULL, NULL}, }; @@ -7602,8 +7685,8 @@ static void def_cmp_bokehblur(StructRNA *srna) RNA_def_property_range(prop, 0.0f, 128.0f); RNA_def_property_ui_text( prop, - "F-stop", - "Amount of focal blur, 128=infinity=perfect focus, half the value doubles " + "F-Stop", + "Amount of focal blur, 128 (infinity) is perfect focus, half the value doubles " "the blur radius"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); # endif @@ -8154,7 +8237,7 @@ static void def_cmp_sunbeams(StructRNA *srna) RNA_def_property_range(prop, -100.0f, 100.0f); RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3); RNA_def_property_ui_text( - prop, "Source", "Source point of rays as a factor of the image width & height"); + prop, "Source", "Source point of rays as a factor of the image width and height"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED); @@ -8165,6 +8248,24 @@ static void def_cmp_sunbeams(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_cmp_cryptomatte_entry(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "CryptomatteEntry", NULL); + RNA_def_struct_sdna(srna, "CryptomatteEntry"); + + prop = RNA_def_property(srna, "encoded_hash", PROP_FLOAT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_sdna(prop, NULL, "encoded_hash"); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_struct_name_property(srna, prop); +} + static void def_cmp_cryptomatte(StructRNA *srna) { PropertyRNA *prop; @@ -8336,19 +8437,28 @@ static void def_geo_attribute_create_common(StructRNA *srna, RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } -static void def_geo_random_attribute(StructRNA *srna) +static void def_geo_attribute_randomize(StructRNA *srna) { def_geo_attribute_create_common(srna, "rna_GeometryNodeAttributeRandom_type_itemf", "rna_GeometryNodeAttributeRandom_domain_itemf"); } +static void def_geo_attribute_fill(StructRNA *srna) +{ + def_geo_attribute_create_common(srna, + "rna_GeometryNodeAttributeFill_type_itemf", + "rna_GeometryNodeAttributeFill_domain_itemf"); +} + static void def_geo_attribute_math(StructRNA *srna) { PropertyRNA *prop; + RNA_def_struct_sdna_from(srna, "NodeAttributeMath", "storage"); + prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_sdna(prop, NULL, "operation"); RNA_def_property_enum_items(prop, rna_enum_node_math_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeMath_operation_itemf"); RNA_def_property_enum_default(prop, NODE_MATH_ADD); @@ -8356,18 +8466,124 @@ static void def_geo_attribute_math(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom2"); - RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_a_items); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_a"); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); RNA_def_property_ui_text(prop, "Input Type A", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom2"); - RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_b_items); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "input_type_b"); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); + RNA_def_property_ui_text(prop, "Input Type B", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + +static void def_geo_point_instance(StructRNA *srna) +{ + static const EnumPropertyItem instance_type_items[] = { + {GEO_NODE_POINT_INSTANCE_TYPE_OBJECT, + "OBJECT", + ICON_NONE, + "Object", + "Instance an individual object on all points"}, + {GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION, + "COLLECTION", + ICON_NONE, + "Collection", + "Instance an entire collection on all points"}, + {0, NULL, 0, NULL, NULL}, + }; + + PropertyRNA *prop; + + prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, instance_type_items); + RNA_def_property_enum_default(prop, GEO_NODE_POINT_INSTANCE_TYPE_OBJECT); + RNA_def_property_ui_text(prop, "Instance Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1); + RNA_def_property_ui_text(prop, "Whole Collection", "Instance entire collection on each point"); + RNA_def_property_update(prop, 0, "rna_Node_socket_update"); +} + +static void def_geo_attribute_mix(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeMix", "storage"); + + prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_ramp_blend_items); + RNA_def_property_enum_default(prop, MA_RAMP_BLEND); + RNA_def_property_ui_text(prop, "Blending Mode", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "input_type_factor", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); + RNA_def_property_ui_text(prop, "Input Type Factor", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_no_boolean); + RNA_def_property_ui_text(prop, "Input Type A", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_no_boolean); + RNA_def_property_ui_text(prop, "Input Type B", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + +static void def_geo_attribute_attribute_compare(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeCompare", "storage"); + + prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_node_float_compare_items); + RNA_def_property_enum_default(prop, NODE_MATH_ADD); + RNA_def_property_ui_text(prop, "Operation", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_any); + RNA_def_property_ui_text(prop, "Input Type A", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_any); RNA_def_property_ui_text(prop, "Input Type B", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } +static void def_geo_point_distribute(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "distribute_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, rna_node_geometry_point_distribute_method_items); + RNA_def_property_enum_default(prop, GEO_NODE_POINT_DISTRIBUTE_RANDOM); + RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + +static void def_geo_attribute_color_ramp(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeColorRamp", "storage"); + + prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ColorRamp"); + RNA_def_property_ui_text(prop, "Color Ramp", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + /* -------------------------------------------------------------------------- */ static void rna_def_shader_node(BlenderRNA *brna) @@ -8393,6 +8609,8 @@ static void rna_def_compositor_node(BlenderRNA *brna) /* compositor node need_exec flag */ func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec"); RNA_def_function_ui_description(func, "Tag the node for compositor update"); + + def_cmp_cryptomatte_entry(brna); } static void rna_def_texture_node(BlenderRNA *brna) @@ -9074,6 +9292,41 @@ static void rna_def_node_socket_geometry(BlenderRNA *brna, RNA_def_struct_sdna(srna, "bNodeSocket"); } +static void rna_def_node_socket_collection(BlenderRNA *brna, + const char *identifier, + const char *interface_idname) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, identifier, "NodeSocketStandard"); + RNA_def_struct_ui_text(srna, "Collection Node Socket", "Collection socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + + RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "default_value"); + + prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "value"); + RNA_def_property_struct_type(prop, "Collection"); + RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket"); + RNA_def_property_update( + prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_CONTEXT_UPDATE); + + /* socket interface */ + srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard"); + RNA_def_struct_ui_text(srna, "Collection Node Socket Interface", "Collection socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + + RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "default_value"); + + prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "value"); + RNA_def_property_struct_type(prop, "Collection"); + RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); +} + static void rna_def_node_socket_standard_types(BlenderRNA *brna) { /* XXX Workaround: Registered functions are not exposed in python by bpy, @@ -9214,6 +9467,8 @@ static void rna_def_node_socket_standard_types(BlenderRNA *brna) rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage"); rna_def_node_socket_geometry(brna, "NodeSocketGeometry", "NodeSocketInterfaceGeometry"); + + rna_def_node_socket_collection(brna, "NodeSocketCollection", "NodeSocketInterfaceCollection"); } static void rna_def_internal_node(BlenderRNA *brna) |