fix(blocks): hide invisible sub-entities in block definitions

A dynamic block with a visibility-state parameter stores the geometry
for every state in one anonymous block and marks all but the active
state's entities invisible. The block-cache builder tessellated every
sub-entity regardless, so a visibility block rendered all variants
stacked on top of each other instead of the one selected profile.
Skip invisible sub-entities in both the render pass and the precision-
offset centroid pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-11 19:06:55 +03:00
commit f366aae33c

View file

@ -292,6 +292,12 @@ fn build_defn(
) {
continue;
}
// Invisible sub-entities never render (see pass 2), so keep them out
// of the offset centroid too — otherwise a dynamic block's hidden
// states would drag the precision origin off the visible geometry.
if entity.common().invisible {
continue;
}
// For Inserts, take the insertion_point itself (acadrust's
// `Insert::bounding_box` returns just that). One level deep is
// enough for an offset-picker — nested Inserts inside that block
@ -346,6 +352,14 @@ fn build_defn(
let Some(entity) = doc.get_entity(eh) else {
continue;
};
// Skip entities flagged invisible. Dynamic blocks (e.g. a visibility-
// state parametric block) keep the geometry for every state in one
// anonymous block and mark all but the active state's entities
// invisible — honouring the flag is what shows a single profile
// instead of every variant stacked on top of each other.
if entity.common().invisible {
continue;
}
match entity {
EntityType::Block(_)
| EntityType::BlockEnd(_)