Skip to content

feat(renderer): setFeatureRoleVisible — hide/show a feature role (hide brim/skirt) - #423

Merged
sobechestnut-dev merged 2 commits into
devfrom
feat/set-feature-role-visible
Aug 28, 2026
Merged

sobechestnut-dev merged 2 commits into
devfrom
feat/set-feature-role-visible

Conversation

@sobechestnut-dev

Copy link
Copy Markdown
Contributor

Owner-approved feature from the AnyBridge 0.18.0 collaboration: a per-feature-role visibility toggle so a consumer can offer "hide adhesion (brim/skirt)" alongside Travel/Wipe/Retractions.

API (lockstep, additive)

  • ToolpathRenderer.setFeatureRoleVisible(role: FeatureRoleValue, visible: boolean) + getHiddenFeatureRoles().
  • GcodePreviewControls.setFeatureRoleVisible(role, visible) (passthrough; no-op on the 2D renderer — optional on the interface).
  • FeatureRoleValue now exported from @chestnutlabs/toolpath-core.
  • Gate the UI on capabilities.featureRoles === 'known' (same as feature colour mode).

How

Feature roles are per-segment inside the extrusion geometry (unlike whole-chunk move kinds), so hidden segments are collapsed to NaN positions (GPU-discarded) and restored byte-for-byte from a lazily-saved base copy. Applied at the three mesh-creation sites and on toggle — not in the per-frame draw-state loop, so scrub/layer-clip stay cheap. Extrude-only; byte-identical when never used (no base copy saved). Composes with layer clip and scrub.

Verification

  • Unit tests (lines geometry): hide→NaN, show→restore byte-for-byte, unused→byte-identical, travel-unaffected — all pass; full renderer suite 160 + core 35 green.
  • Live in the demo (tubes, headless SwiftShader): hiding a present role (Bridge) collapsed 32,805 tube vertices and restored to 0 exactly; featureRoles: 'known' gated the toggle.
  • Demo exposes a "Hide brim/skirt (declutter)" checkbox.

Brim and skirt are already first-class FeatureRoles classified by all six slicer adapters, so the immediate distinction is available via feature-colour mode today; this adds the visibility toggle AnyBridge asked for. cc: AnyBridge will consume it once this ships.

🤖 Generated with Claude Code

sobechestnut-dev and others added 2 commits August 27, 2026 20:09
Adds a per-feature-role visibility toggle (AnyBridge "hide adhesion" request).
Unlike the whole-chunk move-kind toggle, feature roles live per-segment inside
the extrusion geometry, so hidden segments are collapsed to NaN positions (the
GPU discards them) and restored byte-for-byte when shown again.

- gcode-renderer-three: ToolpathRenderer.setFeatureRoleVisible(role, visible) +
  getHiddenFeatureRoles(); applied at the three mesh-creation sites and on toggle,
  not in the per-frame draw-state loop (scrub stays cheap). Extrude-only; no base
  copy saved and geometry byte-identical when never used.
- gcode-preview-core: optional setFeatureRoleVisible on PreviewRenderer (2D no-op)
  + GcodePreviewControls.setFeatureRoleVisible passthrough.
- toolpath-core: export FeatureRoleValue.
- demo: "Hide brim/skirt (declutter)" toggle, gated on featureRoles === 'known'.
- Tests: hide→NaN / show→restore byte-for-byte / unused→byte-identical /
  travel-unaffected. Verified live in tubes (SwiftShader): hiding a present role
  collapsed 32,805 vertices and restored to 0.

Lockstep minor. Gate the UI on capabilities.featureRoles === 'known'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ble tsdoc

FeatureRole (the value) isn't imported in scene.ts (only the FeatureRoleValue
type), so the @link couldn't resolve and tripped the API-reference warning gate.
Plain code span instead. API build back to 4/4 within budget.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sobechestnut-dev
sobechestnut-dev merged commit da2f4a0 into dev Aug 28, 2026
4 checks passed
@sobechestnut-dev
sobechestnut-dev deleted the feat/set-feature-role-visible branch August 28, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant