Scripting API

Scripting API

MaterialRemap

Class in Abyss.Core, from Abyss.Core.

The material files a model's own materials are drawn as, instead of as its import describes them: each by the name the material has in the file, or by its label — Material0 — for one it names nothing. What the model's inspector's Materials section sets, and what its prefab is made with.

public sealed class MaterialRemap : IEquatable<MaterialRemap>

Remarks

By name rather than by place, so a model exported again with its materials in another order keeps what each was given.

Kept in the model's sidecar with its other settings, in its import block: "materials": { "Body": { "guid": "…", "path": "materials/body.mat" } }. Nothing at all for a model none of whose materials is given another, so a model nobody has configured has the sidecar it always had. Only the editor reads it: the engine's import makes the same meshes either way.

Constructors

MaterialRemap

public MaterialRemap(IEnumerable<KeyValuePair<string, RemappedMaterial>> remapped)

Makes one of what each named material is drawn as.

Parameters

  • remapped: The material file each is drawn as, by the material's name.

Properties

None

public static MaterialRemap None { get; }

Each material is drawn as the import describes it: what a model nobody configured has.

Materials

public IReadOnlyDictionary<string, RemappedMaterial> Materials { get; }

The material file each material given one is drawn as, by its name, in order.

SaysNothing

public bool SaysNothing { get; }

Whether no material is given another.

Methods

Of

public RemappedMaterial? Of(string name)

The material file the material of this name is drawn as, or null for its own.

Parameters

  • name

With

public MaterialRemap With(string name, RemappedMaterial? to)

The same, but the material of this name drawn as to, or as its own for null.

Parameters

  • name
  • to

ToJson

public string ToJson()

What it says, as the cache's record of a model's prefab keeps it: each name and the identity of the file it is drawn as; empty for none, so a prefab made before it was given any is current.

Equals

public bool Equals(MaterialRemap? other)

Whether two give the same materials the same files.

Parameters

  • other

Equals

public override bool Equals(object? obj)

Parameters

  • obj

GetHashCode

public override int GetHashCode()