From 81dc94c7e3b4e0d9e25e8a15c6d5cc28d9d2adc4 Mon Sep 17 00:00:00 2001 From: cubism-dev Date: Tue, 19 Mar 2019 12:39:20 +0900 Subject: [PATCH 1/2] Fix for static release. --- Framework/live2dcubismframework.ts | 4 ++-- Framework/rendering/cubismrenderer.ts | 18 +++++++----------- Framework/rendering/cubismrenderer_WebGL.ts | 8 +++++++- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Framework/live2dcubismframework.ts b/Framework/live2dcubismframework.ts index 49026e4..322ee19 100644 --- a/Framework/live2dcubismframework.ts +++ b/Framework/live2dcubismframework.ts @@ -203,10 +203,10 @@ export namespace Live2DCubismFramework Value.staticReleaseNotForClientCall(); s_cubismIdManager.release(); - s_cubismIdManager = void 0; + s_cubismIdManager = null; // レンダラの静的リソース(シェーダプログラム他)を解放する - CubismRenderer.StaticRelease(); + CubismRenderer.staticRelease(); s_isInitialized = false; diff --git a/Framework/rendering/cubismrenderer.ts b/Framework/rendering/cubismrenderer.ts index e70282a..8483dcb 100644 --- a/Framework/rendering/cubismrenderer.ts +++ b/Framework/rendering/cubismrenderer.ts @@ -34,18 +34,9 @@ export namespace Live2DCubismFramework */ public static delete(renderer: CubismRenderer): void { - renderer = void 0; renderer = null; } - /** - * レンダラが保持する静的なリソースを開放する - */ - public static StaticRelease(): void - { - //CubismRenderer_WebGL.doStaticRelease(); - } - /** * レンダラの初期化処理を実行する * 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる @@ -251,11 +242,16 @@ export namespace Live2DCubismFramework indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array, opacity: number, colorBlendMode: CubismBlendMode): void; + /** + * レンダラが保持する静的なリソースを開放する + */ + public static staticRelease: Function; + protected _mvpMatrix4x4: CubismMatrix44; // Model-View-Projection 行列 - protected _modelColor: CubismTextureColor; // モデル自体のカラー(RGBA) + protected _modelColor: CubismTextureColor; // モデル自体のカラー(RGBA) protected _isCulling: boolean; // カリングが有効ならtrue protected _isPremultipliedAlpha: boolean; // 乗算済みαならtrue - protected _anisortopy: any; // テクスチャの異方性フィルタリングのパラメータ + protected _anisortopy: any; // テクスチャの異方性フィルタリングのパラメータ protected _model: CubismModel; // レンダリング対象のモデル } diff --git a/Framework/rendering/cubismrenderer_WebGL.ts b/Framework/rendering/cubismrenderer_WebGL.ts index e84248e..084748e 100644 --- a/Framework/rendering/cubismrenderer_WebGL.ts +++ b/Framework/rendering/cubismrenderer_WebGL.ts @@ -816,7 +816,6 @@ export namespace Live2DCubismFramework if(s_instance) { s_instance.release(); - s_instance = void 0; s_instance = null; } } @@ -1717,4 +1716,11 @@ export namespace Live2DCubismFramework gl: WebGLRenderingContext; // webglコンテキスト } + /** + * レンダラが保持する静的なリソースを開放する + */ + CubismRenderer.staticRelease = (): void => + { + CubismRenderer_WebGL.doStaticRelease(); + } } \ No newline at end of file From e0b826169a2f094437349571553786b5c2e93ea3 Mon Sep 17 00:00:00 2001 From: cubism-dev Date: Tue, 19 Mar 2019 12:41:23 +0900 Subject: [PATCH 2/2] Fix json parsing. --- Framework/utils/cubismjson.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Framework/utils/cubismjson.ts b/Framework/utils/cubismjson.ts index 5389d8c..32de14b 100644 --- a/Framework/utils/cubismjson.ts +++ b/Framework/utils/cubismjson.ts @@ -212,7 +212,7 @@ export namespace Live2DCubismFramework */ public setErrorNotForClientCall(errorStr: string): Value { - return Value.errorValue; + return JsonError.errorValue; } /** @@ -234,11 +234,11 @@ export namespace Live2DCubismFramework */ public static staticReleaseNotForClientCall(): void { - JsonBoolean.trueValue = void 0; - JsonBoolean.falseValue = void 0; - JsonError.errorValue = void 0; - Value.nullValue = void 0; - Value.s_dummyKeys = void 0; + JsonBoolean.trueValue = null; + JsonBoolean.falseValue = null; + JsonError.errorValue = null; + Value.nullValue = null; + Value.s_dummyKeys = null; JsonBoolean.trueValue = null; JsonBoolean.falseValue = null; @@ -296,7 +296,6 @@ export namespace Live2DCubismFramework if(!succeeded) { CubismJson.delete(json); - console.log("parseBytes is failed"); return null; } else @@ -312,7 +311,6 @@ export namespace Live2DCubismFramework */ public static delete(instance: CubismJson) { - instance = void 0; instance = null; } @@ -369,7 +367,6 @@ export namespace Live2DCubismFramework if(this._error) { - console.log(this._error); let strbuf: string = '\0'; strbuf = "Json parse error : @line " + (this._lineCount + 1) + "\n"; this._root = new JsonString(strbuf);