Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_nodetree.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | const EnumPropertyItem rna_enum_node_filter_items[] = { | ||||
| {2, "LAPLACE", 0, "Laplace", ""}, | {2, "LAPLACE", 0, "Laplace", ""}, | ||||
| {3, "SOBEL", 0, "Sobel", ""}, | {3, "SOBEL", 0, "Sobel", ""}, | ||||
| {4, "PREWITT", 0, "Prewitt", ""}, | {4, "PREWITT", 0, "Prewitt", ""}, | ||||
| {5, "KIRSCH", 0, "Kirsch", ""}, | {5, "KIRSCH", 0, "Kirsch", ""}, | ||||
| {6, "SHADOW", 0, "Shadow", ""}, | {6, "SHADOW", 0, "Shadow", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| static const EnumPropertyItem rna_node_geometry_attribute_randomize_operation_items[] = { | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE, | |||||
| "REPLACE_CREATE", | |||||
| ICON_NONE, | |||||
| "Replace/Create", | |||||
| "Replace the value and data type of an existing attribute, or create a new one"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_ADD, | |||||
| "ADD", | |||||
| ICON_NONE, | |||||
| "Add", | |||||
| "Add the random values to the existing attribute values"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_SUBTRACT, | |||||
| "SUBTRACT", | |||||
| ICON_NONE, | |||||
| "Subtract", | |||||
| "Subtract random values from the existing attribute values"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_MULTIPLY, | |||||
| "MULTIPLY", | |||||
| ICON_NONE, | |||||
| "Multiply", | |||||
| "Multiply the existing attribute values with the random values"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_DIVIDE, | |||||
| "DIVIDE", | |||||
| ICON_NONE, | |||||
| "Divide", | |||||
| "Divide the existing attribute values by the random values"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_DIFFERENCE, | |||||
| "DIFFERENCE", | |||||
| ICON_NONE, | |||||
| "Difference", | |||||
| "Subtract the existing attribute values from the random values"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_AVERAGE, | |||||
| "AVERAGE", | |||||
| ICON_NONE, | |||||
| "Average", | |||||
| "Use the mean of the existing and generated values"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_BOOL_AND, | |||||
| "BOOLEAN_AND", | |||||
| ICON_NONE, | |||||
| "Boolean And", | |||||
| "True if both the existing and the generated values are true"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_BOOL_OR, | |||||
| "BOOLEAN_OR", | |||||
| ICON_NONE, | |||||
| "Boolean Or", | |||||
| "True if either the existing or the generated value is true"}, | |||||
| {GEO_NODE_ATTRIBUTE_RANDOMIZE_BOOL_XOR, | |||||
| "BOOLEAN_XOR", | |||||
| ICON_NONE, | |||||
| "Boolean Exlusive Or", | |||||
| "True if only one of the existing or generated values is true"}, | |||||
JacquesLucke: Interesting, this was my first ASAN crash at compile time :D
The `{0, NULL, 0, NULL, NULL}`… | |||||
HooglyBooglyAuthorUnsubmitted Done Inline ActionsInteresting, worked for me somehow! Thanks. HooglyBoogly: Interesting, worked for me somehow! Thanks. | |||||
| }; | |||||
| #ifndef RNA_RUNTIME | #ifndef RNA_RUNTIME | ||||
| static const EnumPropertyItem node_sampler_type_items[] = { | static const EnumPropertyItem node_sampler_type_items[] = { | ||||
| {0, "NEAREST", 0, "Nearest", ""}, | {0, "NEAREST", 0, "Nearest", ""}, | ||||
| {1, "BILINEAR", 0, "Bilinear", ""}, | {1, "BILINEAR", 0, "Bilinear", ""}, | ||||
| {2, "BICUBIC", 0, "Bicubic", ""}, | {2, "BICUBIC", 0, "Bicubic", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 1,550 Lines • ▼ Show 20 Lines | static const EnumPropertyItem *itemf_function_check( | ||||
| } | } | ||||
| RNA_enum_item_end(&item_array, &items_len); | RNA_enum_item_end(&item_array, &items_len); | ||||
| return item_array; | return item_array; | ||||
| } | } | ||||
| static bool attribute_random_type_supported(const EnumPropertyItem *item) | static bool attribute_random_type_supported(const EnumPropertyItem *item) | ||||
| { | { | ||||
| return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL); | return ELEM( | ||||
| item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL, CD_PROP_INT32, CD_PROP_COLOR); | |||||
| } | } | ||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_type_itemf( | static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_type_itemf( | ||||
| bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | ||||
| { | { | ||||
| *r_free = true; | *r_free = true; | ||||
| return itemf_function_check(rna_enum_attribute_type_items, attribute_random_type_supported); | return itemf_function_check(rna_enum_attribute_type_items, attribute_random_type_supported); | ||||
| } | } | ||||
| static bool attribute_random_domain_supported(const EnumPropertyItem *item) | static bool attribute_randomize_is_bool_operation(const int operation) | ||||
| { | { | ||||
| return item->value == ATTR_DOMAIN_POINT; | return ELEM(operation, | ||||
| GEO_NODE_ATTRIBUTE_RANDOMIZE_BOOL_AND, | |||||
| GEO_NODE_ATTRIBUTE_RANDOMIZE_BOOL_OR, | |||||
| GEO_NODE_ATTRIBUTE_RANDOMIZE_BOOL_XOR); | |||||
| } | } | ||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeRandom_domain_itemf( | |||||
| bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | static const EnumPropertyItem *rna_GeometryNodeAttributeRandomize_operation_itemf( | ||||
| bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | |||||
| { | { | ||||
| bNode *node = ptr->data; | |||||
| const NodeAttributeRandomize *node_storage = (NodeAttributeRandomize *)node->storage; | |||||
| const CustomDataType data_type = (CustomDataType)node_storage->data_type; | |||||
| EnumPropertyItem *item_array = NULL; | |||||
| int items_len = 0; | |||||
| for (const EnumPropertyItem *item = rna_node_geometry_attribute_randomize_operation_items; | |||||
| item->identifier != NULL; | |||||
| item++) { | |||||
| if (data_type == CD_PROP_BOOL) { | |||||
| if (attribute_randomize_is_bool_operation(item->value)) { | |||||
| RNA_enum_item_add(&item_array, &items_len, item); | |||||
| } | |||||
| } | |||||
| else { | |||||
| if (!attribute_randomize_is_bool_operation(item->value)) { | |||||
| RNA_enum_item_add(&item_array, &items_len, item); | |||||
| } | |||||
| } | |||||
| } | |||||
| RNA_enum_item_end(&item_array, &items_len); | |||||
| *r_free = true; | *r_free = true; | ||||
| return itemf_function_check(rna_enum_attribute_domain_items, attribute_random_domain_supported); | return item_array; | ||||
| } | } | ||||
| static bool attribute_fill_type_supported(const EnumPropertyItem *item) | 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); | 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), | static const EnumPropertyItem *rna_GeometryNodeAttributeFill_type_itemf(bContext *UNUSED(C), | ||||
| PointerRNA *UNUSED(ptr), | PointerRNA *UNUSED(ptr), | ||||
| ▲ Show 20 Lines • Show All 6,573 Lines • ▼ Show 20 Lines | static void def_geo_attribute_create_common(StructRNA *srna, | ||||
| } | } | ||||
| RNA_def_property_enum_default(prop, ATTR_DOMAIN_POINT); | RNA_def_property_enum_default(prop, ATTR_DOMAIN_POINT); | ||||
| RNA_def_property_ui_text(prop, "Domain", ""); | RNA_def_property_ui_text(prop, "Domain", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| } | } | ||||
| static void def_geo_attribute_randomize(StructRNA *srna) | static void def_geo_attribute_randomize(StructRNA *srna) | ||||
| { | { | ||||
| def_geo_attribute_create_common(srna, | PropertyRNA *prop; | ||||
| "rna_GeometryNodeAttributeRandom_type_itemf", | |||||
| "rna_GeometryNodeAttributeRandom_domain_itemf"); | RNA_def_struct_sdna_from(srna, "NodeAttributeRandomize", "storage"); | ||||
| prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "data_type"); | |||||
| RNA_def_property_enum_items(prop, rna_enum_attribute_type_items); | |||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeRandom_type_itemf"); | |||||
| RNA_def_property_enum_default(prop, CD_PROP_FLOAT); | |||||
| RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in attribute"); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update"); | |||||
| prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "operation"); | |||||
| RNA_def_property_enum_items(prop, rna_node_geometry_attribute_randomize_operation_items); | |||||
| RNA_def_property_enum_funcs( | |||||
| prop, NULL, NULL, "rna_GeometryNodeAttributeRandomize_operation_itemf"); | |||||
| RNA_def_property_enum_default(prop, GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE); | |||||
| RNA_def_property_ui_text(prop, "Operation", ""); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | |||||
| } | } | ||||
| static void def_geo_attribute_fill(StructRNA *srna) | static void def_geo_attribute_fill(StructRNA *srna) | ||||
| { | { | ||||
| def_geo_attribute_create_common(srna, | def_geo_attribute_create_common(srna, | ||||
| "rna_GeometryNodeAttributeFill_type_itemf", | "rna_GeometryNodeAttributeFill_type_itemf", | ||||
| "rna_GeometryNodeAttributeFill_domain_itemf"); | "rna_GeometryNodeAttributeFill_domain_itemf"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,293 Lines • Show Last 20 Lines | |||||
Interesting, this was my first ASAN crash at compile time :D
The {0, NULL, 0, NULL, NULL} entry is missing.