ShapeVocabularyDocument
public sealed class ShapeVocabularyDocumentA project's shape vocabulary, open for editing.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The first file anybody makes and the one that had no editor at all. A vocabulary is what turns "somebody called it palm-l on this body and left-palm on that one" from an invisible bug into an import error — and until this existed it could only be written in a text editor outside Vixen, which is a poor first step for the file that every later step is checked against.
⚠ Three lists rather than one. A term is a name a shape may have, a tag is something a shape may afford, and a class is a body plan that requires certain terms. They are edited together because a class member naming an undeclared term is the mistake the file exists to prevent, and it is only visible when both are in front of you.
Fields and properties (4)
public const string ExtensionWhat a vocabulary is written as.
public string AssetPathWhere the file is, absolute.
public ShapeVocabularyContent VocabularyThe vocabulary.
public string? LoadErrorWhy the file would not read, or .
Events (1)
public Action<ShapeVocabularyDocument>? ChangedRaised after anything changes it.
Methods (15)
public ShapeVocabularyDocument(EditorProject project, AssetId asset, string path)Opens a vocabulary.
public IReadOnlyList<VocabularyProblem> Problems()What is wrong with it, as the build would say it.
public ShapeTermRecord AddTerm(string name = "new-shape", string meaning = "")Declares a name a shape may have, undoably.
public bool Remove(ShapeTermRecord term)Removes a term, undoably.
public ShapeTermRecord Edit(ShapeTermRecord term, Func<ShapeTermRecord, ShapeTermRecord> edit)Replaces a term with an edited copy, undoably.
public ShapeTagRecord AddTag(string tag = "affords=grip-surface", string meaning = "")Declares a tag, undoably.
public bool Remove(ShapeTagRecord tag)Removes a tag, undoably.
public ShapeTagRecord Edit(ShapeTagRecord tag, Func<ShapeTagRecord, ShapeTagRecord> edit)Replaces a tag with an edited copy, undoably.
public ShapeClassRecord AddClass(string name = "humanoid")Declares a body plan, undoably.
public bool Remove(ShapeClassRecord declared)Removes a class, undoably.
public ShapeClassRecord Edit(ShapeClassRecord declared, Func<ShapeClassRecord, ShapeClassRecord> edit)Replaces a class with an edited copy, undoably.
public VocabularyMember AddMember(ShapeClassRecord declared, string? name = null)Adds a shape a class requires, undoably.
public bool Remove(VocabularyMember member)Removes a member from its class, undoably.
public VocabularyMember Edit(VocabularyMember member, Func<ShapeClassMemberRecord, ShapeClassMemberRecord> edit)Replaces a member with an edited copy, undoably.
protected override void SaveCore()Writes the document back to wherever it came from.
Used by (3)
- ShapeVocabularyEditorFactoryVixen.Editor.AssetEditors
- ShapeVocabularyTestsVixen.Editor.AssetEditors.Tests
- ShapeVocabularyViewVixen.Editor.AssetEditors