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 298 Lines • ▼ Show 20 Lines | |||||
| const EnumPropertyItem rna_enum_node_boolean_math_items[] = { | const EnumPropertyItem rna_enum_node_boolean_math_items[] = { | ||||
| {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "Outputs true only when both inputs are true"}, | {NODE_BOOLEAN_MATH_AND, "AND", 0, "And", "Outputs true only when both inputs are true"}, | ||||
| {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "Outputs or when at least one of the inputs is true"}, | {NODE_BOOLEAN_MATH_OR, "OR", 0, "Or", "Outputs or when at least one of the inputs is true"}, | ||||
| {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Outputs the opposite of the input"}, | {NODE_BOOLEAN_MATH_NOT, "NOT", 0, "Not", "Outputs the opposite of the input"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| const EnumPropertyItem rna_enum_node_float_compare_items[] = { | const EnumPropertyItem rna_enum_node_float_compare_items[] = { | ||||
| {NODE_FLOAT_COMPARE_LESS_THAN, | {NODE_COMPARE_LESS_THAN, | ||||
| "LESS_THAN", | "LESS_THAN", | ||||
| 0, | 0, | ||||
| "Less Than", | "Less Than", | ||||
| "True when the first input is smaller than second input"}, | "True when the first input is smaller than second input"}, | ||||
| {NODE_FLOAT_COMPARE_LESS_EQUAL, | {NODE_COMPARE_LESS_EQUAL, | ||||
| "LESS_EQUAL", | "LESS_EQUAL", | ||||
| 0, | 0, | ||||
| "Less Than or Equal", | "Less Than or Equal", | ||||
| "True when the first input is smaller than the second input or equal"}, | "True when the first input is smaller than the second input or equal"}, | ||||
| {NODE_FLOAT_COMPARE_GREATER_THAN, | {NODE_COMPARE_GREATER_THAN, | ||||
| "GREATER_THAN", | "GREATER_THAN", | ||||
| 0, | 0, | ||||
| "Greater Than", | "Greater Than", | ||||
| "True when the first input is greater than the second input"}, | "True when the first input is greater than the second input"}, | ||||
| {NODE_FLOAT_COMPARE_GREATER_EQUAL, | {NODE_COMPARE_GREATER_EQUAL, | ||||
| "GREATER_EQUAL", | "GREATER_EQUAL", | ||||
| 0, | 0, | ||||
| "Greater Than or Equal", | "Greater Than or Equal", | ||||
| "True when the first input is greater than the second input or equal"}, | "True when the first input is greater than the second input or equal"}, | ||||
| {NODE_FLOAT_COMPARE_EQUAL, | {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"}, | ||||
| "EQUAL", | {NODE_COMPARE_NOT_EQUAL, | ||||
| "NOT_EQUAL", | |||||
| 0, | |||||
| "Not Equal", | |||||
| "True when both inputs are not approximately equal"}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| const EnumPropertyItem rna_enum_node_compare_operation_items[] = { | |||||
| {NODE_COMPARE_LESS_THAN, | |||||
| "LESS_THAN", | |||||
| 0, | |||||
| "Less Than", | |||||
| "True when the first input is smaller than second input"}, | |||||
| {NODE_COMPARE_LESS_EQUAL, | |||||
| "LESS_EQUAL", | |||||
| 0, | |||||
| "Less Than or Equal", | |||||
| "True when the first input is smaller than the second input or equal"}, | |||||
| {NODE_COMPARE_GREATER_THAN, | |||||
| "GREATER_THAN", | |||||
| 0, | |||||
| "Greater Than", | |||||
| "True when the first input is greater than the second input"}, | |||||
| {NODE_COMPARE_GREATER_EQUAL, | |||||
| "GREATER_EQUAL", | |||||
| 0, | 0, | ||||
| "Equal", | "Greater Than or Equal", | ||||
| "True when both inputs are approximately equal"}, | "True when the first input is greater than the second input or equal"}, | ||||
| {NODE_FLOAT_COMPARE_NOT_EQUAL, | {NODE_COMPARE_EQUAL, "EQUAL", 0, "Equal", "True when both inputs are approximately equal"}, | ||||
| {NODE_COMPARE_NOT_EQUAL, | |||||
| "NOT_EQUAL", | "NOT_EQUAL", | ||||
| 0, | 0, | ||||
| "Not Equal", | "Not Equal", | ||||
| "True when both inputs are not approximately equal"}, | "True when both inputs are not approximately equal"}, | ||||
| {NODE_COMPARE_COLOR_BRIGHTER, | |||||
| "BRIGHTER", | |||||
| 0, | |||||
| "Brighter", | |||||
| "True when the first input is brighter"}, | |||||
| {NODE_COMPARE_COLOR_DARKER, "DARKER", 0, "Darker", "True when the first input is darker"}, | |||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| const EnumPropertyItem rna_enum_node_float_to_int_items[] = { | const EnumPropertyItem rna_enum_node_float_to_int_items[] = { | ||||
| {FN_NODE_FLOAT_TO_INT_ROUND, | {FN_NODE_FLOAT_TO_INT_ROUND, | ||||
| "ROUND", | "ROUND", | ||||
| 0, | 0, | ||||
| "Round", | "Round", | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | static const EnumPropertyItem rna_node_geometry_curve_handle_type_items[] = { | ||||
| "The location is constrained to point in the opposite direction as the other handle"}, | "The location is constrained to point in the opposite direction as the other handle"}, | ||||
| {0, NULL, 0, NULL, NULL}}; | {0, NULL, 0, NULL, NULL}}; | ||||
| static const EnumPropertyItem rna_node_geometry_curve_handle_side_items[] = { | static const EnumPropertyItem rna_node_geometry_curve_handle_side_items[] = { | ||||
| {GEO_NODE_CURVE_HANDLE_LEFT, "LEFT", ICON_NONE, "Left", "Use the left handles"}, | {GEO_NODE_CURVE_HANDLE_LEFT, "LEFT", ICON_NONE, "Left", "Use the left handles"}, | ||||
| {GEO_NODE_CURVE_HANDLE_RIGHT, "RIGHT", ICON_NONE, "Right", "Use the right handles"}, | {GEO_NODE_CURVE_HANDLE_RIGHT, "RIGHT", ICON_NONE, "Right", "Use the right handles"}, | ||||
| {0, NULL, 0, NULL, NULL}}; | {0, NULL, 0, NULL, NULL}}; | ||||
| static const EnumPropertyItem rna_node_function_compare_mode_items[] = { | |||||
HooglyBoogly: This one can be defined inside of `def_compare`, since it isn't used elsewhere. | |||||
| {NODE_COMPARE_MODE_ELEMENT, | |||||
| "ELEMENT", | |||||
| 0, | |||||
| "Element-Wise", | |||||
| "Compare each element of the input vectors"}, | |||||
| {NODE_COMPARE_MODE_LENGTH, "LENGTH", 0, "Length", "Compare the length of the input vectors"}, | |||||
| {NODE_COMPARE_MODE_AVERAGE, | |||||
| "AVERAGE", | |||||
| 0, | |||||
| "Average", | |||||
| "Compare the average of the input vectors elements"}, | |||||
| {NODE_COMPARE_MODE_DOT_PRODUCT, | |||||
| "DOT_PRODUCT", | |||||
| 0, | |||||
| "Dot Product", | |||||
| "Compare the dot products of the input vectors"}, | |||||
| {NODE_COMPARE_MODE_DIRECTION, | |||||
| "DIRECTION", | |||||
| 0, | |||||
| "Direction", | |||||
| "Compare the direction of the input vectors"}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| #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,586 Lines • ▼ Show 20 Lines | static const EnumPropertyItem *rna_GeometryNodeSwitch_type_itemf(bContext *UNUSED(C), | ||||
| PointerRNA *UNUSED(ptr), | PointerRNA *UNUSED(ptr), | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | bool *r_free) | ||||
| { | { | ||||
| *r_free = true; | *r_free = true; | ||||
| return itemf_function_check(node_socket_data_type_items, switch_type_supported); | return itemf_function_check(node_socket_data_type_items, switch_type_supported); | ||||
| } | } | ||||
| static bool compare_type_supported(const EnumPropertyItem *item) | |||||
| { | |||||
| return ELEM(item->value, SOCK_FLOAT, SOCK_INT, SOCK_VECTOR, SOCK_STRING, SOCK_RGBA); | |||||
| } | |||||
| static bool compare_main_operation_supported(const EnumPropertyItem *item) | |||||
| { | |||||
| return !ELEM(item->value, NODE_COMPARE_COLOR_BRIGHTER, NODE_COMPARE_COLOR_DARKER); | |||||
| } | |||||
| static bool compare_rgba_operation_supported(const EnumPropertyItem *item) | |||||
| { | |||||
| return ELEM(item->value, | |||||
| NODE_COMPARE_EQUAL, | |||||
| NODE_COMPARE_NOT_EQUAL, | |||||
| NODE_COMPARE_COLOR_BRIGHTER, | |||||
| NODE_COMPARE_COLOR_DARKER); | |||||
| } | |||||
| static bool compare_other_operation_supported(const EnumPropertyItem *item) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| static const EnumPropertyItem *rna_FunctionNodeCompare_type_itemf(bContext *UNUSED(C), | |||||
| PointerRNA *UNUSED(ptr), | |||||
| PropertyRNA *UNUSED(prop), | |||||
| bool *r_free) | |||||
| { | |||||
| *r_free = true; | |||||
| return itemf_function_check(node_socket_data_type_items, compare_type_supported); | |||||
| } | |||||
| static const EnumPropertyItem *rna_FunctionNodeCompare_operation_itemf(bContext *UNUSED(C), | |||||
| PointerRNA *ptr, | |||||
| PropertyRNA *UNUSED(prop), | |||||
| bool *r_free) | |||||
| { | |||||
| *r_free = true; | |||||
| bNode *node = ptr->data; | |||||
| NodeFunctionCompare *data = (NodeFunctionCompare *)node->storage; | |||||
| if (ELEM(data->data_type, SOCK_FLOAT, SOCK_INT, SOCK_VECTOR, SOCK_STRING)) { | |||||
| return itemf_function_check(rna_enum_node_compare_operation_items, | |||||
| compare_main_operation_supported); | |||||
| } | |||||
| else if (data->data_type == SOCK_RGBA) { | |||||
| return itemf_function_check(rna_enum_node_compare_operation_items, | |||||
| compare_rgba_operation_supported); | |||||
| } | |||||
| else { | |||||
| return itemf_function_check(rna_enum_node_compare_operation_items, | |||||
| compare_other_operation_supported); | |||||
| } | |||||
| } | |||||
| static bool attribute_clamp_type_supported(const EnumPropertyItem *item) | static bool attribute_clamp_type_supported(const EnumPropertyItem *item) | ||||
| { | { | ||||
| return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_INT32, CD_PROP_COLOR); | return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_INT32, CD_PROP_COLOR); | ||||
| } | } | ||||
| static const EnumPropertyItem *rna_GeometryNodeAttributeClamp_type_itemf(bContext *UNUSED(C), | static const EnumPropertyItem *rna_GeometryNodeAttributeClamp_type_itemf(bContext *UNUSED(C), | ||||
| PointerRNA *UNUSED(ptr), | PointerRNA *UNUSED(ptr), | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | bool *r_free) | ||||
| ▲ Show 20 Lines • Show All 2,778 Lines • ▼ Show 20 Lines | static void def_boolean_math(StructRNA *srna) | ||||
| 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, "custom1"); | RNA_def_property_enum_sdna(prop, NULL, "custom1"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_node_boolean_math_items); | RNA_def_property_enum_items(prop, rna_enum_node_boolean_math_items); | ||||
| 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_Node_socket_update"); | ||||
| } | } | ||||
| static void def_float_compare(StructRNA *srna) | static void def_compare(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeFunctionCompare", "storage"); | |||||
| 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, "custom1"); | RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FunctionNodeCompare_operation_itemf"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_node_float_compare_items); | RNA_def_property_enum_items(prop, rna_enum_node_compare_operation_items); | ||||
| RNA_def_property_enum_default(prop, NODE_COMPARE_EQUAL); | |||||
| 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_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FunctionNodeCompare_type_itemf"); | |||||
| RNA_def_property_enum_items(prop, node_socket_data_type_items); | |||||
| RNA_def_property_enum_default(prop, SOCK_FLOAT); | |||||
| RNA_def_property_ui_text(prop, "Input Type", ""); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | |||||
| prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_items(prop, rna_node_function_compare_mode_items); | |||||
| RNA_def_property_enum_default(prop, NODE_COMPARE_MODE_ELEMENT); | |||||
| RNA_def_property_ui_text(prop, "Mode", ""); | |||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | |||||
| } | } | ||||
| static void def_float_to_int(StructRNA *srna) | static void def_float_to_int(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| prop = RNA_def_property(srna, "rounding_mode", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "rounding_mode", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "custom1"); | RNA_def_property_enum_sdna(prop, NULL, "custom1"); | ||||
| ▲ Show 20 Lines • Show All 4,689 Lines • ▼ Show 20 Lines | |||||
| static void def_geo_attribute_attribute_compare(StructRNA *srna) | static void def_geo_attribute_attribute_compare(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_struct_sdna_from(srna, "NodeAttributeCompare", "storage"); | RNA_def_struct_sdna_from(srna, "NodeAttributeCompare", "storage"); | ||||
| prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); | 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_items(prop, rna_enum_node_float_compare_items); | ||||
| RNA_def_property_enum_default(prop, NODE_FLOAT_COMPARE_GREATER_THAN); | RNA_def_property_enum_default(prop, NODE_COMPARE_GREATER_THAN); | ||||
| 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_Node_socket_update"); | ||||
| prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); | 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_enum_items(prop, rna_node_geometry_attribute_input_type_items_no_boolean); | ||||
| RNA_def_property_ui_text(prop, "Input Type A", ""); | RNA_def_property_ui_text(prop, "Input Type A", ""); | ||||
| RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); | ||||
| ▲ Show 20 Lines • Show All 3,585 Lines • Show Last 20 Lines | |||||
This one can be defined inside of def_compare, since it isn't used elsewhere.