LogoPixi’VN
coreClasses

Abstract Class: ModelSettings

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:512

Parses, and provides access to the settings JSON.

Extended by

Constructors

Constructor

> protected new ModelSettings(json): ModelSettings

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:545

Parameters

json

object & object

The settings JSON object.

Returns

ModelSettings

Properties

json

> json: object

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:513


moc

> abstract moc: string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:528

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


name

> name: string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:519

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?

> optional physics?: string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:540

Relative path of the physics file.


pose?

> optional pose?: string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:536

Relative path of the pose file.


textures

> abstract textures: string[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:532

Relative paths of the texture images.


url

> url: string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:524

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

getDefinedFiles()

> getDefinedFiles(): string[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:594

Retrieves all resource files defined in the settings.

Returns

string[]

A flat array of the paths of all resource files.

modelSettings.getDefinedFiles();
// returns: ["foo.moc", "foo.png", ...]

getFileStem()

> protected getFileStem(path?): string | undefined

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:560

Returns the file name without extension from a path.

Parameters

path?

string

Returns

string | undefined


normalizeName()

> protected normalizeName(): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:551

Ensures the model name is meaningful; falls back to the folder name when missing or placeholder.

Returns

void


replaceFiles()

> replaceFiles(replacer): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:584

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

Parameters

replacer

(file, path) => 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;
});

Returns

void


resolveURL()

> resolveURL(path): string

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:567

Resolves a relative path using the url. This is used to resolve the resource files defined in the settings.

Parameters

path

string

Relative path.

Returns

string

Resolved path.


setModelName()

> protected setModelName(...candidates): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:556

Picks the first non-empty, non-placeholder name from candidates and applies it. Falls back to normalizeName when no candidate is usable.

Parameters

candidates

...(string | undefined)[]

Returns

void


validateFiles()

> validateFiles(files): string[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:603

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

Parameters

files

string[]

A flat array of file paths.

Returns

string[]

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.

On this page