From 35124acd1973725843530d2dd8b805f717fec581 Mon Sep 17 00:00:00 2001 From: Johnny Matthews Date: Mon, 29 Nov 2021 13:04:25 -0600 Subject: Geometry Nodes: Domain Size Node The Domain Size node has a single geometry input and a selection for the component type. Based on the component chosen, outputs containing single values for the related domains are shown. Mesh: - Point Count - Edge Count - Face Count - Face Corner Count Curve: - Point Count - Spline Count Point Cloud: - Point Count Instances: - Instance Count Differential Revision: https://developer.blender.org/D13365 --- source/blender/makesrna/RNA_enum_items.h | 1 + source/blender/makesrna/intern/rna_nodetree.c | 11 ++++++ source/blender/makesrna/intern/rna_space.c | 50 +++++++++++++-------------- 3 files changed, 37 insertions(+), 25 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h index fb18802483d..78dd977af20 100644 --- a/source/blender/makesrna/RNA_enum_items.h +++ b/source/blender/makesrna/RNA_enum_items.h @@ -210,6 +210,7 @@ DEF_ENUM(rna_enum_attribute_type_with_auto_items) DEF_ENUM(rna_enum_attribute_domain_items) DEF_ENUM(rna_enum_attribute_domain_without_corner_items) DEF_ENUM(rna_enum_attribute_domain_with_auto_items) +DEF_ENUM(rna_enum_geometry_component_type_items) DEF_ENUM(rna_enum_volume_grid_data_type_items) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index aef3823338b..2db517d6b58 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -39,6 +39,7 @@ #include "BKE_animsys.h" #include "BKE_attribute.h" #include "BKE_cryptomatte.h" +#include "BKE_geometry_set.h" #include "BKE_image.h" #include "BKE_node.h" #include "BKE_texture.h" @@ -9166,6 +9167,16 @@ static void def_geo_boolean(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } +static void def_geo_attribute_domain_size(StructRNA *srna) +{ + PropertyRNA *prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, rna_enum_geometry_component_type_items); + RNA_def_property_enum_default(prop, GEO_COMPONENT_TYPE_MESH); + RNA_def_property_ui_text(prop, "Component", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + static void def_geo_curve_primitive_bezier_segment(StructRNA *srna) { static const EnumPropertyItem mode_items[] = { diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8f04524c5c1..bf7a912e9e6 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -73,6 +73,30 @@ #include "RNA_enum_types.h" +const EnumPropertyItem rna_enum_geometry_component_type_items[] = { + {GEO_COMPONENT_TYPE_MESH, + "MESH", + ICON_MESH_DATA, + "Mesh", + "Mesh component containing point, corner, edge and face data"}, + {GEO_COMPONENT_TYPE_POINT_CLOUD, + "POINTCLOUD", + ICON_POINTCLOUD_DATA, + "Point Cloud", + "Point cloud component containing only point data"}, + {GEO_COMPONENT_TYPE_CURVE, + "CURVE", + ICON_CURVE_DATA, + "Curve", + "Curve component containing spline and control point data"}, + {GEO_COMPONENT_TYPE_INSTANCES, + "INSTANCES", + ICON_EMPTY_AXIS, + "Instances", + "Instances of objects or collections"}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_space_type_items[] = { /* empty must be here for python, is skipped for UI */ {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""}, @@ -7832,30 +7856,6 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) PropertyRNA *prop; StructRNA *srna; - static const EnumPropertyItem geometry_component_type_items[] = { - {GEO_COMPONENT_TYPE_MESH, - "MESH", - ICON_MESH_DATA, - "Mesh", - "Mesh component containing point, corner, edge and face data"}, - {GEO_COMPONENT_TYPE_POINT_CLOUD, - "POINTCLOUD", - ICON_POINTCLOUD_DATA, - "Point Cloud", - "Point cloud component containing only point data"}, - {GEO_COMPONENT_TYPE_CURVE, - "CURVE", - ICON_CURVE_DATA, - "Curve", - "Curve component containing spline and control point data"}, - {GEO_COMPONENT_TYPE_INSTANCES, - "INSTANCES", - ICON_EMPTY_AXIS, - "Instances", - "Instances of objects or collections"}, - {0, NULL, 0, NULL, NULL}, - }; - static const EnumPropertyItem object_eval_state_items[] = { {SPREADSHEET_OBJECT_EVAL_STATE_EVALUATED, "EVALUATED", @@ -7914,7 +7914,7 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, NULL); prop = RNA_def_property(srna, "geometry_component_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, geometry_component_type_items); + RNA_def_property_enum_items(prop, rna_enum_geometry_component_type_items); RNA_def_property_ui_text( prop, "Geometry Component", "Part of the geometry to display data from"); RNA_def_property_update(prop, -- cgit v1.2.3