Skip to content

Design Visibility

Hide, isolate, and reveal scene entities. Accessed via snaptrude.design.visibility.

Visibility targets are ComponentHandles. These are the same Hide / Isolate / Show All actions as the viewport toolbar and right-click menu: each toggles a per-component visibility flag and commits an undoable command, so the returned PluginDesignChangeResult is a committed-state snapshot.

Types

PluginDesignChangeResult

Shared result for scene-state change mutations — echoes the handles affected. Errors throw (the RPC rejects); there is no Result<> wrapper in the SDK.

PropertyTypeDescription
affectedComponentHandle[]The entities affected

Functions

hide(components)

Hide entities from the viewport — the same as the Hide action. Undoable. Hosted door/window/void children ride along with their wall; already-hidden entities stay hidden.

  • Parameters:
    • components: ComponentHandle[] — Entities to hide
  • Returns: PluginDesignChangeResult{ affected }, echoing the input handles
  • Throws: HANDLE_INVALID for a stale/foreign handle; PRECONDITION_FAILED for an out-of-proposal handle; or if plugin writes are disabled
ts
const walls = await snaptrude.design.query.listWalls({ storeys: [1] });
const { affected } = await snaptrude.design.visibility.hide(walls);

isolate(components)

Isolate entities — hide everything else so only the given entities remain visible (the Isolate / solo action). Undoable. Reverse it with showAll().

  • Parameters:
    • components: ComponentHandle[] — Entities to keep visible; everything else is hidden
  • Returns: PluginDesignChangeResult{ affected }, echoing the isolated input handles
  • Throws: HANDLE_INVALID for a stale/foreign handle; PRECONDITION_FAILED for an out-of-proposal handle; or if plugin writes are disabled
ts
const [room] = await snaptrude.design.selection.get();
await snaptrude.design.visibility.isolate([room]);

showAll()

Reveal everything hidden on the active story — the Show All action, which also exits an isolate. Undoable.

  • Returns: PluginDesignChangeResult{ affected }, the entities that were made visible
  • Throws: If plugin writes are disabled
ts
const { affected } = await snaptrude.design.visibility.showAll();
console.log(`Revealed ${affected.length} entities`);

Errors

Failed calls reject with a typed PluginError — see Error Handling.

CodeThrown byWhen
HANDLE_INVALIDhide, isolateA supplied handle is stale or foreign
PRECONDITION_FAILEDhide, isolateA supplied handle is outside the active proposal