Parses, and provides access to the settings JSON.

Hierarchy

Constructors

Properties

expressions?: Expression[]
hitAreas?: HitArea[]
initOpacities?: InitOpacity[]
initParams?: InitParam[]
json: ModelJSON
layout?: Layout
moc: string

Relative path of he moc file, typically ends with .moc in Cubism 2 and .moc3 in Cubism 4.

motions: Record<string, Motion[]> = {}
name: string

The model's name, typically used for displaying or logging. By default it's inferred from the URL by taking the folder name (the second to last component). In Cubism 2 it'll be overwritten by the name field of settings JSON.

physics?: string

Relative path of the physics file.

pose?: string

Relative path of the pose file.

textures: string[]

Relative paths of the texture images.

url: string

URL of the model settings file, used to resolve paths of the resource files defined in settings. This typically ends with .model.json in Cubism 2 and .model3.json in Cubism 4.

Methods

  • Replaces the resource files by running each file through the replacer.

    Parameters

    • replace: ((file: string, path: string) => string)

      Invoked with two arguments: (file, path), where file is the file definition, and path is its property path in the ModelSettings instance. A string must be returned to be the replacement.

      modelSettings.replaceFiles((file, path) => {
      // file = "foo.moc", path = "moc"
      // file = "foo.png", path = "textures[0]"
      // file = "foo.mtn", path = "motions.idle[0].file"
      // file = "foo.motion3.json", path = "motions.idle[0].File"

      return "bar/" + file;
      });
        • (file: string, path: string): string
        • Parameters

          • file: string
          • path: string

          Returns string

    Returns void

  • Validates that the files defined in the settings exist in given files. Each file will be resolved by resolveURL before comparison.

    Returns

    All the files which are defined in the settings and also exist in given files, including the optional files.

    Throws

    Error if any essential file is defined in settings but not included in given files.

    Parameters

    • files: string[]

      A flat array of file paths.

    Returns string[]

Generated using TypeDoc