Geometry Nodes: Point separate and attribute compare nodes
This patch adds two related nodes, a node for separating points and mesh vertices based on a boolean attribute input, and a node for creating boolean attributes with comparisons. See the differential for an example file and video. Point Separate (T83059) The output in both geometries is just point data, contained in the mesh and point cloud components, depending which components had data in the input geometry. Any points with the mask attribute set to true will be moved from the first geometry output to the second. This means that for meshes, all edge and face data will be removed. Any point domain attributes are moved to the correct output geometry as well. Attribute Compare (T83057) The attribute compare does the "Equal" and "Not Equal" operations by comparing vectors and colors based on their distance from each other. For other operations, the comparison is between the lengths of the vector inputs. In general, the highest complexity data type is used for the operation, and a new function to determine that is added. Differential Revision: https://developer.blender.org/D9876
This commit is contained in:
@@ -116,4 +116,34 @@ const FloatMathOperationInfo *get_float_math_operation_info(const int operation)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const FloatMathOperationInfo *get_float_compare_operation_info(const int operation)
|
||||
{
|
||||
|
||||
#define RETURN_OPERATION_INFO(title_case_name, shader_name) \
|
||||
{ \
|
||||
static const FloatMathOperationInfo info{title_case_name, shader_name}; \
|
||||
return &info; \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
switch (operation) {
|
||||
case NODE_FLOAT_COMPARE_LESS_THAN:
|
||||
RETURN_OPERATION_INFO("Less Than", "math_less_than");
|
||||
case NODE_FLOAT_COMPARE_LESS_EQUAL:
|
||||
RETURN_OPERATION_INFO("Less Than or Equal", "math_less_equal");
|
||||
case NODE_FLOAT_COMPARE_GREATER_THAN:
|
||||
RETURN_OPERATION_INFO("Greater Than", "math_greater_than");
|
||||
case NODE_FLOAT_COMPARE_GREATER_EQUAL:
|
||||
RETURN_OPERATION_INFO("Greater Than or Equal", "math_greater_equal");
|
||||
case NODE_FLOAT_COMPARE_EQUAL:
|
||||
RETURN_OPERATION_INFO("Equal", "math_equal");
|
||||
case NODE_FLOAT_COMPARE_NOT_EQUAL:
|
||||
RETURN_OPERATION_INFO("Not Equal", "math_not_equal");
|
||||
}
|
||||
|
||||
#undef RETURN_OPERATION_INFO
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
Reference in New Issue
Block a user