SDFPreviewWidget
The definition editor's preview of the definition it edits.
| Declared in | src/libs/libconstruct/construct/ui/SDFPreviewWidget.hpp |
| Inherits | QWidget |
| Group | construct |
Detailed description
The 3D view is live (construct-multi-document MD-38). It is a SceneWorkerWidget, the viewport that the scene uses, and it draws a small document that holds the edited definition (stageDefinitionPreview()). A ViewportFeed hands the document over, with the rules that the scene viewport uses.
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).
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.