diff --git a/.gitignore b/.gitignore index 2b3b243..c92aa83 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ dist/ .vscode/* !/.vscode/extensions.json !/.vscode/launch.json +!/.vscode/settings.json !/.vscode/tasks.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..aba2918 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "./Samples/TypeScript/Demo/node_modules/typescript/lib" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index c23e7b2..65e24bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +* Avoiding needless namespace syntax to simplify imports by [@cocor-au-lait](https://github.com/cocor-au-lait) ## [4-r.1] - 2020-01-30 diff --git a/Framework b/Framework index bd2872a..c80e158 160000 --- a/Framework +++ b/Framework @@ -1 +1 @@ -Subproject commit bd2872a5b1288799b3d50e6379772af992b32ac9 +Subproject commit c80e158a66550c5538dca0caf4c542a4bd37022c diff --git a/Samples/TypeScript/Demo/package.json b/Samples/TypeScript/Demo/package.json index 19fa055..b2af5df 100644 --- a/Samples/TypeScript/Demo/package.json +++ b/Samples/TypeScript/Demo/package.json @@ -5,8 +5,8 @@ "build": "webpack -d --hide-modules", "build:prod": "webpack -p --hide-modules", "test": "tsc --noEmit", - "lint": "eslint src -f codeframe --ext .ts", - "lint:fix": "eslint src -f codeframe --ext .ts --fix", + "lint": "eslint src --ext .ts", + "lint:fix": "eslint src --ext .ts --fix", "serve": "serve ../../.. -p 5000", "clean": "rimraf dist" }, diff --git a/Samples/TypeScript/Demo/src/lappdelegate.ts b/Samples/TypeScript/Demo/src/lappdelegate.ts index 8102cd5..30cf77a 100644 --- a/Samples/TypeScript/Demo/src/lappdelegate.ts +++ b/Samples/TypeScript/Demo/src/lappdelegate.ts @@ -5,16 +5,13 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ -import { - Live2DCubismFramework as live2dcubismframework, - Option as Csm_Option -} from '@framework/live2dcubismframework'; -import Csm_CubismFramework = live2dcubismframework.CubismFramework; -import { LAppView } from './lappview'; +import { CubismFramework, Option } from '@framework/live2dcubismframework'; + +import * as LAppDefine from './lappdefine'; +import { LAppLive2DManager } from './lapplive2dmanager'; import { LAppPal } from './lapppal'; import { LAppTextureManager } from './lapptexturemanager'; -import { LAppLive2DManager } from './lapplive2dmanager'; -import * as LAppDefine from './lappdefine'; +import { LAppView } from './lappview'; export let canvas: HTMLCanvasElement = null; export let s_instance: LAppDelegate = null; @@ -124,7 +121,7 @@ export class LAppDelegate { LAppLive2DManager.releaseInstance(); // Cubism SDKの解放 - Csm_CubismFramework.dispose(); + CubismFramework.dispose(); } /** @@ -250,7 +247,7 @@ export class LAppDelegate { this._mouseY = 0.0; this._isEnd = false; - this._cubismOption = new Csm_Option(); + this._cubismOption = new Option(); this._view = new LAppView(); this._textureManager = new LAppTextureManager(); } @@ -262,10 +259,10 @@ export class LAppDelegate { // setup cubism this._cubismOption.logFunction = LAppPal.printMessage; this._cubismOption.loggingLevel = LAppDefine.CubismLoggingLevel; - Csm_CubismFramework.startUp(this._cubismOption); + CubismFramework.startUp(this._cubismOption); // initialize cubism - Csm_CubismFramework.initialize(); + CubismFramework.initialize(); // load model LAppLive2DManager.getInstance(); @@ -275,7 +272,7 @@ export class LAppDelegate { this._view.initializeSprite(); } - _cubismOption: Csm_Option; // Cubism SDK Option + _cubismOption: Option; // Cubism SDK Option _view: LAppView; // View情報 _captured: boolean; // クリックしているか _mouseX: number; // マウスX座標 diff --git a/Samples/TypeScript/Demo/src/lapplive2dmanager.ts b/Samples/TypeScript/Demo/src/lapplive2dmanager.ts index 35f9666..1ae519f 100644 --- a/Samples/TypeScript/Demo/src/lapplive2dmanager.ts +++ b/Samples/TypeScript/Demo/src/lapplive2dmanager.ts @@ -5,17 +5,14 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ -import { Live2DCubismFramework as cubismmatrix44 } from '@framework/math/cubismmatrix44'; -import { Live2DCubismFramework as csmvector } from '@framework/type/csmvector'; -import { Live2DCubismFramework as acubismmotion } from '@framework/motion/acubismmotion'; -import Csm_csmVector = csmvector.csmVector; -import Csm_CubismMatrix44 = cubismmatrix44.CubismMatrix44; -import ACubismMotion = acubismmotion.ACubismMotion; +import { CubismMatrix44 } from '@framework/math/cubismmatrix44'; +import { ACubismMotion } from '@framework/motion/acubismmotion'; +import { csmVector } from '@framework/type/csmvector'; +import * as LAppDefine from './lappdefine'; +import { canvas } from './lappdelegate'; import { LAppModel } from './lappmodel'; import { LAppPal } from './lapppal'; -import { canvas } from './lappdelegate'; -import * as LAppDefine from './lappdefine'; export let s_instance: LAppLive2DManager = null; @@ -134,7 +131,7 @@ export class LAppLive2DManager { * モデルの更新処理及び描画処理を行う */ public onUpdate(): void { - let projection: Csm_CubismMatrix44 = new Csm_CubismMatrix44(); + let projection: CubismMatrix44 = new CubismMatrix44(); const { width, height } = canvas; projection.scale(1.0, width / height); @@ -143,7 +140,7 @@ export class LAppLive2DManager { projection.multiplyByMatrix(this._viewMatrix); } - const saveProjection: Csm_CubismMatrix44 = projection.clone(); + const saveProjection: CubismMatrix44 = projection.clone(); const modelCount: number = this._models.getSize(); for (let i = 0; i < modelCount; ++i) { @@ -191,14 +188,14 @@ export class LAppLive2DManager { * コンストラクタ */ constructor() { - this._viewMatrix = new Csm_CubismMatrix44(); - this._models = new Csm_csmVector(); + this._viewMatrix = new CubismMatrix44(); + this._models = new csmVector(); this._sceneIndex = 0; this.changeScene(this._sceneIndex); } - _viewMatrix: Csm_CubismMatrix44; // モデル描画に用いるview行列 - _models: Csm_csmVector; // モデルインスタンスのコンテナ + _viewMatrix: CubismMatrix44; // モデル描画に用いるview行列 + _models: csmVector; // モデルインスタンスのコンテナ _sceneIndex: number; // 表示するシーンのインデックス値 // モーション再生終了のコールバック関数 _finishedMotion = (self: ACubismMotion): void => { diff --git a/Samples/TypeScript/Demo/src/lappmodel.ts b/Samples/TypeScript/Demo/src/lappmodel.ts index ddd8e38..6112d3d 100644 --- a/Samples/TypeScript/Demo/src/lappmodel.ts +++ b/Samples/TypeScript/Demo/src/lappmodel.ts @@ -5,48 +5,39 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ -import { Live2DCubismFramework as live2dcubismframework } from '@framework/live2dcubismframework'; -import { Live2DCubismFramework as cubismid } from '@framework/id/cubismid'; -import { Live2DCubismFramework as cubismusermodel } from '@framework/model/cubismusermodel'; -import { Live2DCubismFramework as icubismmodelsetting } from '@framework/icubismmodelsetting'; -import { Live2DCubismFramework as cubismmodelsettingjson } from '@framework/cubismmodelsettingjson'; -import { Live2DCubismFramework as cubismdefaultparameterid } from '@framework/cubismdefaultparameterid'; -import { Live2DCubismFramework as acubismmotion } from '@framework/motion/acubismmotion'; -import { Live2DCubismFramework as cubismeyeblink } from '@framework/effect/cubismeyeblink'; -import { Live2DCubismFramework as cubismbreath } from '@framework/effect/cubismbreath'; -import { Live2DCubismFramework as csmvector } from '@framework/type/csmvector'; -import { Live2DCubismFramework as csmmap } from '@framework/type/csmmap'; -import { Live2DCubismFramework as cubismmatrix44 } from '@framework/math/cubismmatrix44'; -import { Live2DCubismFramework as cubismmotion } from '@framework/motion/cubismmotion'; -import { Live2DCubismFramework as cubismmotionqueuemanager } from '@framework/motion/cubismmotionqueuemanager'; -import { Live2DCubismFramework as csmstring } from '@framework/type/csmstring'; -import { Live2DCubismFramework as csmrect } from '@framework/type/csmrectf'; +import 'whatwg-fetch'; + +import { CubismDefaultParameterId } from '@framework/cubismdefaultparameterid'; +import { CubismModelSettingJson } from '@framework/cubismmodelsettingjson'; +import { + BreathParameterData, + CubismBreath +} from '@framework/effect/cubismbreath'; +import { CubismEyeBlink } from '@framework/effect/cubismeyeblink'; +import { ICubismModelSetting } from '@framework/icubismmodelsetting'; +import { CubismIdHandle } from '@framework/id/cubismid'; +import { CubismFramework } from '@framework/live2dcubismframework'; +import { CubismMatrix44 } from '@framework/math/cubismmatrix44'; +import { CubismUserModel } from '@framework/model/cubismusermodel'; +import { + ACubismMotion, + FinishedMotionCallback +} from '@framework/motion/acubismmotion'; +import { CubismMotion } from '@framework/motion/cubismmotion'; +import { + CubismMotionQueueEntryHandle, + InvalidMotionQueueEntryHandleValue +} from '@framework/motion/cubismmotionqueuemanager'; +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 { CubismLogInfo } from '@framework/utils/cubismdebug'; -import csmRect = csmrect.csmRect; -import csmString = csmstring.csmString; -import InvalidMotionQueueEntryHandleValue = cubismmotionqueuemanager.InvalidMotionQueueEntryHandleValue; -import CubismMotionQueueEntryHandle = cubismmotionqueuemanager.CubismMotionQueueEntryHandle; -import CubismMotion = cubismmotion.CubismMotion; -import CubismMatrix44 = cubismmatrix44.CubismMatrix44; -import csmMap = csmmap.csmMap; -import csmVector = csmvector.csmVector; -import CubismBreath = cubismbreath.CubismBreath; -import BreathParameterData = cubismbreath.BreathParameterData; -import CubismEyeBlink = cubismeyeblink.CubismEyeBlink; -import ACubismMotion = acubismmotion.ACubismMotion; -import FinishedMotionCallback = acubismmotion.FinishedMotionCallback; -import CubismFramework = live2dcubismframework.CubismFramework; -import CubismIdHandle = cubismid.CubismIdHandle; -import CubismUserModel = cubismusermodel.CubismUserModel; -import ICubismModelSetting = icubismmodelsetting.ICubismModelSetting; -import CubismModelSettingJson = cubismmodelsettingjson.CubismModelSettingJson; -import CubismDefaultParameterId = cubismdefaultparameterid; +import * as LAppDefine from './lappdefine'; +import { canvas, frameBuffer, gl, LAppDelegate } from './lappdelegate'; import { LAppPal } from './lapppal'; -import { gl, canvas, frameBuffer, LAppDelegate } from './lappdelegate'; import { TextureInfo } from './lapptexturemanager'; -import * as LAppDefine from './lappdefine'; -import 'whatwg-fetch'; enum LoadStep { LoadAssets, diff --git a/Samples/TypeScript/Demo/src/lappsprite.ts b/Samples/TypeScript/Demo/src/lappsprite.ts index d3be40b..39e82b7 100644 --- a/Samples/TypeScript/Demo/src/lappsprite.ts +++ b/Samples/TypeScript/Demo/src/lappsprite.ts @@ -5,7 +5,7 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ -import { gl, canvas } from './lappdelegate'; +import { canvas, gl } from './lappdelegate'; /** * スプライトを実装するクラス diff --git a/Samples/TypeScript/Demo/src/lapptexturemanager.ts b/Samples/TypeScript/Demo/src/lapptexturemanager.ts index 509b925..b43f540 100644 --- a/Samples/TypeScript/Demo/src/lapptexturemanager.ts +++ b/Samples/TypeScript/Demo/src/lapptexturemanager.ts @@ -5,9 +5,8 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ -import { Live2DCubismFramework as csmvector } from '@framework/type/csmvector'; -import Csm_csmVector = csmvector.csmVector; -import csmVector_iterator = csmvector.iterator; +import { csmVector, iterator } from '@framework/type/csmvector'; + import { gl } from './lappdelegate'; /** @@ -19,7 +18,7 @@ export class LAppTextureManager { * コンストラクタ */ constructor() { - this._textures = new Csm_csmVector(); + this._textures = new csmVector(); } /** @@ -27,7 +26,7 @@ export class LAppTextureManager { */ public release(): void { for ( - let ite: csmVector_iterator = this._textures.begin(); + let ite: iterator = this._textures.begin(); ite.notEqual(this._textures.end()); ite.preIncrement() ) { @@ -50,7 +49,7 @@ export class LAppTextureManager { ): void { // search loaded texture already for ( - let ite: csmVector_iterator = this._textures.begin(); + let ite: iterator = this._textures.begin(); ite.notEqual(this._textures.end()); ite.preIncrement() ) { @@ -162,7 +161,7 @@ export class LAppTextureManager { } } - _textures: Csm_csmVector; + _textures: csmVector; } /** diff --git a/Samples/TypeScript/Demo/src/lappview.ts b/Samples/TypeScript/Demo/src/lappview.ts index 263b98f..d0e5e7a 100644 --- a/Samples/TypeScript/Demo/src/lappview.ts +++ b/Samples/TypeScript/Demo/src/lappview.ts @@ -5,17 +5,16 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ -import { Live2DCubismFramework as cubismMatrix44 } from '@framework/math/cubismmatrix44'; -import { Live2DCubismFramework as cubismviewmatrix } from '@framework/math/cubismviewmatrix'; -import Csm_CubismViewMatrix = cubismviewmatrix.CubismViewMatrix; -import Csm_CubismMatrix44 = cubismMatrix44.CubismMatrix44; -import { TouchManager } from './touchmanager'; +import { CubismMatrix44 } from '@framework/math/cubismmatrix44'; +import { CubismViewMatrix } from '@framework/math/cubismviewmatrix'; + +import * as LAppDefine from './lappdefine'; +import { canvas, gl, LAppDelegate } from './lappdelegate'; import { LAppLive2DManager } from './lapplive2dmanager'; -import { LAppDelegate, canvas, gl } from './lappdelegate'; +import { LAppPal } from './lapppal'; import { LAppSprite } from './lappsprite'; import { TextureInfo } from './lapptexturemanager'; -import { LAppPal } from './lapppal'; -import * as LAppDefine from './lappdefine'; +import { TouchManager } from './touchmanager'; /** * 描画クラス。 @@ -33,10 +32,10 @@ export class LAppView { this._touchManager = new TouchManager(); // デバイス座標からスクリーン座標に変換するための - this._deviceToScreen = new Csm_CubismMatrix44(); + this._deviceToScreen = new CubismMatrix44(); // 画面の表示の拡大縮小や移動の変換を行う行列 - this._viewMatrix = new Csm_CubismViewMatrix(); + this._viewMatrix = new CubismViewMatrix(); } /** @@ -257,8 +256,8 @@ export class LAppView { } _touchManager: TouchManager; // タッチマネージャー - _deviceToScreen: Csm_CubismMatrix44; // デバイスからスクリーンへの行列 - _viewMatrix: Csm_CubismViewMatrix; // viewMatrix + _deviceToScreen: CubismMatrix44; // デバイスからスクリーンへの行列 + _viewMatrix: CubismViewMatrix; // viewMatrix _programId: WebGLProgram; // シェーダID _back: LAppSprite; // 背景画像 _gear: LAppSprite; // ギア画像