Update to Cubism SDK for Web R4

This commit is contained in:
wada
2021-12-09 14:12:23 +09:00
parent 85b4313dbe
commit 13ba60d1b2
6 changed files with 29 additions and 16 deletions

View File

@ -4,11 +4,14 @@ 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/).
## [Unreleased] ## [4-r.4] - 2021-12-09
### Fixed ### Fixed
* Fix return correct error values for out-of-index arguments in cubismjson. * Fix useless void 0.
* Fix a warning when `SegmentType` could not be obtained when loading motion.
* Fix return correct error values for out-of-index arguments in cubismjson by [@cocor-au-lait](https://github.com/cocor-au-lait).
* Fix a bug that motions currently played do not fade out when play a motion.
## [4-r.3] - 2021-06-10 ## [4-r.3] - 2021-06-10
@ -63,6 +66,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.4]: https://github.com/Live2D/CubismWebFramework/compare/4-r.3...4-r.4
[4-r.3]: https://github.com/Live2D/CubismWebFramework/compare/4-r.3-beta.1...4-r.3 [4-r.3]: https://github.com/Live2D/CubismWebFramework/compare/4-r.3-beta.1...4-r.3
[4-r.3-beta.1]: https://github.com/Live2D/CubismWebFramework/compare/4-r.2...4-r.3-beta.1 [4-r.3-beta.1]: https://github.com/Live2D/CubismWebFramework/compare/4-r.2...4-r.3-beta.1
[4-r.2]: https://github.com/Live2D/CubismWebFramework/compare/4-r.1...4-r.2 [4-r.2]: https://github.com/Live2D/CubismWebFramework/compare/4-r.1...4-r.2

View File

@ -17,13 +17,14 @@ Live2D Cubism 4 Editor で出力したモデルをアプリケーションで利
### Node.js ### Node.js
* 16.1.0 * 17.2.0
* 14.17.0 * 16.13.1
* 12.22.1 * 14.18.2
* 12.22.7
### TypeScript ### TypeScript
4.2.2 4.5.2
## 開発環境構築 ## 開発環境構築
@ -132,3 +133,11 @@ JSONパーサーやログ出力などのユーティリティ機能を提供し
## 変更履歴 ## 変更履歴
当リポジトリの変更履歴については [CHANGELOG.md](CHANGELOG.md) を参照ください。 当リポジトリの変更履歴については [CHANGELOG.md](CHANGELOG.md) を参照ください。
## コミュニティ
ユーザー同士でCubism SDKの活用方法の提案や質問をしたい場合は、是非コミュニティをご活用ください。
- [Live2D 公式コミュニティ](https://creatorsforum.live2d.com/)
- [Live2D community(English)](http://community.live2d.com/)

View File

@ -26,7 +26,6 @@ export abstract class ACubismMotion {
*/ */
public static delete(motion: ACubismMotion): void { public static delete(motion: ACubismMotion): void {
motion.release(); motion.release();
motion = void 0;
motion = null; motion = null;
} }

View File

@ -11,7 +11,11 @@ import { CubismMath } from '../math/cubismmath';
import { CubismModel } from '../model/cubismmodel'; import { CubismModel } from '../model/cubismmodel';
import { csmString } from '../type/csmstring'; import { csmString } from '../type/csmstring';
import { csmVector } from '../type/csmvector'; import { csmVector } from '../type/csmvector';
import { CSM_ASSERT, CubismLogDebug } from '../utils/cubismdebug'; import {
CSM_ASSERT,
CubismLogDebug,
CubismLogWarning
} from '../utils/cubismdebug';
import { ACubismMotion, FinishedMotionCallback } from './acubismmotion'; import { ACubismMotion, FinishedMotionCallback } from './acubismmotion';
import { import {
CubismMotionCurve, CubismMotionCurve,
@ -783,6 +787,10 @@ export class CubismMotion extends ACubismMotion {
) { ) {
this._motionData.curves.at(curveCount).type = this._motionData.curves.at(curveCount).type =
CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity;
} else {
CubismLogWarning(
'Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!'
);
} }
this._motionData.curves.at(curveCount).id = json.getMotionCurveId( this._motionData.curves.at(curveCount).id = json.getMotionCurveId(

View File

@ -215,7 +215,7 @@ export class CubismMotionQueueEntry {
* @return フェードアウト開始するかどうか * @return フェードアウト開始するかどうか
*/ */
public isTriggeredFadeOut(): boolean { public isTriggeredFadeOut(): boolean {
return this._isTriggeredFadeOut && this._endTimeSeconds < 0.0; return this._isTriggeredFadeOut;
} }
/** /**

View File

@ -38,7 +38,6 @@ export class CubismMotionQueueManager {
for (let i = 0; i < this._motions.getSize(); ++i) { for (let i = 0; i < this._motions.getSize(); ++i) {
if (this._motions.at(i)) { if (this._motions.at(i)) {
this._motions.at(i).release(); this._motions.at(i).release();
this._motions.set(i, void 0);
this._motions.set(i, null); this._motions.set(i, null);
} }
} }
@ -111,7 +110,6 @@ export class CubismMotionQueueManager {
if (motion == null) { if (motion == null) {
motionQueueEntry.release(); motionQueueEntry.release();
motionQueueEntry = void 0;
motionQueueEntry = null; motionQueueEntry = null;
ite = this._motions.erase(ite); // 削除 ite = this._motions.erase(ite); // 削除
continue; continue;
@ -137,7 +135,6 @@ export class CubismMotionQueueManager {
public isFinishedByHandle( public isFinishedByHandle(
motionQueueEntryNumber: CubismMotionQueueEntryHandle motionQueueEntryNumber: CubismMotionQueueEntryHandle
): boolean { ): boolean {
// 既にモーションがあれば終了フラグを立てる
for ( for (
let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); let ite: iterator<CubismMotionQueueEntry> = this._motions.begin();
ite.notEqual(this._motions.end()); ite.notEqual(this._motions.end());
@ -181,7 +178,6 @@ export class CubismMotionQueueManager {
// ----- 終了済みの処理があれば削除する ------ // ----- 終了済みの処理があれば削除する ------
motionQueueEntry.release(); motionQueueEntry.release();
motionQueueEntry = void 0;
motionQueueEntry = null; motionQueueEntry = null;
ite = this._motions.erase(ite); // 削除 ite = this._motions.erase(ite); // 削除
} }
@ -198,7 +194,6 @@ export class CubismMotionQueueManager {
motionQueueEntryNumber: any motionQueueEntryNumber: any
): CubismMotionQueueEntry { ): CubismMotionQueueEntry {
//------- 処理を行う ------- //------- 処理を行う -------
// 既にモーションがあれば終了フラグを立てる
for ( for (
let ite: iterator<CubismMotionQueueEntry> = this._motions.begin(); let ite: iterator<CubismMotionQueueEntry> = this._motions.begin();
ite.notEqual(this._motions.end()); ite.notEqual(this._motions.end());
@ -262,7 +257,6 @@ export class CubismMotionQueueManager {
if (motion == null) { if (motion == null) {
motionQueueEntry.release(); motionQueueEntry.release();
motionQueueEntry = void 0;
motionQueueEntry = null; motionQueueEntry = null;
ite = this._motions.erase(ite); // 削除 ite = this._motions.erase(ite); // 削除
@ -289,7 +283,6 @@ export class CubismMotionQueueManager {
// ------ 終了済みの処理があれば削除する ------ // ------ 終了済みの処理があれば削除する ------
if (motionQueueEntry.isFinished()) { if (motionQueueEntry.isFinished()) {
motionQueueEntry.release(); motionQueueEntry.release();
motionQueueEntry = void 0;
motionQueueEntry = null; motionQueueEntry = null;
ite = this._motions.erase(ite); // 削除 ite = this._motions.erase(ite); // 削除
} else { } else {