Model3Jsonパーサー

model3.jsonファイルをパースして値を取得する

Hierarchy

Constructors

Properties

expressions?: Expression[]
groups?: Group[]
hitAreas?: HitArea[]
json: ModelJSON
layout?: { CenterX?: number; CenterY?: number; Height?: number; Width?: number; X?: number; Y?: number }

Type declaration

  • Optional CenterX?: number
  • Optional CenterY?: number
  • Optional Height?: number
  • Optional Width?: number
  • Optional X?: number
  • Optional Y?: number
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