Scripting API
Scripting API
MaterialField
Record struct in Abyss.Core, from Abyss.Core.
One editable number in a MaterialSpec, at the offset the compiler chose.
public readonly record struct MaterialFieldRemarks
The same shape as a ComponentField, and for the same reason. A tool that edits a material should not need a case per field any more than one editing a component does: it reads a number at an offset, shows it, and writes a number back. So a material's numbers are described the way a component's are, and the inspector draws both with one piece of code.
What is not here is the three flags, the transparency rule and the five texture slots. None of those is a number somebody types — two are a checkbox and a list, and a texture is an asset that has to be picked rather than typed — so they are named by whatever is showing them rather than pretending to be rows. That is affordable exactly once: there is one material type, where there are arbitrarily many component types.
Constructors
MaterialField
public MaterialField(string Name, int Offset, FieldKind Kind, int Count)One editable number in a MaterialSpec, at the offset the compiler chose.
Parameters
Name: The field's name in the engine, so it can be grepped for.Offset: Byte offset from the start of the spec.Kind: What kind of value it holds.Count: How many of them sit there: one for a scalar, four for a color.
The same shape as a ComponentField, and for the same reason. A tool that edits a material should not need a case per field any more than one editing a component does: it reads a number at an offset, shows it, and writes a number back. So a material's numbers are described the way a component's are, and the inspector draws both with one piece of code.
What is not here is the three flags, the transparency rule and the five texture slots. None of those is a number somebody types — two are a checkbox and a list, and a texture is an asset that has to be picked rather than typed — so they are named by whatever is showing them rather than pretending to be rows. That is affordable exactly once: there is one material type, where there are arbitrarily many component types.
Properties
Name
public string Name { get; init; }The field's name in the engine, so it can be grepped for.
Offset
public int Offset { get; init; }Byte offset from the start of the spec.
Kind
public FieldKind Kind { get; init; }What kind of value it holds.
Count
public int Count { get; init; }How many of them sit there: one for a scalar, four for a color.
Size
public int Size { get; }Total size of the field in bytes.
