diff options
author | Jacques Lucke <jacques@blender.org> | 2020-03-30 13:51:46 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-03-30 13:51:46 +0300 |
commit | 1189582e399e3a3c1e11e84024c254724e7f95cd (patch) | |
tree | edcb28fb8219a615903ea7f17ea55a135671835e /source/blender/makesrna/intern | |
parent | 5a0e84a6cec55ef5b78fb89437799804039b9a86 (diff) |
add boolean math node ui
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 4c54cf8c7ad..f6758c171af 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -263,6 +263,13 @@ const EnumPropertyItem rna_enum_node_vec_math_items[] = { {0, NULL, 0, NULL, NULL}, }; +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_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"}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_node_map_range_items[] = { {NODE_MAP_RANGE_LINEAR, "LINEAR", @@ -3685,6 +3692,15 @@ static void rna_SimulationNode_socket_update(Main *bmain, Scene *scene, PointerR rna_Node_update(bmain, scene, ptr); } +static void rna_FunctionNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNodeTree *ntree = (bNodeTree *)ptr->owner_id; + bNode *node = (bNode *)ptr->data; + + nodeUpdate(ntree, node); + rna_Node_update(bmain, scene, ptr); +} + static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree = (bNodeTree *)ptr->owner_id; @@ -4128,7 +4144,18 @@ static void def_vector_math(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "custom1"); RNA_def_property_enum_items(prop, rna_enum_node_vec_math_items); RNA_def_property_ui_text(prop, "Operation", ""); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_FunctionNode_socket_update"); +} + +static void def_boolean_math(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, rna_enum_node_boolean_math_items); + RNA_def_property_ui_text(prop, "Operation", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_FunctionNode_socket_update"); } static void def_rgb_curve(StructRNA *srna) |