Vixen
02b45cc4
csharp
public sealed class MaterialView

A 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.

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.

Fields and properties (12)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public Image Preview

    Where the preview is drawn once something has rendered it.

  • public MaterialPreviewShape Shape

    Which shape the preview asks for.

  • public Select Shapes

    The shape picker.

  • public InspectorView HeaderView

    The shader, the shading model and the graph link.

  • public Button OpenGraph

    The button that opens the graph this material came from.

  • public UiElement Parameters

    What the material sets, one expander a parameter.

  • public Select NewKind

    Which kind of parameter the add button will add.

  • public TextBox NewName

    What the new parameter will be called.

  • public Button AddParameter

    The button that adds it.

  • public Alert Broken

    Shown when the file did not read.

Events (2)

  • public Action<MaterialView>? PreviewChanged

    Raised when the preview's subject changes — a different shape, or an edited value.

  • public Action<MaterialView, AssetId>? OpenGraphRequested

    Raised when the author asks for the shader graph this material was authored in.

Methods (4)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • 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 (4)

  • EditorApplicationVixen.Editor.App
  • EditorViewTestsVixen.Editor.AssetEditors.Tests
  • MaterialEditorFactoryVixen.Editor.AssetEditors
  • MaterialTestsVixen.Editor.AssetEditors.Tests