SDFPreviewWidget

The definition editor's preview of the definition it edits.

Inherits QWidget
Group construct

Declared in src/libs/libconstruct/construct/ui/SDFPreviewWidget.hpp.

Detailed description

The 3D view is live (construct-multi-document MD-38). A construct::view::SceneView hosts it (construct-viewer §VWV-1): a SceneWorkerWidget, the viewport that the scene uses, and a ViewportFeed that hands the document over with the rules that the scene viewport uses. It draws a small document that holds the edited definition (stageDefinitionPreview()). The preview keeps its own placeholder, staging and fit.

A parameter drag changes the one subject instance, and the worker takes a delta. It renders at the rate of the scene viewport and nothing compiles. An edit to the shader restages the document when the text validates. The worker then rebuilds off the GUI thread, and the last frame stays up. A new definition is framed once, and an edit keeps the camera of the user. A double click frames again. The camera gestures are those of the scene viewport. The hover highlight and the pick are off, because they only cover the one item.

The viewport is the largest square in the widget, centered, and the widget declares height-for-width. So one splitter step or one window step resizes the viewport once, to a square, and the last frame shows scaled during the resize, never stretched (construct-definition-editor §DUP-3). Until the viewport draws the scene of a definition, the thumbnail of the definition stands in for it. If the worker fails, the thumbnail stays and the reason shows over it (§DUP-6).

The view has the scene's default look, as the thumbnails have it: the default background, light and material, whatever the scene's own render settings are (§DUS-4, construct::rendering::defaultLook()), which blooms on an over-exposed pixel (material-editor §CME-11). Its first camera is the one the thumbnail's framing solved, and an operator's operands have the thumbnail's size (§DUS-6). The live view runs only while the widget is shown: a hide stops its worker and a show builds it again, so one live preview runs per open window (§DUS-7).

Before MD-38, the preview asked SDFThumbnailGenerator for a new picture for each change. Each request was a queued render with its own framing passes, so a drag queued many of them. The picture came 5 to 30 seconds after the slider (owner, 2026-10-04).

See also SDFPrimitiveEditorWidget, construct::rendering::ViewportFeed.

In this section