From f366aae33c4771354c1bccd9a693c7d84ebcf8bc Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 11 Jun 2026 19:06:55 +0300 Subject: [PATCH] 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 --- src/scene/block_cache.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/scene/block_cache.rs b/src/scene/block_cache.rs index 0419fa482..0393b7e94 100644 --- a/src/scene/block_cache.rs +++ b/src/scene/block_cache.rs @@ -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(_)