Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_nodetree.c
| Context not available. | |||||
| 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 random_type_supported(const EnumPropertyItem *item) | |||||
| { | |||||
| return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL, CD_PROP_INT32); | |||||
| } | |||||
| static const EnumPropertyItem *rna_FunctionNodeRandom_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, random_type_supported); | |||||
| } | |||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeRandomize_operation_itemf( | static const EnumPropertyItem *rna_GeometryNodeAttributeRandomize_operation_itemf( | ||||
| bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | ||||
| { | { | ||||
| bNode *node = ptr->data; | bNode *node = ptr->data; | ||||
| const NodeAttributeRandomize *node_storage = (NodeAttributeRandomize *)node->storage; | const NodeLegacyAttributeRandomize *node_storage = (NodeLegacyAttributeRandomize *)node->storage; | ||||
| const CustomDataType data_type = (CustomDataType)node_storage->data_type; | const CustomDataType data_type = (CustomDataType)node_storage->data_type; | ||||
| EnumPropertyItem *item_array = NULL; | EnumPropertyItem *item_array = NULL; | ||||
| Context not available. | |||||
| PointerRNA *ptr) | PointerRNA *ptr) | ||||
| { | { | ||||
| bNode *node = ptr->data; | bNode *node = ptr->data; | ||||
| NodeAttributeRandomize *node_storage = (NodeAttributeRandomize *)node->storage; | NodeLegacyAttributeRandomize *node_storage = (NodeLegacyAttributeRandomize *)node->storage; | ||||
| /* The boolean data type has no extra operations besides, | /* The boolean data type has no extra operations besides, | ||||
| * replace, so make sure the enum value is set properly. */ | * replace, so make sure the enum value is set properly. */ | ||||
| Context not available. | |||||
| 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_fn_random(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeAttributeRandomize", "storage"); | RNA_def_struct_sdna_from(srna, "NodeRandom", "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_FunctionNodeRandom_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_Node_socket_update"); | |||||
| } | |||||
| static void def_geo_legacy_attribute_randomize(StructRNA *srna) | |||||
| { | |||||
| PropertyRNA *prop; | |||||
| RNA_def_struct_sdna_from(srna, "NodeLegacyAttributeRandomize", "storage"); | |||||
| prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "data_type"); | RNA_def_property_enum_sdna(prop, NULL, "data_type"); | ||||
| Context not available. | |||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeRandom_type_itemf"); | RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeRandom_type_itemf"); | ||||
| RNA_def_property_enum_default(prop, CD_PROP_FLOAT); | 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_ui_text(prop, "Data Type", "Type of data stored in attribute"); | ||||
| RNA_def_property_update( | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); | ||||
| prop, NC_NODE | NA_EDITED, "rna_GeometryNodeAttributeRandomize_data_type_update"); | |||||
| prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "operation"); | RNA_def_property_enum_sdna(prop, NULL, "operation"); | ||||
| Context not available. | |||||
| prop, NULL, NULL, "rna_GeometryNodeAttributeRandomize_operation_itemf"); | prop, NULL, NULL, "rna_GeometryNodeAttributeRandomize_operation_itemf"); | ||||
| RNA_def_property_enum_default(prop, GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE); | RNA_def_property_enum_default(prop, GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE); | ||||
| RNA_def_property_ui_text(prop, "Operation", ""); | RNA_def_property_ui_text(prop, "Operation", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNodeAttributeRandom_type_itemf"); | ||||
| } | } | ||||
| static void def_geo_attribute_fill(StructRNA *srna) | static void def_geo_attribute_fill(StructRNA *srna) | ||||
| Context not available. | |||||