Expose Viser viewer extension context - #4092
Conversation
Expose the scene, GUI, and initial-camera handles applications need to install viewer extensions while keeping the Viser server and its lifecycle private to ViewerViser. Document the public seam and cover its export, stable identity, and deliberate omission of the server.
API reviewDetected 5 interface change(s): 5 added, 0 removed, 0 modified.
This check is advisory: the label means API review needed, not that a breaking change is proven. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughChangesViewerViser application extensions
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The change is mergeable with explicit owner awareness: applications using the new context must clean up extension-created callbacks, controls, nodes, and background work before viewer shutdown because those resources are not centrally invalidated by the viewer. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Application
participant ViewerViser
participant ViewerViserExtensionContext
participant ViserSession
ViewerViser->>ViserSession: create server
ViewerViser->>ViewerViserExtensionContext: store scene, GUI, and initial camera handles
Application->>ViewerViser: read extension_context
ViewerViser-->>Application: return cached context
Application->>ViewerViserExtensionContext: add scene nodes and GUI controls
ViewerViserExtensionContext->>ViserSession: forward operations through exposed handles
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The implementation satisfies issue Full details: Out of Scope Changes checkExplanation The changes remain within scope. The implementation, public exports, tests, documentation, and changelog all support the extension-context objective, with no unrelated feature or third-party viewer discovery work. Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (3 skipped: 3 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Expose a typed, non-owning context from
ViewerViserfor applications that add scene nodes and GUI controls to the existing Viser session.The context contains only the scene API, GUI API, and initial-camera configuration. It deliberately omits the
ViserServer: Newton continues to own the server and viewer lifecycle, while the application owns the nodes, controls, callbacks, and background work it creates.This is intentionally narrower than #4039. It does not discover or load third-party viewer classes; callers construct the normal
ViewerViserand extend that instance through capability-limited handles.Closes #4091.
Checklist
Test plan
Results: 1 extension-context test passed, 22 viewer-layer tests passed, and every pre-commit hook passed.
New feature / API change
Summary by CodeRabbit
New Features
Documentation