diff --git a/src/motion/cubismmotionjson.ts b/src/motion/cubismmotionjson.ts index ee55db0..eace15b 100644 --- a/src/motion/cubismmotionjson.ts +++ b/src/motion/cubismmotionjson.ts @@ -8,7 +8,6 @@ import { CubismIdHandle } from '../id/cubismid'; import { CubismFramework } from '../live2dcubismframework'; import { csmString } from '../type/csmstring'; -import { csmVector } from '../type/csmvector'; import { CubismJson } from '../utils/cubismjson'; // JSON keys @@ -226,12 +225,12 @@ export class CubismMotionJson { * @return false 存在しない */ public isExistMotionCurveFadeInTime(curveIndex: number): boolean { - const value = this._json + return !this._json .getRoot() .getValueByString(Curves) .getValueByIndex(curveIndex) - .getValueByString(FadeInTime); - return !(value.isNull() || value.isError()); + .getValueByString(FadeInTime) + .isNull(); } /** @@ -241,12 +240,12 @@ export class CubismMotionJson { * @return false 存在しない */ public isExistMotionCurveFadeOutTime(curveIndex: number): boolean { - const value = this._json + return !this._json .getRoot() .getValueByString(Curves) .getValueByIndex(curveIndex) - .getValueByString(FadeOutTime); - return !(value.isNull() || value.isError()); + .getValueByString(FadeOutTime) + .isNull(); } /** @@ -288,7 +287,7 @@ export class CubismMotionJson { .getValueByString(Curves) .getValueByIndex(curveIndex) .getValueByString(Segments) - .getVector(new csmVector()) + .getVector() .getSize(); } diff --git a/src/utils/cubismjson.ts b/src/utils/cubismjson.ts index c05d33d..d8097a0 100644 --- a/src/utils/cubismjson.ts +++ b/src/utils/cubismjson.ts @@ -74,7 +74,7 @@ export abstract class Value { /** * 要素をコンテナで返す(array) */ - public getVector(defaultValue?: csmVector): csmVector { + public getVector(defaultValue = new csmVector()): csmVector { return defaultValue; } @@ -192,11 +192,8 @@ export abstract class Value { public static staticInitializeNotForClientCall(): void { JsonBoolean.trueValue = new JsonBoolean(true); JsonBoolean.falseValue = new JsonBoolean(false); - - JsonError.errorValue = new JsonError('ERROR', true); - this.nullValue = new JsonNullvalue(); - this.errorValue = new JsonError('ERROR', true); - + Value.errorValue = new JsonError('ERROR', true); + Value.nullValue = new JsonNullvalue(); Value.s_dummyKeys = new csmVector(); } @@ -206,13 +203,7 @@ export abstract class Value { public static staticReleaseNotForClientCall(): void { JsonBoolean.trueValue = null; JsonBoolean.falseValue = null; - JsonError.errorValue = null; - Value.nullValue = null; - Value.s_dummyKeys = null; - - JsonBoolean.trueValue = null; - JsonBoolean.falseValue = null; - JsonError.errorValue = null; + Value.errorValue = null; Value.nullValue = null; Value.s_dummyKeys = null; } @@ -971,6 +962,14 @@ export class JsonNullvalue extends Value { return true; } + /** + * Valueにエラー値をセットする + */ + public setErrorNotForClientCall(s: string): Value { + this._stringBuffer = s; + return JsonError.nullValue; + } + /** * コンストラクタ */