Vixen
02b45cc4
csharp
public sealed class MaterialDocument

A material, open for editing.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ The header is a mirror and the parameters are not. A parameter object is already a class with settable members and its own descriptor, so the inspector edits it in place and every edit is a SetMembersCommand without anything here being involved. The header is mirrored only to keep Version and Parameters off the rows, and SaveCore copies the three fields back — which is three lines rather than a second schema.

⚠ A material whose file will not parse opens empty and says so through LoadError. Refusing to open it would leave the one panel that could show what is wrong unreachable, and the file is untouched until a save.

Fields and properties (4)

  • public string AssetPath

    Where the file is, absolute.

  • public MaterialAsset Material

    The material as it stands.

  • public MaterialHeaderEdits Header

    The three header fields, as an inspector edits them.

  • public string? LoadError

    Why the file did not read, or if it did.

Events (1)

  • public Action<MaterialDocument>? ParametersChanged

    Raised when a parameter is added or removed.

Methods (5)

  • public MaterialDocument(EditorProject project, AssetId asset, string path)

    Opens a material.

  • public IMaterialParameter Add(IMaterialParameter parameter)

    Adds a parameter, undoably.

  • public bool Remove(IMaterialParameter parameter)

    Removes a parameter, undoably.

  • public string ToYaml()

    The material as this document would write it, without writing it.

  • protected override void SaveCore()

    Writes the document back to wherever it came from.

Used by (6)

  • AssetEditorRegistryTestsVixen.Editor.AssetEditors.Tests
  • EditorViewTestsVixen.Editor.AssetEditors.Tests
  • MaterialEditorFactoryVixen.Editor.AssetEditors
  • MaterialParameterCommandVixen.Editor.AssetEditors
  • MaterialTestsVixen.Editor.AssetEditors.Tests
  • MaterialViewVixen.Editor.AssetEditors