Spreadsheet: Expose .sculpt and .hide attributes behind debug option

This commit adds five commonly used internal Sculpt Mode attributes
to the Spreadsheet editor when `--debug-value 4001` is passed in to
assist with development and debugging of issues.

The whitelisted attributes are:
* `.sculpt_mask`
* `.sculpt_face_set`
* `.hide_vert`
* `.hide_poly`
* `.hide_edge`

And are displayed after the other existing debug columns.

Pull Request: https://projects.blender.org/blender/blender/pulls/135201
This commit is contained in:
Sean Kim
2025-02-27 02:15:36 +01:00
committed by Sean Kim
parent d6cdaff0c0
commit 79df0351d4

View File

@@ -75,17 +75,30 @@ static void add_mesh_debug_column_names(
const bke::AttrDomain domain,
FunctionRef<void(const SpreadsheetColumnID &, bool is_extra)> fn)
{
const bke::AttributeAccessor attributes = mesh.attributes();
auto add_attribute = [&](const StringRefNull name) {
if (const std::optional<bke::AttributeMetaData> meta_data = attributes.lookup_meta_data(name))
{
if (meta_data->domain == domain) {
fn({(char *)name.c_str()}, false);
}
}
};
switch (domain) {
case bke::AttrDomain::Point:
if (CustomData_has_layer(&mesh.vert_data, CD_ORIGINDEX)) {
fn({(char *)"Original Index"}, false);
}
add_attribute(".sculpt_mask");
add_attribute(".hide_vert");
break;
case bke::AttrDomain::Edge:
if (CustomData_has_layer(&mesh.edge_data, CD_ORIGINDEX)) {
fn({(char *)"Original Index"}, false);
}
fn({(char *)"Vertices"}, false);
add_attribute(".hide_edge");
break;
case bke::AttrDomain::Face:
if (CustomData_has_layer(&mesh.face_data, CD_ORIGINDEX)) {
@@ -93,6 +106,8 @@ static void add_mesh_debug_column_names(
}
fn({(char *)"Corner Start"}, false);
fn({(char *)"Corner Size"}, false);
add_attribute(".sculpt_face_set");
add_attribute(".hide_poly");
break;
case bke::AttrDomain::Corner:
fn({(char *)"Vertex"}, false);