Cleanup: Use one struct member for GP and curve point count

Remove totgppoint/totcuvepoints and instead use `totpoints`.

Pull Request: https://projects.blender.org/blender/blender/pulls/141441
This commit is contained in:
Pratik Borhade
2025-07-04 10:58:03 +02:00
committed by Pratik Borhade
parent 70f4eccdfc
commit 29b97535d7

View File

@@ -70,8 +70,8 @@ struct SceneStats {
uint64_t totobj, totobjsel;
uint64_t totlamp, totlampsel;
uint64_t tottri, tottrisel;
uint64_t totgplayer, totgpframe, totgpstroke, totgppoint;
uint64_t totcuvepoints;
uint64_t totgplayer, totgpframe, totgpstroke;
uint64_t totpoints;
};
struct SceneStatsFmt {
@@ -87,9 +87,8 @@ struct SceneStatsFmt {
char tottri[BLI_STR_FORMAT_UINT64_GROUPED_SIZE], tottrisel[BLI_STR_FORMAT_UINT64_GROUPED_SIZE];
char totgplayer[BLI_STR_FORMAT_UINT64_GROUPED_SIZE],
totgpframe[BLI_STR_FORMAT_UINT64_GROUPED_SIZE];
char totgpstroke[BLI_STR_FORMAT_UINT64_GROUPED_SIZE],
totgppoint[BLI_STR_FORMAT_UINT64_GROUPED_SIZE];
char totcuvepoints[BLI_STR_FORMAT_UINT64_GROUPED_SIZE];
char totgpstroke[BLI_STR_FORMAT_UINT64_GROUPED_SIZE];
char totpoints[BLI_STR_FORMAT_UINT64_GROUPED_SIZE];
};
static bool stats_mesheval(const Mesh *mesh_eval, bool is_selected, SceneStats *stats)
@@ -196,7 +195,7 @@ static void stats_object(Object *ob,
drawing_base);
const blender::bke::CurvesGeometry &curves = drawing->wrap().strokes();
stats->totgppoint += curves.points_num();
stats->totpoints += curves.points_num();
stats->totgpstroke += curves.curves_num();
}
@@ -211,7 +210,7 @@ static void stats_object(Object *ob,
using namespace blender;
const Curves &curves_id = *static_cast<Curves *>(ob->data);
const bke::CurvesGeometry &curves = curves_id.geometry.wrap();
stats->totcuvepoints += curves.points_num();
stats->totpoints += curves.points_num();
break;
}
case OB_POINTCLOUD:
@@ -344,7 +343,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
const VArray<bool> selection = *curves.attributes().lookup_or_default<bool>(
".selection", bke::AttrDomain::Point, true);
stats->totvertsel += array_utils::count_booleans(selection);
stats->totcuvepoints += curves.points_num();
stats->totpoints += curves.points_num();
}
}
@@ -552,9 +551,8 @@ static bool format_stats(
SCENE_STATS_FMT_INT(totgplayer);
SCENE_STATS_FMT_INT(totgpframe);
SCENE_STATS_FMT_INT(totgpstroke);
SCENE_STATS_FMT_INT(totgppoint);
SCENE_STATS_FMT_INT(totcuvepoints);
SCENE_STATS_FMT_INT(totpoints);
#undef SCENE_STATS_FMT_INT
return true;
@@ -591,7 +589,7 @@ static void get_stats_string(char *info,
stats_fmt->totgplayer,
stats_fmt->totgpframe,
stats_fmt->totgpstroke,
stats_fmt->totgppoint);
stats_fmt->totpoints);
return;
}
@@ -628,7 +626,7 @@ static void get_stats_string(char *info,
len - *ofs,
IFACE_("Points:%s/%s"),
stats_fmt->totvertsel,
stats_fmt->totcuvepoints);
stats_fmt->totpoints);
}
else {
*ofs += BLI_snprintf_rlen(info + *ofs,
@@ -644,7 +642,7 @@ static void get_stats_string(char *info,
}
else if (ob && (ob->type == OB_CURVES)) {
const char *count = (object_mode == OB_MODE_SCULPT_CURVES) ? stats_fmt->totvertsculpt :
stats_fmt->totcuvepoints;
stats_fmt->totpoints;
*ofs += BLI_snprintf_rlen(info + *ofs, len - *ofs, IFACE_("Points:%s"), count);
}
else if (ob && (object_mode & OB_MODE_SCULPT)) {
@@ -880,7 +878,7 @@ void ED_info_draw_stats(
stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, nullptr, y, height);
stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, nullptr, y, height);
stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, nullptr, y, height);
stats_row(col1, labels[POINTS], col2, stats_fmt.totgppoint, nullptr, y, height);
stats_row(col1, labels[POINTS], col2, stats_fmt.totpoints, nullptr, y, height);
}
else if (ob && ob->mode == OB_MODE_EDIT) {
if (ob->type == OB_MESH) {
@@ -894,8 +892,7 @@ void ED_info_draw_stats(
stats_row(col1, labels[BONES], col2, stats_fmt.totbonesel, stats_fmt.totbone, y, height);
}
else if (ob->type == OB_CURVES) {
stats_row(
col1, labels[VERTS], col2, stats_fmt.totvertsel, stats_fmt.totcuvepoints, y, height);
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsel, stats_fmt.totpoints, y, height);
}
else if (ob->type != OB_FONT) {
stats_row(col1, labels[VERTS], col2, stats_fmt.totvertsel, stats_fmt.totvert, y, height);