Vixen
02b45cc4
csharp
public class EditorObject

Something with editable properties, belonging to a document.

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

Remarks

Derive from it and declare the properties in the constructor:

sealed class MaterialObject : EditorObject { public EditorProperty<float> Roughness { get; } public MaterialObject(EditorDocument document) : base(document) { Roughness = Property("Roughness", 0.2f); } }

The document is what the properties' writes are recorded against, and it is nullable because the same type is useful without one — a preview of an asset nobody is editing, a value bag in a test. What that costs is stated at Set: those writes happen and are not undoable.

Fields and properties (2)

  • public EditorDocument? Document

    Where writes to these properties are recorded, if anywhere.

  • public IReadOnlyList<IEditorProperty> Properties

    Its properties, in the order they were declared.

Methods (3)

  • public EditorObject(EditorDocument? document)

    Creates an object whose edits go to a document.

  • protected internal EditorProperty<T> Property<T>(string name, T initial, IEqualityComparer<T>? comparer = null, bool coalescesEdits = true)

    Declares a property.

  • public bool TryGetProperty(string name, out IEditorProperty property)

    Finds a property by name.

Used by (5)

  • EditorDocumentTestsVixen.Editor.Core.Tests
  • EditorPropertyVixen.Editor.Core
  • IEditorPropertyVixen.Editor.Core
  • KnobVixen.Editor.Core.Tests
  • SetPropertyCommandVixen.Editor.Core