Geometry Nodes: show number of curve points in socket inspection tooltip

This was not done originally, because one had to iterate over all curves
to get the number of points which had some overhead. Now the number
of points is stored all the time anyway.
This commit is contained in:
Jacques Lucke 2023-01-20 14:44:37 +01:00
parent c006ba83e0
commit c8a10c43b1
3 changed files with 4 additions and 1 deletions

View File

@ -945,7 +945,8 @@ static void create_inspection_string_for_geometry_info(const geo_log::GeometryIn
char line[256];
BLI_snprintf(line,
sizeof(line),
TIP_("\u2022 Curve: %s splines"),
TIP_("\u2022 Curve: %s points, %s splines"),
to_string(curve_info.points_num).c_str(),
to_string(curve_info.splines_num).c_str());
ss << line;
break;

View File

@ -126,6 +126,7 @@ class GeometryInfoLog : public ValueLog {
int verts_num, edges_num, faces_num;
};
struct CurveInfo {
int points_num;
int splines_num;
};
struct PointCloudInfo {

View File

@ -89,6 +89,7 @@ GeometryInfoLog::GeometryInfoLog(const GeometrySet &geometry_set)
case GEO_COMPONENT_TYPE_CURVE: {
const CurveComponent &curve_component = *(const CurveComponent *)component;
CurveInfo &info = this->curve_info.emplace();
info.points_num = curve_component.attribute_domain_size(ATTR_DOMAIN_POINT);
info.splines_num = curve_component.attribute_domain_size(ATTR_DOMAIN_CURVE);
break;
}