Skip to content

MCP: scene visualization properties + ui.progressStatus#5982

Merged
Grantim merged 2 commits intomasterfrom
viewer-mcp-visualization
Apr 27, 2026
Merged

MCP: scene visualization properties + ui.progressStatus#5982
Grantim merged 2 commits intomasterfrom
viewer-mcp-visualization

Conversation

@Grantim
Copy link
Copy Markdown
Contributor

@Grantim Grantim commented Apr 25, 2026

Summary

Two small additive changes to existing MCP namespaces:

  1. scene.setObjectState / scene.getObjectInfovisualization sub-object. Lets agents read and write per-object render-time properties: front-color (selected and unselected), global alpha, and (where applicable) flat-shading toggle, show-edges toggle, edge width / line width, point size. Fields sent to an object type that doesn't support them return a typed error. Color and visualize-flag changes participate in the existing SCOPED_HISTORY block so multi-field calls are reverted atomically by Ctrl+Z.

  2. ui.progressStatus. Read-only snapshot of the global MR::ProgressBar. Returns {active: false} when no long-running op is in flight; else {active: true, title: string, percent: number}. Lets an agent poll through a 'Progress' modal and resume ui.* dispatch once the op completes. Uses only the existing public API (isOrdered / isFinished / getProgress / getLastOperationTitle) — no new getters added.

Commits

  1. MCP: add visualization properties to scene.setObjectState/getObjectInfo — extends two existing tools, no new tools registered.
  2. MCP: add ui.progressStatus — one new tool.

Test plan

Verified live via the MCP server:

  • scene.getObjectInfo returns visualization: {selectedColor, unselectedColor, globalAlpha, flatShading, showEdges, edgeWidth} for a mesh; round-trip with setObjectState produces matching values.
  • setObjectState + pointSize on a non-points object returns a typed error.
  • setObjectState + invalid color array (length 2) and out-of-range globalAlpha return typed errors.
  • Multi-field setObjectState call (color + flatShading + showEdges + edgeWidth) reverts atomically with one Ctrl+Z.
  • ui.progressStatus returns {active: false} on idle MI.
  • During a long op (Test tab > Test progress bar > Create progress bar, test #0 — runs ~10s, calls setProgress 10 times): {active: true, title: \"test #0\", percent} is returned with percent rising from 0 toward 100, then back to {active: false} after completion.

Follow-ups

  • ui.dismissModals — initially included in this PR; deferred to a separate PR after testing showed that some MI dialogs (e.g. the F1 Hotkeys dialog) re-open every frame because of internal sticky flags. The right fix needs a per-modal-aware close path (Esc-first + ClosePopupToLevel fallback) which deserves its own review.
  • Adding dedicated history actions for globalAlpha, edgeWidth, pointSize (currently applied without entering SCOPED_HISTORY since no per-field action exists yet).

🤖 Generated with Claude Code

Grantim added 2 commits April 24, 2026 20:09
New `visualization` sub-object in setObjectState input and getObjectInfo
output: selectedColor / unselectedColor / globalAlpha (any VisualObject);
flatShading / showEdges (mesh only); edgeWidth (mesh or polyline);
pointSize (point cloud only). Colors are [r,g,b] or [r,g,b,a] floats in
[0,1]; alpha is a [0,1] float mapped to uint8. Fields sent to an object
type that doesn't support them return a typed error. Colors and visualize
flags push ChangeObjectColorAction / ChangeVisualizePropertyAction for
undo; globalAlpha / edgeWidth / pointSize lack dedicated actions so they
fall outside the SCOPED_HISTORY block.
Read-only snapshot of MR::ProgressBar. Returns {active: false} when no
long-running op is in flight, else {active: true, title, percent}. Uses
only the existing public API (isOrdered/isFinished/getProgress/
getLastOperationTitle) — no new getters added. Lets an agent poll
through a 'Progress' modal until ui.* dispatch unblocks.
@Grantim Grantim requested a review from Fedr April 25, 2026 07:31
@Grantim Grantim merged commit 466884e into master Apr 27, 2026
35 checks passed
@Grantim Grantim deleted the viewer-mcp-visualization branch April 27, 2026 09:37
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.

5 participants