Loading a look

This page uses Mesh from Unity. The glossary says what each one is.

Load reads one look fully from the game’s files. It gives you a SceneLook handle, which is what Apply and Reskin take.

SceneLook a handle to one loaded look

SceneLooks.Load gives you one of these, and Apply and Reskin take it. Load always gives you a handle, so check Failed and Ready before you use it.

public sealed class SceneLook
{
    public string Scene { get; }
    public string Path { get; }
    public string Name { get; }
    public bool Ready { get; }
    public bool Failed { get; }
    public string Reason { get; }
    public int MeshCount { get; }
    public int VertexCount { get; }
    public string[] BoneNames { get; }
}
Property Type What it means
Scene string The name of the scene the look came from.
Path string The full path of the look’s body root.
Name string The name of the body root.
Ready bool true when the look is loaded and usable.
Failed bool true when the load was refused. See Reason.
Reason string Why it failed. It is "released" after Release.
MeshCount int How many meshes the look has.
VertexCount int How many vertices (model points) the look has.
BoneNames string[] The names of its bones.

SceneLooks loads a look

This is the class to start from. Pass Load a SceneLookInfo from Looking for a look, or a scene name and body root, and it gives you a SceneLook back.

public static class SceneLooks
{
    public static SceneLook Load(string modId, SceneLookInfo info);
    public static SceneLook Load(string modId, string sceneName, string rendererRoot);
}
Method Returns What it does
Load(modId, info) SceneLook Loads a look you found with List, FindByName or FindByCharacter.
Load(modId, sceneName, rendererRoot) SceneLook Loads a look by its scene and path or name.

Things to know

  • Load(modId, sceneName, rendererRoot) reads one look completely. It reads every skinned mesh, material, texture, bone and node under the body root. rendererRoot is either the full path (Content/mr_duck/Wasteland Hide/mr_duck) or a name that only one entry uses (mr_duck).
  • Load(modId, info) loads the look that a SceneLookInfo names. It is the same load, with the same cache, as the other version. It refuses a SceneLookInfo that the framework did not build.
  • Load always gives back a handle, and the handle is never null. On a failure, Failed is true and Reason says why. Ready is true only for a look that loaded.
  • Loading the same look twice is quick, because it is kept for the session. A second Load of the same body root gives back the same handle and does not read the files again. Every Load takes a hold on the look for your mod, even when the look was already kept, so the handle can always be released. (one parsed look is cached for each level file and root for the session)

Limits

  • The whole look is refused if any part of it fails, so you never get half a body. That happens when a model fails its checks, a bone is outside the look’s file, the root bone cannot be found, a file it needs is not installed, or a texture does not fit its file. (the checks are a renderer failing its layout checks, a bone outside the look file, an unresolved root bone, a referenced file that is not installed, and a texture stream that does not fit its file)
  • A look uses memory, so keep one look for the whole session and release it when you stop using it. As a guide, the Mr. Duck look is 1.56 MB of vertex data, 0.17 MB of index data and 8.45 MB of texture data.