From 17578408434fafd2463ed253eebb5cb1412a6c67 Mon Sep 17 00:00:00 2001 From: Johnny Matthews Date: Wed, 1 Dec 2021 09:36:25 -0600 Subject: Geometry Nodes: Generalized Compare Node Replace compare floats node with a generalized compare node. The node allows for the comparison of float, int, string, color, and vector. The datatypes support the following operators: Float, Int: <, >, <=, >=, ==, != String: ==, != Color: ==, !=, lighter, darker (using rgb_to_grayscale value as the brightness value) Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >= Average: The average of the components of the vectors are compared. Dot Product: The dot product of the vectors are compared. Direction: The angle between the vectors is compared to an angle Element-wise: The individual components of the vectors are compared. Length: The lengths of the vectors are compared. Differential Revision: https://developer.blender.org/D13228 --- source/blender/blenloader/intern/versioning_300.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/blender/blenloader/intern') diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 295084cd62f..b7dff52c3c8 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -2191,7 +2191,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) if (ntree->type != NTREE_GEOMETRY) { continue; } - version_node_id(ntree, FN_NODE_COMPARE_FLOATS, "FunctionNodeCompareFloats"); + version_node_id(ntree, FN_NODE_COMPARE, "FunctionNodeCompareFloats"); version_node_id(ntree, GEO_NODE_CAPTURE_ATTRIBUTE, "GeometryNodeCaptureAttribute"); version_node_id(ntree, GEO_NODE_MESH_BOOLEAN, "GeometryNodeMeshBoolean"); version_node_id(ntree, GEO_NODE_FILL_CURVE, "GeometryNodeFillCurve"); @@ -2414,6 +2414,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) version_node_add_socket_if_not_exist( ntree, node, SOCK_OUT, SOCK_INT, PROP_NONE, "Index", "Index"); } + + /* Convert float compare into a more general compare node. */ + if (node->type == FN_NODE_COMPARE) { + if (node->storage == NULL) { + NodeFunctionCompare *data = (NodeFunctionCompare *)MEM_callocN( + sizeof(NodeFunctionCompare), __func__); + data->data_type = SOCK_FLOAT; + data->operation = node->custom1; + strcpy(node->idname, "FunctionNodeCompare"); + node->update = NODE_UPDATE; + node->storage = data; + } + } } } -- cgit v1.2.3