Update to Cubism 4 SDK for Web R5 beta4

This commit is contained in:
wada
2022-07-07 11:30:03 +09:00
parent 55b7a9233e
commit 4e14ef622d
4 changed files with 51 additions and 4 deletions

View File

@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [4-r.5-beta.4] - 2022-07-07
### Added
* Add a function to get the latest .moc3 Version and the .moc3 Version of the loaded model.
* Add a function to get the type of parameters of the model.
* Add a function to get the parent part of the model's Drawable.
## [4-r.5-beta.3] - 2022-06-16 ## [4-r.5-beta.3] - 2022-06-16
### Fixed ### Fixed
@ -97,6 +106,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Reformat code using Prettier and ESLint. * Reformat code using Prettier and ESLint.
[4-r.5-beta.4]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.3...4-r.5-beta.4
[4-r.5-beta.3]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.2...4-r.5-beta.3 [4-r.5-beta.3]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.2...4-r.5-beta.3
[4-r.5-beta.2]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.1...4-r.5-beta.2 [4-r.5-beta.2]: https://github.com/Live2D/CubismWebFramework/compare/4-r.5-beta.1...4-r.5-beta.2
[4-r.5-beta.1]: https://github.com/Live2D/CubismWebFramework/compare/4-r.4...4-r.5-beta.1 [4-r.5-beta.1]: https://github.com/Live2D/CubismWebFramework/compare/4-r.4...4-r.5-beta.1

View File

@ -17,10 +17,9 @@ Live2D Cubism 4 Editor で出力したモデルをアプリケーションで利
### Node.js ### Node.js
* 18.1.0 * 18.4.0
* 17.9.0 * 16.15.1
* 16.15.0 * 14.19.3
* 14.19.2
### TypeScript ### TypeScript

View File

@ -24,6 +24,7 @@ export class CubismMoc {
if (moc) { if (moc) {
cubismMoc = new CubismMoc(moc); cubismMoc = new CubismMoc(moc);
cubismMoc._mocVersion = Live2DCubismCore.Version.csmGetMocVersion(moc);
} }
return cubismMoc; return cubismMoc;
@ -79,6 +80,7 @@ export class CubismMoc {
private constructor(moc: Live2DCubismCore.Moc) { private constructor(moc: Live2DCubismCore.Moc) {
this._moc = moc; this._moc = moc;
this._modelCount = 0; this._modelCount = 0;
this._mocVersion = 0;
} }
/** /**
@ -91,8 +93,23 @@ export class CubismMoc {
this._moc = null; this._moc = null;
} }
/**
* 最新の.moc3 Versionを取得
*/
public getLatestMocVersion(): number {
return Live2DCubismCore.Version.csmGetLatestMocVersion();
}
/**
* 読み込んだモデルの.moc3 Versionを取得
*/
public getMocVersion(): number {
return this._mocVersion;
}
_moc: Live2DCubismCore.Moc; // Mocデータ _moc: Live2DCubismCore.Moc; // Mocデータ
_modelCount: number; // Mocデータから作られたモデルの個数 _modelCount: number; // Mocデータから作られたモデルの個数
_mocVersion: number; // 読み込んだモデルの.moc3 Version
} }
// Namespace definition for compatibility. // Namespace definition for compatibility.

View File

@ -416,6 +416,18 @@ export class CubismModel {
return this._model.parameters.count; return this._model.parameters.count;
} }
/**
* パラメータの種類の取得
* @param parameterIndex パラメータのインデックス
* @return csmParameterType_Normal -> 通常のパラメータ
* csmParameterType_BlendShape -> ブレンドシェイプパラメータ
*/
public getParameterType(
parameterIndex: number
): Live2DCubismCore.csmParameterType {
return this._model.parameters.types[parameterIndex];
}
/** /**
* パラメータの最大値の取得 * パラメータの最大値の取得
* @param parameterIndex パラメータのインデックス * @param parameterIndex パラメータのインデックス
@ -788,6 +800,15 @@ export class CubismModel {
return screenColor; return screenColor;
} }
/**
* Drawableの親パーツのインデックスの取得
* @param drawableIndex Drawableのインデックス
* @return drawableの親パーツのインデックス
*/
public getDrawableParentPartIndex(drawableIndex: number): number {
return this._model.drawables.parentPartIndices[drawableIndex];
}
/** /**
* Drawableのカリング情報の取得 * Drawableのカリング情報の取得
* @param drawableIndex Drawableのインデックス * @param drawableIndex Drawableのインデックス