forked from vvj-rares/renderfarm.js-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decouple three bindings and three-maxscript bridge, make them injecta…
…ble from inversify
- Loading branch information
Showing
8 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { injectable } from "inversify"; | ||
import { ISceneObjectBinding } from "../../interfaces"; | ||
|
||
@injectable() | ||
export class SceneBinding implements ISceneObjectBinding { | ||
public async PostObject(objectJson: any): Promise<string> { | ||
return JSON.stringify(objectJson); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import { injectable, inject } from "inversify"; | ||
import { injectable, inject, multiInject } from "inversify"; | ||
import { TYPES } from "../types"; | ||
import { IFactory, IMaxscriptClient, ISessionPool, IThreeMaxscriptBridge } from "../interfaces"; | ||
import { IFactory, IMaxscriptClient, ISessionPool, IThreeMaxscriptBridge, ISceneObjectBinding } from "../interfaces"; | ||
import { Session } from "../database/model/session"; | ||
import { ThreeMaxscriptBridge } from "./three_maxscript_bridge"; | ||
|
||
@injectable() | ||
export class ThreeMaxscriptBridgeFactory implements IFactory<IThreeMaxscriptBridge> { | ||
private _maxscriptClientPool: ISessionPool<IMaxscriptClient>; | ||
private _sceneObjectBindings: ISceneObjectBinding[]; | ||
|
||
constructor( | ||
@inject(TYPES.IMaxscriptClientPool) maxscriptClientPool: ISessionPool<IMaxscriptClient>, | ||
@multiInject(TYPES.ISceneObjectBinding) sceneObjectBindings: ISceneObjectBinding[], | ||
) { | ||
this._maxscriptClientPool = maxscriptClientPool; | ||
this._sceneObjectBindings = sceneObjectBindings; | ||
} | ||
|
||
public async Create(session: Session): Promise<IThreeMaxscriptBridge> { | ||
let maxscript: IMaxscriptClient = await this._maxscriptClientPool.Get(session); | ||
return new ThreeMaxscriptBridge(maxscript); | ||
return new ThreeMaxscriptBridge(maxscript, this._sceneObjectBindings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters