Update to Cubism 4 SDK for Web R7

translate
wada 2023-05-25 11:35:15 +09:00
parent 4f1531c94a
commit aacd34c6e0
20 changed files with 1131 additions and 598 deletions

View File

@ -5,6 +5,21 @@ 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/).
## [4-r.7] - 2023-05-25
### Added
* Add compiler options `noImplicitAny` and `useUnknownInCatchVariables` to `tsconfig.json`.
* Add some functions for checking consistency of MOC3 files.
* Add the function of checking consistency in `lappmodel.setupModel()`.
* Add the function of checking consistency before loading a model. (`lappmodel.hasMocConsistencyFromFile()`)
* This feature is enabled by default. Please see the following manual for more information.
* https://docs.live2d.com/cubism-sdk-manual/moc3-consistency/
### Fixed
* Fix a problem in which `haru` motion and voice were incorrect combination.
## [4-r.6.2] - 2023-03-16
### Fixed
@ -177,6 +192,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Fix issue with reloading model images in WebKit.
[4-r.7]: https://github.com/Live2D/CubismWebSamples/compare/4-r.6.2...4-r.7
[4-r.6.2]: https://github.com/Live2D/CubismWebSamples/compare/4-r.6.1...4-r.6.2
[4-r.6.1]: https://github.com/Live2D/CubismWebSamples/compare/4-r.6...4-r.6.1
[4-r.6]: https://github.com/Live2D/CubismWebSamples/compare/4-r.5...4-r.6

@ -1 +1 @@
Subproject commit a37b93d49a3dfdaf7f1e058965305e859ef0738d
Subproject commit 6971f204ce5ee42e80283abf712b0385cd7cd961

View File

@ -84,30 +84,29 @@ NOTE: デバック用の設定は、`.vscode/launch.json` に記述していま
### Node.js
* 19.6.0
* 18.14.0
* 16.19.0
* 14.21.2
* 20.1.0
* 18.16.0
* 16.20.0
## 動作確認環境
| プラットフォーム | ブラウザ | バージョン |
| --- | --- | --- |
| Android | Google Chrome | 109.0.5414.117 |
| Android | Microsoft Edge | 109.0.1518.80 |
| Android | Mozilla Firefox | 109.2.0 |
| iOS / iPadOS | Google Chrome | 110.0.5481.83 |
| iOS / iPadOS | Microsoft Edge | 109.0.1518.80 |
| iOS / iPadOS | Mozilla Firefox | 109.0 |
| iOS / iPadOS | Safari | 16.3 |
| macOS | Google Chrome | 110.0.5481.77 |
| macOS | Microsoft Edge | 110.0.1587.41 |
| macOS | Mozilla Firefox | 109.0.1 |
| macOS | Safari | 16.3 |
| Windows | Google Chrome | 110.0.5481.78 |
| Windows | Microsoft Edge | 110.0.1587.41 |
| Windows | Mozilla Firefox | 109.0.1 |
| Android | Google Chrome | 113.0.5672.77 |
| Android | Microsoft Edge | 113.0.1774.38 |
| Android | Mozilla Firefox | 113.0 |
| iOS / iPadOS | Google Chrome | 113.0.5672.109 |
| iOS / iPadOS | Microsoft Edge | 113.0.1774.42 |
| iOS / iPadOS | Mozilla Firefox | 113.0 |
| iOS / iPadOS | Safari | 16.4 |
| macOS | Google Chrome | 113.0.5672.92 |
| macOS | Microsoft Edge | 113.0.1774.42 |
| macOS | Mozilla Firefox | 113.0.1 |
| macOS | Safari | 16.4 |
| Windows | Google Chrome | 113.0.5672.93 |
| Windows | Microsoft Edge | 113.0.1774.42 |
| Windows | Mozilla Firefox | 113.0 |
Note: 動作確認時のサーバの起動は `./Samples/TypeScript/Demo/package.json``serve` スクリプトを使用して行っています。

View File

@ -83,30 +83,29 @@ Please refer to [CHANGELOG.md](CHANGELOG.md) for the changelog of this repositor
### Node.js
* 19.6.0
* 18.14.0
* 16.19.0
* 14.21.2
* 20.1.0
* 18.16.0
* 16.20.0
## Operation environment
| Platform | Browser | Version |
| --- | --- | --- |
| Android | Google Chrome | 109.0.5414.117 |
| Android | Microsoft Edge | 109.0.1518.80 |
| Android | Mozilla Firefox | 109.2.0 |
| iOS / iPadOS | Google Chrome | 110.0.5481.83 |
| iOS / iPadOS | Microsoft Edge | 109.0.1518.80 |
| iOS / iPadOS | Mozilla Firefox | 109.0 |
| iOS / iPadOS | Safari | 16.3 |
| macOS | Google Chrome | 110.0.5481.77 |
| macOS | Microsoft Edge | 110.0.1587.41 |
| macOS | Mozilla Firefox | 109.0.1 |
| macOS | Safari | 16.3 |
| Windows | Google Chrome | 110.0.5481.78 |
| Windows | Microsoft Edge | 110.0.1587.41 |
| Windows | Mozilla Firefox | 109.0.1 |
| Android | Google Chrome | 113.0.5672.77 |
| Android | Microsoft Edge | 113.0.1774.38 |
| Android | Mozilla Firefox | 113.0 |
| iOS / iPadOS | Google Chrome | 113.0.5672.109 |
| iOS / iPadOS | Microsoft Edge | 113.0.1774.42 |
| iOS / iPadOS | Mozilla Firefox | 113.0 |
| iOS / iPadOS | Safari | 16.4 |
| macOS | Google Chrome | 113.0.5672.92 |
| macOS | Microsoft Edge | 113.0.1774.42 |
| macOS | Mozilla Firefox | 113.0.1 |
| macOS | Safari | 16.4 |
| Windows | Google Chrome | 113.0.5672.93 |
| Windows | Microsoft Edge | 113.0.1774.42 |
| Windows | Mozilla Firefox | 113.0 |
Note: You can start the server for operation check by running the `serve` script of `./Samples/TypeScript/Demo/package.json`.

View File

@ -61,25 +61,25 @@
"File": "motions/haru_g_m26.motion3.json",
"FadeInTime": 0.5,
"FadeOutTime": 0.5,
"Sound": "sounds/haru_normal_04.wav"
"Sound": "sounds/haru_talk_13.wav"
},
{
"File": "motions/haru_g_m06.motion3.json",
"FadeInTime": 0.5,
"FadeOutTime": 0.5,
"Sound": "sounds/haru_normal_01.wav"
"Sound": "sounds/haru_Info_14.wav"
},
{
"File": "motions/haru_g_m20.motion3.json",
"FadeInTime": 0.5,
"FadeOutTime": 0.5,
"Sound": "sounds/haru_normal_03.wav"
"Sound": "sounds/haru_normal_6.wav"
},
{
"File": "motions/haru_g_m09.motion3.json",
"FadeInTime": 0.5,
"FadeOutTime": 0.5,
"Sound": "sounds/haru_normal_02.wav"
"Sound": "sounds/haru_Info_04.wav"
}
]
},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -11,19 +11,19 @@
"clean": "rimraf dist"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.4",
"rimraf": "^4.1.2",
"prettier": "^2.8.8",
"rimraf": "^5.0.0",
"serve": "^14.2.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"
"typescript": "^5.0.4",
"webpack": "^5.82.1",
"webpack-cli": "^5.1.1",
"webpack-dev-server": "^4.15.0"
},
"dependencies": {
"whatwg-fetch": "^3.6.2"

View File

@ -68,6 +68,9 @@ export const PriorityIdle = 1;
export const PriorityNormal = 2;
export const PriorityForce = 3;
// MOC3の一貫性検証オプション
export const MOCConsistencyValidationEnable = true;
// デバッグ用ログの表示オプション
export const DebugLogEnable = true;
export const DebugTouchLogEnable = false;

View File

@ -32,13 +32,18 @@ import { csmMap } from '@framework/type/csmmap';
import { csmRect } from '@framework/type/csmrectf';
import { csmString } from '@framework/type/csmstring';
import { csmVector } from '@framework/type/csmvector';
import { CubismLogError, CubismLogInfo } from '@framework/utils/cubismdebug';
import {
CSM_ASSERT,
CubismLogError,
CubismLogInfo
} from '@framework/utils/cubismdebug';
import * as LAppDefine from './lappdefine';
import { canvas, frameBuffer, gl, LAppDelegate } from './lappdelegate';
import { LAppPal } from './lapppal';
import { TextureInfo } from './lapptexturemanager';
import { LAppWavFileHandler } from './lappwavfilehandler';
import { CubismMoc } from '@framework/model/cubismmoc';
enum LoadStep {
LoadAssets,
@ -114,7 +119,7 @@ export class LAppModel extends CubismUserModel {
fetch(`${this._modelHomeDir}${modelFileName}`)
.then(response => response.arrayBuffer())
.then(arrayBuffer => {
this.loadModel(arrayBuffer);
this.loadModel(arrayBuffer, this._mocConsistency);
this._state = LoadStep.LoadExpression;
// callback
@ -817,6 +822,30 @@ export class LAppModel extends CubismUserModel {
}
}
public async hasMocConsistencyFromFile() {
CSM_ASSERT(this._modelSetting.getModelFileName().localeCompare(``));
// CubismModel
if (this._modelSetting.getModelFileName() != '') {
const modelFileName = this._modelSetting.getModelFileName();
const response = await fetch(`${this._modelHomeDir}${modelFileName}`);
const arrayBuffer = await response.arrayBuffer();
this._consistency = CubismMoc.hasMocConsistency(arrayBuffer);
if (!this._consistency) {
CubismLogInfo('Inconsistent MOC3.');
} else {
CubismLogInfo('Consistent MOC3.');
}
return this._consistency;
} else {
LAppPal.printMessage('Model data does not exist.');
}
}
/**
*
*/
@ -855,12 +884,17 @@ export class LAppModel extends CubismUserModel {
CubismDefaultParameterId.ParamBodyAngleX
);
if (LAppDefine.MOCConsistencyValidationEnable) {
this._mocConsistency = true;
}
this._state = LoadStep.LoadAssets;
this._expressionCount = 0;
this._textureCount = 0;
this._motionCount = 0;
this._allMotionCount = 0;
this._wavFileHandler = new LAppWavFileHandler();
this._consistency = false;
}
_modelSetting: ICubismModelSetting; // モデルセッティング情報
@ -889,4 +923,5 @@ export class LAppModel extends CubismUserModel {
_motionCount: number; // モーションデータカウント
_allMotionCount: number; // モーション総数
_wavFileHandler: LAppWavFileHandler; //wavファイルハンドラ
_consistency: boolean; // MOC3一貫性チェック管理用
}

View File

@ -11,7 +11,9 @@
"baseUrl": "./",
"paths": {
"@framework/*": ["../../../Framework/src/*"]
}
},
"noImplicitAny": true,
"useUnknownInCatchVariables": true
},
"include": [
"src/**/*.ts",

View File

@ -11,8 +11,8 @@ TypeScript で実装したアプリケーションのサンプル実装です。
| パッケージ | バージョン |
| --- | --- |
| TypeScript | 4.9.5 |
| Webpack | 5.75.0 |
| TypeScript | 5.0.4 |
| Webpack | 5.82.1 |
その他のパッケージに関しては、各プロジェクトの `package.json` を確認してください。
また、その他の開発環境・動作確認環境はトップディレクトリにある [README.md](/README.ja.md) を参照してください。

View File

@ -11,8 +11,8 @@ This is a sample implementation of an application implemented with TypeScript.
| Package | Version |
| --- | --- |
| TypeScript | 4.9.5 |
| Webpack | 5.75.0 |
| TypeScript | 5.0.4 |
| Webpack | 5.82.1 |
For other packages, check the `package.json` for each project.
For other development environments and operation environments, see [README.md](/README.md) in the top directory.