Geometry Nodes: Select by Component node #104602

Open
Iliya Katushenock wants to merge 6 commits from mod_moder/blender:for_component_new into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 4c3dd830df - Show all commits

View File

@ -518,9 +518,9 @@ class NODE_MT_category_GEO_UTILITIES_FIELD(Menu):
def draw(self, _context):
layout = self.layout
node_add_menu.add_node_type(layout, "GeometryNodeAccumulateField")
node_add_menu.add_node_type(layout, "GeometryNodeSelectByComponent")
node_add_menu.add_node_type(layout, "GeometryNodeFieldAtIndex")
node_add_menu.add_node_type(layout, "GeometryNodeFieldOnDomain")
node_add_menu.add_node_type(layout, "GeometryNodeSelectByComponent")
node_add_menu.draw_assets_for_catalog(layout, self.bl_label)

View File

@ -286,7 +286,6 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, def_geo_attribute_statistic,
DefNode(GeometryNode, GEO_NODE_BLUR_ATTRIBUTE, def_geo_blur_attribute, "BLUR_ATTRIBUTE", BlurAttribute, "Blur Attribute", "Mix attribute values of neighboring elements")
DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, "Bounding Box", "Calculate the limits of a geometry's positions and generate a box mesh with those dimensions")
DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, def_geo_attribute_capture,"CAPTURE_ATTRIBUTE", CaptureAttribute, "Capture Attribute", "Store the result of a field on a geometry and output the data as a node socket. Allows remembering or interpolating data as the geometry changes, such as positions before deformation")
DefNode(GeometryNode, GEO_NODE_SELECT_BY_COMPONENT, 0, "SELECT_BY_COMPONENT", SelectByComponent, "Select by Component", "")
DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, "COLLECTION_INFO", CollectionInfo, "Collection Info", "Retrieve geometry instances from a collection")
mod_moder marked this conversation as resolved Outdated

For the description, how about Find the type of the currently evaluated geometry?

For the description, how about `Find the type of the currently evaluated geometry`?
DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, "Convex Hull", "Create a mesh that encloses all points in the input geometry with the smallest number of points")
DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, "CURVE_ENDPOINT_SELECTION", CurveEndpointSelection, "Endpoint Selection", "Provide a selection for an arbitrary number of endpoints in each spline")
@ -399,6 +398,7 @@ DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST, def_geo_sample_nearest, "SAMPLE_N
DefNode(GeometryNode, GEO_NODE_SAMPLE_UV_SURFACE, def_geo_sample_uv_surface, "SAMPLE_UV_SURFACE", SampleUVSurface, "Sample UV Surface", "Calculate the interpolated values of a mesh attribute at a UV coordinate")
DefNode(GeometryNode, GEO_NODE_SCALE_ELEMENTS, def_geo_scale_elements, "SCALE_ELEMENTS", ScaleElements, "Scale Elements", "Scale groups of connected edges and faces")
DefNode(GeometryNode, GEO_NODE_SCALE_INSTANCES, 0, "SCALE_INSTANCES", ScaleInstances, "Scale Instances", "Scale geometry instances in local or global space")
DefNode(GeometryNode, GEO_NODE_SELECT_BY_COMPONENT, 0, "SELECT_BY_COMPONENT", SelectByComponent, "Select by Component", "Find the type of the currently evaluated geometry")
DefNode(GeometryNode, GEO_NODE_SELF_OBJECT, 0, "SELF_OBJECT", SelfObject, "Self Object", "Retrieve the object that contains the geometry nodes modifier currently being executed")
DefNode(GeometryNode, GEO_NODE_SEPARATE_COMPONENTS, 0, "SEPARATE_COMPONENTS",SeparateComponents, "Separate Components","Split a geometry into a separate output for each type of data in the geometry")
DefNode(GeometryNode, GEO_NODE_SEPARATE_GEOMETRY, def_geo_separate_geometry,"SEPARATE_GEOMETRY", SeparateGeometry, "Separate Geometry", "Split a geometry into two geometry outputs based on a selection")

View File

@ -11,7 +11,7 @@ namespace blender::nodes::node_geo_select_by_component_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Bool>(N_("Is Mesh")).field_source_reference_all();
b.add_output<decl::Bool>(N_("Is Curve")).field_source_reference_all();
b.add_output<decl::Bool>(N_("Is Curves")).field_source_reference_all();
mod_moder marked this conversation as resolved Outdated

I think Is Curves would be more consistent with the current design for namingfor (still have to update other nodes for that though).

I think `Is Curves` would be more consistent with the current design for namingfor (still have to update other nodes for that though).
b.add_output<decl::Bool>(N_("Is Point Cloud")).field_source_reference_all();
b.add_output<decl::Bool>(N_("Is Instances")).field_source_reference_all();
}
@ -35,7 +35,7 @@ class SelectByComponentFieldInput final : public bke::GeometryFieldInput {
uint64_t hash() const override
{
return type_;
return uint64_t(type_);
}
bool is_equal_to(const fn::FieldNode &other) const override
@ -55,9 +55,9 @@ static void node_geo_exec(GeoNodeExecParams params)
"Is Mesh",
Field<bool>{std::make_shared<SelectByComponentFieldInput>(GEO_COMPONENT_TYPE_MESH)});
}
if (params.output_is_required("Is Curve")) {
if (params.output_is_required("Is Curves")) {
params.set_output(
"Is Curve",
"Is Curves",
Field<bool>{std::make_shared<SelectByComponentFieldInput>(GEO_COMPONENT_TYPE_CURVE)});
}
if (params.output_is_required("Is Point Cloud")) {