MaterialPreviewView

The material editor's preview: a sphere in the edited material.

Inherits QWidget
Group construct

In the namespace construct::ui. Declared in src/libs/libconstruct/construct/ui/MaterialPreviewView.hpp.

Detailed description

The view is live and renders on a worker thread. A construct::view::SceneView hosts it, as it hosts the definition editor's preview (SDFPreviewWidget) (construct-viewer §VWV-1): a SceneWorkerWidget, the viewport that the scene uses, and a ViewportFeed that hands the document over with the rules of the scene viewport. It draws a small document: the preview scene, a sphere on a floor in front of a wall. The GUI thread builds no pipeline and compiles no shader.

A material edit changes the sphere's instance, and the worker takes a delta: nothing is staged again and nothing compiles. The view has the scene's default look, as every preview has it (construct-definition-editor §DUS-4).

Until the view draws the staged scene, a placeholder stands in for it: the default background, a painted sphere in the material's colors (the sphere of the material list, MaterialDelegate::paintSwatch()) and a spinner with "Building the preview". A cold pipeline cache costs the worker seconds, and the user sees that the editor works. If the worker fails, the placeholder stays and the reason shows over it.

The view replaced MaterialPreviewRhiWidget, a QRhiWidget with an inline RenderPipeline that built its pipelines on the GUI thread. On a cold cache that froze the editor for 14 s when the materials panel opened (owner, 2026-10-16).

The live view runs only while the widget is shown: a hide stops its worker and a show builds it again, as SDFPreviewWidget does (§DUS-7).

It is shown in MaterialEditorWindow.

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

In this section