public sealed class MaterialViewA material, open for editing: a preview, what it is drawn with, and what it sets.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
⚠ The preview is a request, not a renderer. Drawing a lit sphere needs a device, a compositor and a compiled effect, none of which this assembly has — so the view owns the Shape and the Preview image, raises PreviewChanged when either the shape or the material moves, and the application renders into a target and puts its number on the image. The same split the scene panel and the texture editor already have.
⚠ And the second half of that sentence is a plan rather than a description: nothing subscribes PreviewChanged, so the image is never given a texture number and the preview is blank in every editor built so far (#1204). The texture editor's equivalent is wired — TexturePreviewImages, from EditorApplication.Joined — and it uploads decoded texels, which is a far smaller job than rendering a lit shape; a material has no picture that is not a render of it, which is doc 20's E5 preview work. ⚠ The graph button is not in that state, and an audit that said so was wrong: Joined subscribes OpenGraphRequested, so "Open shader graph" opens the graph.
The shader-graph link is a button and a state. A material naming a graph offers "Open graph"; one that names a graph the project no longer has says so rather than offering a button that opens nothing. What happens when it is pressed is the shell's — OpenGraphRequested carries the asset, and the registry is what turns an asset into a document.
The panel is MaterialView.vxml; this file is the accessibility modifier, the preview-shape enumeration and the record the graph button is. ⚠ The parameter list is still built in C# and the ledger's sixth shape is why — every row feeds a sealed InspectorView by a method, inside a loop, which is the one thing no escape this document records can express.
Fields and properties (14)
protected override string TagNameprotected override bool AcceptsFocusWhether the focus can rest on this kind of control at all.
public Image PreviewWhere the preview is drawn once something has rendered it.
public MaterialPreviewShape ShapeWhich shape the preview asks for.
public Select ShapesThe shape picker.
public InspectorView HeaderViewThe shader, the shading model and the graph link.
public Button OpenGraphThe button that opens the graph this material came from.
public UiElement ParametersWhat the material sets, one expander a parameter.
public Alert GraphBrokenSays why the linked graph offers no properties, when it offers none.
public UiElement GraphPropertiesOne row per property the linked graph asks a material to fill in.
public Select NewKindWhich kind of parameter the add button will add.
public TextBox NewNameWhat the new parameter will be called.
public Button AddParameterThe button that adds it.
public Alert BrokenShown when the file did not read.
Events (2)
public Action<MaterialView>? PreviewChangedRaised when the preview's subject changes — a different shape, or an edited value.
public Action<MaterialView, AssetId>? OpenGraphRequestedRaised when the author asks for the shader graph this material was authored in.
Methods (5)
protected override void OnCreated()protected override void OnRemoved()public void Show(MaterialDocument material)Shows a material.
public void Rebuild()Rebuilds the parameter list from the material as it stands.
public void Reload()Reads every editor back from the material, without rebuilding anything.
Used by (6)
- EditorApplicationVixen.Editor.App
- EditorViewTestsVixen.Editor.AssetEditors.Tests
- MaterialEditorFactoryVixen.Editor.AssetEditors
- MaterialGraphLinkTestsVixen.Editor.AssetEditors.Tests
- MaterialGraphPropertyTestsVixen.Editor.AssetEditors.Tests
- MaterialTestsVixen.Editor.AssetEditors.Tests