@babylonjs/core 6.28.0 → 6.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animatable.js +1 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +1 -1
- package/Animations/animation.js.map +1 -1
- package/Animations/animationKey.d.ts +5 -0
- package/Animations/animationKey.js.map +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js +2 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Cameras/arcRotateCamera.js +37 -13
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +21 -0
- package/Cameras/camera.js +35 -0
- package/Cameras/camera.js.map +1 -1
- package/Cameras/targetCamera.js +51 -30
- package/Cameras/targetCamera.js.map +1 -1
- package/Debug/debugLayer.d.ts +4 -0
- package/Debug/debugLayer.js +12 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/constants.d.ts +2 -0
- package/Engines/constants.js +2 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +2 -2
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +21 -9
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -8
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +2 -8
- package/FlowGraph/flowGraph.js +2 -9
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +1 -0
- package/FlowGraph/flowGraphBlock.js +3 -0
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +20 -2
- package/FlowGraph/flowGraphContext.js +37 -33
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphContextLogger.d.ts +9 -0
- package/FlowGraph/flowGraphContextLogger.js +14 -0
- package/FlowGraph/flowGraphContextLogger.js.map +1 -0
- package/FlowGraph/flowGraphCoordinator.d.ts +14 -5
- package/FlowGraph/flowGraphCoordinator.js +27 -3
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.js +1 -0
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.js +1 -0
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +1 -0
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/index.d.ts +1 -1
- package/FlowGraph/index.js +1 -1
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/serialization.d.ts +16 -0
- package/FlowGraph/serialization.js +79 -0
- package/FlowGraph/serialization.js.map +1 -0
- package/Materials/Textures/baseTexture.d.ts +2 -1
- package/Materials/Textures/baseTexture.js +12 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +2 -0
- package/Materials/Textures/renderTargetTexture.js +5 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -0
- package/Materials/Textures/texture.js +8 -3
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/materialPluginManager.js +1 -1
- package/Materials/materialPluginManager.js.map +1 -1
- package/Maths/math.vector.js +41 -26
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/textBuilder.js +0 -1
- package/Meshes/Builders/textBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +2 -2
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/abstractMesh.js +13 -9
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.d.ts +8 -8
- package/Meshes/csg.js +12 -12
- package/Meshes/csg.js.map +1 -1
- package/Misc/deepCopier.d.ts +3 -1
- package/Misc/deepCopier.js +7 -5
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/observable.d.ts +6 -2
- package/Misc/observable.js +0 -14
- package/Misc/observable.js.map +1 -1
- package/Misc/precisionDate.js +2 -4
- package/Misc/precisionDate.js.map +1 -1
- package/Rendering/renderingManager.d.ts +4 -0
- package/Rendering/renderingManager.js +18 -13
- package/Rendering/renderingManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +6 -0
- package/scene.js +11 -1
- package/scene.js.map +1 -1
- package/FlowGraph/flowGraphCustomEvent.d.ts +0 -5
- package/FlowGraph/flowGraphCustomEvent.js +0 -2
- package/FlowGraph/flowGraphCustomEvent.js.map +0 -1
- package/FlowGraph/flowGraphEventCoordinator.d.ts +0 -23
- package/FlowGraph/flowGraphEventCoordinator.js +0 -37
- package/FlowGraph/flowGraphEventCoordinator.js.map +0 -1
- package/FlowGraph/flowGraphVariableDefinitions.d.ts +0 -32
- package/FlowGraph/flowGraphVariableDefinitions.js +0 -51
- package/FlowGraph/flowGraphVariableDefinitions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,CACH,SAAS,KAAK,MAAM;QACpB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,WAAW;QACzB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,iBAAiB;QAC/B,SAAS,KAAK,WAAW,CAC5B,CAAC;AACN,CAAC;AAED,SAAS,iCAAiC,CAAC,GAAW,EAAE,KAAU,EAAE,mBAAwB;IACxF,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,KAAI,eAAe,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,EAAE,CAAC,EAAE;QAC/D,mBAAmB,CAAC,GAAG,CAAC,GAAG;YACvB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,YAAY,EAAE;SAClC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ourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraphEventCoordinator } from \"./flowGraphEventCoordinator\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\n\r\nfunction isMeshClassName(className: string) {\r\n return (\r\n className === \"Mesh\" ||\r\n className === \"AbstractMesh\" ||\r\n className === \"GroundMesh\" ||\r\n className === \"InstanceMesh\" ||\r\n className === \"LinesMesh\" ||\r\n className === \"GoldbergMesh\" ||\r\n className === \"GreasedLineMesh\" ||\r\n className === \"TrailMesh\"\r\n );\r\n}\r\n\r\nfunction defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n if (value?.getClassName && isMeshClassName(value?.getClassName())) {\r\n serializationObject[key] = {\r\n name: value.name,\r\n className: value.getClassName(),\r\n };\r\n } else {\r\n serializationObject[key] = value;\r\n }\r\n}\r\n\r\nfunction defaultValueParseFunction(key: string, serializationObject: any, scene: Scene) {\r\n const value = serializationObject[key];\r\n let finalValue;\r\n const className = value?.className;\r\n if (isMeshClassName(className)) {\r\n finalValue = scene.getMeshByName(value.name);\r\n } else {\r\n finalValue = value;\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly eventCoordinator: FlowGraphEventCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return this._userVariables.has(name);\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables.set(name, value);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables.get(name);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables.set(this._getUniqueIdPrefixedName(block, name), value);\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables.get(this._getUniqueIdPrefixedName(block, name));\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n this._executionVariables.delete(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._executionVariables.has(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return this._connectionValues.has(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues.set(connectionPoint.uniqueId, value);\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues.get(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n this._userVariables.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._userVariables);\r\n });\r\n serializationObject._connectionValues = {};\r\n this._connectionValues.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._connectionValues);\r\n });\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(\r\n serializationObject: any = {},\r\n graph: FlowGraph,\r\n valueParseFunction: (key: string, serializationObject: any, scene: Scene) => any = defaultValueParseFunction\r\n ): FlowGraphContext {\r\n const result = graph.createContext();\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables.set(key, value);\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues.set(key, value);\r\n }\r\n\r\n return result;\r\n }\r\n}\r\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AAC;QAClF,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,YAAY;QACf,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CACf,sBAA2B,EAAE,EAC7B,KAAgB,EAChB,qBAAmF,yBAAyB;QAE5G,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACrC,MAAM,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAC/C,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,cAAc,EAAE;YAClD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACvG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC5C;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAjRU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return this._userVariables.has(name);\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables.set(name, value);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables.get(name);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables.set(this._getUniqueIdPrefixedName(block, name), value);\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables.get(this._getUniqueIdPrefixedName(block, name));\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n this._executionVariables.delete(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._executionVariables.has(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return this._connectionValues.has(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues.set(connectionPoint.uniqueId, value);\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues.get(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n private _getEnclosedSubstring(subString: string): string {\r\n return `{${subString}}`;\r\n }\r\n\r\n /** @internal */\r\n public _getTargetFromPath(path: string, subString: string, block: FlowGraphBlock) {\r\n let finalPath = path;\r\n if (subString && path.indexOf(this._getEnclosedSubstring(subString)) !== -1) {\r\n const nodeToSub = block.getDataInput(subString);\r\n if (!nodeToSub) {\r\n throw new Error(`Invalid substitution input for substitution string ${subString}`);\r\n }\r\n const index = Math.floor(nodeToSub.getValue(this));\r\n if (isNaN(index)) {\r\n throw new Error(`Invalid substitution value for substitution string ${subString}`);\r\n }\r\n finalPath = path.replace(this._getEnclosedSubstring(subString), index.toString());\r\n }\r\n return this.getVariable(finalPath);\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n this._userVariables.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._userVariables);\r\n });\r\n serializationObject._connectionValues = {};\r\n this._connectionValues.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._connectionValues);\r\n });\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(\r\n serializationObject: any = {},\r\n graph: FlowGraph,\r\n valueParseFunction: (key: string, serializationObject: any, scene: Scene) => any = defaultValueParseFunction\r\n ): FlowGraphContext {\r\n const result = graph.createContext();\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables.set(key, value);\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues.set(key, value);\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FlowGraphContext } from "./flowGraphContext";
|
|
2
|
+
/**
|
|
3
|
+
* @experimental
|
|
4
|
+
* This class is a decorator for the context which logs the nodes that were executed.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FlowGraphContextLogger {
|
|
7
|
+
private _context;
|
|
8
|
+
constructor(_context: FlowGraphContext);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tools } from "../Misc/tools.js";
|
|
2
|
+
/**
|
|
3
|
+
* @experimental
|
|
4
|
+
* This class is a decorator for the context which logs the nodes that were executed.
|
|
5
|
+
*/
|
|
6
|
+
export class FlowGraphContextLogger {
|
|
7
|
+
constructor(_context) {
|
|
8
|
+
this._context = _context;
|
|
9
|
+
this._context.onNodeExecutedObservable.add((node) => {
|
|
10
|
+
Tools.Log(`Node executed: ${node.getClassName()}`);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=flowGraphContextLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphContextLogger.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContextLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAC/B,YAAoB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;QAC1C,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAChD,KAAK,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n/**\r\n * @experimental\r\n * This class is a decorator for the context which logs the nodes that were executed.\r\n */\r\nexport class FlowGraphContextLogger {\r\n constructor(private _context: FlowGraphContext) {\r\n this._context.onNodeExecutedObservable.add((node) => {\r\n Tools.Log(`Node executed: ${node.getClassName()}`);\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Observable } from "../Misc/observable.js";
|
|
1
2
|
import type { Scene } from "../scene";
|
|
2
3
|
import { FlowGraph } from "./flowGraph";
|
|
3
|
-
import { FlowGraphEventCoordinator } from "./flowGraphEventCoordinator";
|
|
4
4
|
/**
|
|
5
5
|
* @experimental
|
|
6
6
|
* Parameters used to create a flow graph engine.
|
|
@@ -22,11 +22,8 @@ export declare class FlowGraphCoordinator {
|
|
|
22
22
|
* A list of all the coordinators per scene. Will be used by the inspector
|
|
23
23
|
*/
|
|
24
24
|
static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]>;
|
|
25
|
-
/**
|
|
26
|
-
* The event coordinator used by the flow graph coordinator.
|
|
27
|
-
*/
|
|
28
|
-
readonly eventCoordinator: FlowGraphEventCoordinator;
|
|
29
25
|
private readonly _flowGraphs;
|
|
26
|
+
private _customEventsMap;
|
|
30
27
|
constructor(_config: IFlowGraphCoordinatorConfiguration);
|
|
31
28
|
/**
|
|
32
29
|
* Creates a new flow graph and adds it to the list of existing flow graphs
|
|
@@ -48,4 +45,16 @@ export declare class FlowGraphCoordinator {
|
|
|
48
45
|
dispose(): void;
|
|
49
46
|
serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void): void;
|
|
50
47
|
static Parse(serializedObject: any, scene: Scene, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraphCoordinator;
|
|
48
|
+
/**
|
|
49
|
+
* Get an observable that will be notified when the event with the given id is fired.
|
|
50
|
+
* @param id the id of the event
|
|
51
|
+
* @returns the observable for the event
|
|
52
|
+
*/
|
|
53
|
+
getCustomEventObservable(id: string): Observable<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Notifies the observable for the given event id with the given data.
|
|
56
|
+
* @param id the id of the event
|
|
57
|
+
* @param data the data to send with the event
|
|
58
|
+
*/
|
|
59
|
+
notifyCustomEvent(id: string, data: any): void;
|
|
51
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Observable } from "../Misc/observable.js";
|
|
1
2
|
import { FlowGraph } from "./flowGraph.js";
|
|
2
|
-
import { FlowGraphEventCoordinator } from "./flowGraphEventCoordinator.js";
|
|
3
3
|
/**
|
|
4
4
|
* @experimental
|
|
5
5
|
* Parameters used to create a flow graph engine.
|
|
@@ -15,7 +15,7 @@ export class FlowGraphCoordinator {
|
|
|
15
15
|
var _a;
|
|
16
16
|
this._config = _config;
|
|
17
17
|
this._flowGraphs = [];
|
|
18
|
-
this.
|
|
18
|
+
this._customEventsMap = new Map();
|
|
19
19
|
// When the scene is disposed, dispose all graphs currently running on it.
|
|
20
20
|
this._config.scene.onDisposeObservable.add(() => {
|
|
21
21
|
this.dispose();
|
|
@@ -29,7 +29,7 @@ export class FlowGraphCoordinator {
|
|
|
29
29
|
* @returns a new flow graph
|
|
30
30
|
*/
|
|
31
31
|
createGraph() {
|
|
32
|
-
const graph = new FlowGraph({ scene: this._config.scene,
|
|
32
|
+
const graph = new FlowGraph({ scene: this._config.scene, coordinator: this });
|
|
33
33
|
this._flowGraphs.push(graph);
|
|
34
34
|
return graph;
|
|
35
35
|
}
|
|
@@ -80,6 +80,30 @@ export class FlowGraphCoordinator {
|
|
|
80
80
|
});
|
|
81
81
|
return coordinator;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Get an observable that will be notified when the event with the given id is fired.
|
|
85
|
+
* @param id the id of the event
|
|
86
|
+
* @returns the observable for the event
|
|
87
|
+
*/
|
|
88
|
+
getCustomEventObservable(id) {
|
|
89
|
+
let observable = this._customEventsMap.get(id);
|
|
90
|
+
if (!observable) {
|
|
91
|
+
observable = new Observable();
|
|
92
|
+
this._customEventsMap.set(id, observable);
|
|
93
|
+
}
|
|
94
|
+
return observable;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Notifies the observable for the given event id with the given data.
|
|
98
|
+
* @param id the id of the event
|
|
99
|
+
* @param data the data to send with the event
|
|
100
|
+
*/
|
|
101
|
+
notifyCustomEvent(id, data) {
|
|
102
|
+
const observable = this._customEventsMap.get(id);
|
|
103
|
+
if (observable) {
|
|
104
|
+
observable.notifyObservers(data);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
83
107
|
}
|
|
84
108
|
/**
|
|
85
109
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,OAAO,kCAAkC;CAK9C;AACD;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAW7B,YAAoB,OAA2C;;QAA3C,YAAO,GAAP,OAAO,CAAoC;QAJ9C,gBAAW,GAAgB,EAAE,CAAC;QAEvC,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAC;QAG/D,0EAA0E;QAC1E,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,8DAA8D;QAC9D,MAAM,YAAY,GAAG,MAAA,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC;QAC1F,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,WAAW;QACP,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAA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lowGraph } from \"./flowGraph\";\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport class IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n/**\r\n * This class holds all of the existing flow graphs and is responsible for creating new ones.\r\n * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator\r\n */\r\nexport class FlowGraphCoordinator {\r\n /**\r\n * @internal\r\n * A list of all the coordinators per scene. Will be used by the inspector\r\n */\r\n public static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]> = new Map();\r\n\r\n private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\r\n\r\n constructor(private _config: IFlowGraphCoordinatorConfiguration) {\r\n // When the scene is disposed, dispose all graphs currently running on it.\r\n this._config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this._config.scene) ?? [];\r\n coordinators.push(this);\r\n }\r\n\r\n /**\r\n * Creates a new flow graph and adds it to the list of existing flow graphs\r\n * @returns a new flow graph\r\n */\r\n createGraph(): FlowGraph {\r\n const graph = new FlowGraph({ scene: this._config.scene, coordinator: this });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n start() {\r\n this._flowGraphs.forEach((graph) => graph.start());\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n dispose() {\r\n this._flowGraphs.forEach((graph) => graph.dispose());\r\n this._flowGraphs.length = 0;\r\n\r\n // Remove itself from the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this._config.scene) ?? [];\r\n const index = coordinators.indexOf(this);\r\n if (index !== -1) {\r\n coordinators.splice(index, 1);\r\n }\r\n }\r\n\r\n serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject._flowGraphs = [];\r\n this._flowGraphs.forEach((graph) => {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n });\r\n }\r\n\r\n public static Parse(serializedObject: any, scene: Scene, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any) {\r\n const coordinator = new FlowGraphCoordinator({ scene });\r\n serializedObject._flowGraphs?.forEach((serializedGraph: any) => {\r\n FlowGraph.Parse(serializedGraph, coordinator, valueParseFunction);\r\n });\r\n return coordinator;\r\n }\r\n\r\n /**\r\n * Get an observable that will be notified when the event with the given id is fired.\r\n * @param id the id of the event\r\n * @returns the observable for the event\r\n */\r\n getCustomEventObservable(id: string): Observable<any> {\r\n let observable = this._customEventsMap.get(id);\r\n if (!observable) {\r\n observable = new Observable<any>();\r\n this._customEventsMap.set(id, observable);\r\n }\r\n return observable;\r\n }\r\n\r\n /**\r\n * Notifies the observable for the given event id with the given data.\r\n * @param id the id of the event\r\n * @param data the data to send with the event\r\n */\r\n notifyCustomEvent(id: string, data: any) {\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -53,6 +53,7 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
53
53
|
*/
|
|
54
54
|
getValue(context) {
|
|
55
55
|
if (this.connectionType === FlowGraphConnectionType.Output) {
|
|
56
|
+
context._notifyExecuteNode(this._ownerBlock);
|
|
56
57
|
this._ownerBlock._updateOutputs(context);
|
|
57
58
|
return this._getValueOrDefault(context);
|
|
58
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD;;;;;;GAMG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAC3G;;;;;;OAMG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B,EACnB,QAAqB;QAE5B,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAFjC,aAAQ,GAAR,QAAQ,CAAa;IAGhC,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,KAAK,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAQ,EAAE,OAAyB;QAC/C,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAEM,SAAS,CAAC,KAAiC;QAC9C,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAEO,kBAAkB,CAAC,OAAyB;QAChD,IAAI,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE;YACnC,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;SAC5C;aAAM;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;SACrC;IACL,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,OAAyB;QACrC,IAAI,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,MAAM,EAAE;YACxD,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YACrB,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;SAC3C;aAAM;YACH,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SACpD;IACL,CAAC;IAEM,YAAY;QACf,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAEM,SAAS,CAAC,sBAA2B,EAAE;QAC1C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,mBAAwB,EAAE,UAA0B;QACpE,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QACvE,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RichType } from \"./flowGraphRichTypes\";\r\n/**\r\n * @experimental\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n /**\r\n * Create a new data connection point.\r\n * @param name\r\n * @param connectionType\r\n * @param ownerBlock\r\n * @param richType\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n public richType: RichType<T>\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n */\r\n public _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n context._setConnectionValue(this, value);\r\n }\r\n\r\n public connectTo(point: FlowGraphDataConnection<T>): void {\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n if (context._hasConnectionValue(this)) {\r\n return context._getConnectionValue(this);\r\n } else {\r\n return this.richType.defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n this._ownerBlock._updateOutputs(context);\r\n return this._getValueOrDefault(context);\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._getValueOrDefault(context);\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FGDataConnection\";\r\n }\r\n\r\n public serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n }\r\n\r\n public static Parse(serializationObject: any, ownerBlock: FlowGraphBlock): FlowGraphDataConnection<any> {\r\n const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);\r\n obj.richType = RichType.Parse(serializationObject.richType);\r\n return obj;\r\n }\r\n}\r\n\r\nRegisterClass(\"FGDataConnection\", FlowGraphDataConnection);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD;;;;;;GAMG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAC3G;;;;;;OAMG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B,EACnB,QAAqB;QAE5B,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAFjC,aAAQ,GAAR,QAAQ,CAAa;IAGhC,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,KAAK,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAQ,EAAE,OAAyB;QAC/C,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAEM,SAAS,CAAC,KAAiC;QAC9C,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAEO,kBAAkB,CAAC,OAAyB;QAChD,IAAI,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE;YACnC,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;SAC5C;aAAM;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;SACrC;IACL,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,OAAyB;QACrC,IAAI,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,MAAM,EAAE;YACxD,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YACrB,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;SAC3C;aAAM;YACH,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SACpD;IACL,CAAC;IAEM,YAAY;QACf,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAEM,SAAS,CAAC,sBAA2B,EAAE;QAC1C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,mBAAwB,EAAE,UAA0B;QACpE,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QACvE,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RichType } from \"./flowGraphRichTypes\";\r\n/**\r\n * @experimental\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n /**\r\n * Create a new data connection point.\r\n * @param name\r\n * @param connectionType\r\n * @param ownerBlock\r\n * @param richType\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n public richType: RichType<T>\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n */\r\n public _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n context._setConnectionValue(this, value);\r\n }\r\n\r\n public connectTo(point: FlowGraphDataConnection<T>): void {\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n if (context._hasConnectionValue(this)) {\r\n return context._getConnectionValue(this);\r\n } else {\r\n return this.richType.defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n return this._getValueOrDefault(context);\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._getValueOrDefault(context);\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FGDataConnection\";\r\n }\r\n\r\n public serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n }\r\n\r\n public static Parse(serializationObject: any, ownerBlock: FlowGraphBlock): FlowGraphDataConnection<any> {\r\n const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);\r\n obj.richType = RichType.Parse(serializationObject.richType);\r\n return obj;\r\n }\r\n}\r\n\r\nRegisterClass(\"FGDataConnection\", FlowGraphDataConnection);\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphEventBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E;;;;GAIG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAC1E;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n/**\r\n * @experimental\r\n * A type of block that listens to an event observable and activates\r\n * its output signal when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphEventBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E;;;;GAIG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,4BAA4B;IAC1E;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n/**\r\n * @experimental\r\n * A type of block that listens to an event observable and activates\r\n * its output signal when the event is triggered.\r\n */\r\nexport abstract class FlowGraphEventBlock extends FlowGraphAsyncExecutionBlock {\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n context._notifyExecuteNode(this);\r\n this.onDone._activateSignal(context);\r\n }\r\n}\r\n"]}
|
|
@@ -20,6 +20,7 @@ export class FlowGraphSignalConnection extends FlowGraphConnection {
|
|
|
20
20
|
_activateSignal(context) {
|
|
21
21
|
var _a;
|
|
22
22
|
if (this.connectionType === FlowGraphConnectionType.Input) {
|
|
23
|
+
context._notifyExecuteNode(this._ownerBlock);
|
|
23
24
|
this._ownerBlock._execute(context, this);
|
|
24
25
|
context._increaseExecutionId();
|
|
25
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphSignalConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAClH;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,MAAM,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,eAAe,CAAC,OAAyB;;QAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,KAAK,EAAE;YACvD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO,CAAC,oBAAoB,EAAE,CAAC;SAClC;aAAM;YACH,MAAA,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,0CAAE,eAAe,CAAC,OAAO,CAAC,CAAC;SACrD;IACL,CAAC;CACJ;AAED,aAAa,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * @experimental\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * A signal input can be connected to more than one signal output,\r\n * but a signal output can only connect to one signal input\r\n */\r\n public _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Output;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(context: FlowGraphContext): void {\r\n if (this.connectionType === FlowGraphConnectionType.Input) {\r\n this._ownerBlock._execute(context, this);\r\n context._increaseExecutionId();\r\n } else {\r\n this._connectedPoint[0]?._activateSignal(context);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"FlowGraphSignalConnection\", FlowGraphSignalConnection);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphSignalConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSignalConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAuE;IAClH;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,MAAM,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,eAAe,CAAC,OAAyB;;QAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,uBAAuB,CAAC,KAAK,EAAE;YACvD,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO,CAAC,oBAAoB,EAAE,CAAC;SAClC;aAAM;YACH,MAAA,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,0CAAE,eAAe,CAAC,OAAO,CAAC,CAAC;SACrD;IACL,CAAC;CACJ;AAED,aAAa,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n\r\n/**\r\n * @experimental\r\n * Represents a connection point for a signal.\r\n * When an output point is activated, it will activate the connected input point.\r\n * When an input point is activated, it will execute the block it belongs to.\r\n */\r\nexport class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {\r\n /**\r\n * A signal input can be connected to more than one signal output,\r\n * but a signal output can only connect to one signal input\r\n */\r\n public _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Output;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _activateSignal(context: FlowGraphContext): void {\r\n if (this.connectionType === FlowGraphConnectionType.Input) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._execute(context, this);\r\n context._increaseExecutionId();\r\n } else {\r\n this._connectedPoint[0]?._activateSignal(context);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"FlowGraphSignalConnection\", FlowGraphSignalConnection);\r\n"]}
|
package/FlowGraph/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export * from "./flowGraphBlock";
|
|
|
3
3
|
export * from "./flowGraphSignalConnection";
|
|
4
4
|
export * from "./flowGraphExecutionBlock";
|
|
5
5
|
export * from "./flowGraphEventBlock";
|
|
6
|
-
export * from "./flowGraphEventCoordinator";
|
|
7
6
|
export * from "./flowGraphRichTypes";
|
|
8
7
|
export * from "./flowGraphContext";
|
|
9
8
|
export * from "./flowGraphCoordinator";
|
|
9
|
+
export * from "./flowGraphContextLogger";
|
|
10
10
|
export * from "./Blocks/index";
|
package/FlowGraph/index.js
CHANGED
|
@@ -3,10 +3,10 @@ export * from "./flowGraphBlock.js";
|
|
|
3
3
|
export * from "./flowGraphSignalConnection.js";
|
|
4
4
|
export * from "./flowGraphExecutionBlock.js";
|
|
5
5
|
export * from "./flowGraphEventBlock.js";
|
|
6
|
-
export * from "./flowGraphEventCoordinator.js";
|
|
7
6
|
export * from "./flowGraphRichTypes.js";
|
|
8
7
|
export * from "./flowGraphContext.js";
|
|
9
8
|
export * from "./flowGraphCoordinator.js";
|
|
9
|
+
export * from "./flowGraphContextLogger.js";
|
|
10
10
|
// eslint-disable-next-line import/no-internal-modules
|
|
11
11
|
export * from "./Blocks/index.js";
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/FlowGraph/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,sDAAsD;AACtD,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./flowGraph\";\r\nexport * from \"./flowGraphBlock\";\r\nexport * from \"./flowGraphSignalConnection\";\r\nexport * from \"./flowGraphExecutionBlock\";\r\nexport * from \"./flowGraphEventBlock\";\r\nexport * from \"./flowGraphRichTypes\";\r\nexport * from \"./flowGraphContext\";\r\nexport * from \"./flowGraphCoordinator\";\r\nexport * from \"./flowGraphContextLogger\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./Blocks/index\";\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Scene } from "../scene";
|
|
2
|
+
/**
|
|
3
|
+
* The default function that serializes values in a context object to a serialization object
|
|
4
|
+
* @param key the key where the value should be stored in the serialization object
|
|
5
|
+
* @param value the value to store
|
|
6
|
+
* @param serializationObject the object where the value will be stored
|
|
7
|
+
*/
|
|
8
|
+
export declare function defaultValueSerializationFunction(key: string, value: any, serializationObject: any): void;
|
|
9
|
+
/**
|
|
10
|
+
* The default function that parses values stored in a serialization object
|
|
11
|
+
* @param key the key to the value that will be parsed
|
|
12
|
+
* @param serializationObject the object that will be parsed
|
|
13
|
+
* @param scene
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function defaultValueParseFunction(key: string, serializationObject: any, scene: Scene): any;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Quaternion, Vector2, Vector3, Vector4 } from "../Maths/math.vector.js";
|
|
2
|
+
function isMeshClassName(className) {
|
|
3
|
+
return (className === "Mesh" ||
|
|
4
|
+
className === "AbstractMesh" ||
|
|
5
|
+
className === "GroundMesh" ||
|
|
6
|
+
className === "InstanceMesh" ||
|
|
7
|
+
className === "LinesMesh" ||
|
|
8
|
+
className === "GoldbergMesh" ||
|
|
9
|
+
className === "GreasedLineMesh" ||
|
|
10
|
+
className === "TrailMesh");
|
|
11
|
+
}
|
|
12
|
+
function isVectorClassName(className) {
|
|
13
|
+
return className === "Vector2" || className === "Vector3" || className === "Vector4" || className === "Quaternion";
|
|
14
|
+
}
|
|
15
|
+
function parseVector(className, value) {
|
|
16
|
+
if (className === "Vector2") {
|
|
17
|
+
return Vector2.FromArray(value);
|
|
18
|
+
}
|
|
19
|
+
else if (className === "Vector3") {
|
|
20
|
+
return Vector3.FromArray(value);
|
|
21
|
+
}
|
|
22
|
+
else if (className === "Vector4") {
|
|
23
|
+
return Vector4.FromArray(value);
|
|
24
|
+
}
|
|
25
|
+
else if (className === "Quaternion") {
|
|
26
|
+
return Quaternion.FromArray(value);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error(`Unknown vector class name ${className}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The default function that serializes values in a context object to a serialization object
|
|
34
|
+
* @param key the key where the value should be stored in the serialization object
|
|
35
|
+
* @param value the value to store
|
|
36
|
+
* @param serializationObject the object where the value will be stored
|
|
37
|
+
*/
|
|
38
|
+
export function defaultValueSerializationFunction(key, value, serializationObject) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const className = (_b = (_a = value === null || value === void 0 ? void 0 : value.getClassName) === null || _a === void 0 ? void 0 : _a.call(value)) !== null && _b !== void 0 ? _b : "";
|
|
41
|
+
if (isMeshClassName(className)) {
|
|
42
|
+
serializationObject[key] = {
|
|
43
|
+
name: value.name,
|
|
44
|
+
className,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else if (isVectorClassName(className)) {
|
|
48
|
+
serializationObject[key] = {
|
|
49
|
+
value: value.asArray(),
|
|
50
|
+
className,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
serializationObject[key] = value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The default function that parses values stored in a serialization object
|
|
59
|
+
* @param key the key to the value that will be parsed
|
|
60
|
+
* @param serializationObject the object that will be parsed
|
|
61
|
+
* @param scene
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
export function defaultValueParseFunction(key, serializationObject, scene) {
|
|
65
|
+
const value = serializationObject[key];
|
|
66
|
+
let finalValue;
|
|
67
|
+
const className = value === null || value === void 0 ? void 0 : value.className;
|
|
68
|
+
if (isMeshClassName(className)) {
|
|
69
|
+
finalValue = scene.getMeshByName(value.name);
|
|
70
|
+
}
|
|
71
|
+
else if (isVectorClassName(className)) {
|
|
72
|
+
finalValue = parseVector(className, value.value);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
finalValue = value;
|
|
76
|
+
}
|
|
77
|
+
return finalValue;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=serialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG7E,SAAS,eAAe,CAAC,SAAiB;IACtC,OAAO,CACH,SAAS,KAAK,MAAM;QACpB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,YAAY;QAC1B,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,WAAW;QACzB,SAAS,KAAK,cAAc;QAC5B,SAAS,KAAK,i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AAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACpC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAW,EAAE,mBAAwB,EAAE,KAAY;IACzF,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,UAAU,CAAC;IACf,MAAM,SAAS,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC;IACnC,IAAI,eAAe,CAAC,SAAS,CAAC,EAAE;QAC5B,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KAChD;SAAM,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;QACrC,UAAU,GAAG,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;KACpD;SAAM;QACH,UAAU,GAAG,KAAK,CAAC;KACtB;IACD,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { Quaternion, Vector2, Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\n\r\nfunction isMeshClassName(className: string) {\r\n return (\r\n className === \"Mesh\" ||\r\n className === \"AbstractMesh\" ||\r\n className === \"GroundMesh\" ||\r\n className === \"InstanceMesh\" ||\r\n className === \"LinesMesh\" ||\r\n className === \"GoldbergMesh\" ||\r\n className === \"GreasedLineMesh\" ||\r\n className === \"TrailMesh\"\r\n );\r\n}\r\n\r\nfunction isVectorClassName(className: string) {\r\n return className === \"Vector2\" || className === \"Vector3\" || className === \"Vector4\" || className === \"Quaternion\";\r\n}\r\n\r\nfunction parseVector(className: string, value: Array<number>) {\r\n if (className === \"Vector2\") {\r\n return Vector2.FromArray(value);\r\n } else if (className === \"Vector3\") {\r\n return Vector3.FromArray(value);\r\n } else if (className === \"Vector4\") {\r\n return Vector4.FromArray(value);\r\n } else if (className === \"Quaternion\") {\r\n return Quaternion.FromArray(value);\r\n } else {\r\n throw new Error(`Unknown vector class name ${className}`);\r\n }\r\n}\r\n\r\n/**\r\n * The default function that serializes values in a context object to a serialization object\r\n * @param key the key where the value should be stored in the serialization object\r\n * @param value the value to store\r\n * @param serializationObject the object where the value will be stored\r\n */\r\nexport function defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n const className = value?.getClassName?.() ?? \"\";\r\n if (isMeshClassName(className)) {\r\n serializationObject[key] = {\r\n name: value.name,\r\n className,\r\n };\r\n } else if (isVectorClassName(className)) {\r\n serializationObject[key] = {\r\n value: value.asArray(),\r\n className,\r\n };\r\n } else {\r\n serializationObject[key] = value;\r\n }\r\n}\r\n\r\n/**\r\n * The default function that parses values stored in a serialization object\r\n * @param key the key to the value that will be parsed\r\n * @param serializationObject the object that will be parsed\r\n * @param scene\r\n * @returns\r\n */\r\nexport function defaultValueParseFunction(key: string, serializationObject: any, scene: Scene) {\r\n const value = serializationObject[key];\r\n let finalValue;\r\n const className = value?.className;\r\n if (isMeshClassName(className)) {\r\n finalValue = scene.getMeshByName(value.name);\r\n } else if (isVectorClassName(className)) {\r\n finalValue = parseVector(className, value.value);\r\n } else {\r\n finalValue = value;\r\n }\r\n return finalValue;\r\n}\r\n"]}
|
|
@@ -136,7 +136,8 @@ export declare class BaseTexture extends ThinTexture implements IAnimatable {
|
|
|
136
136
|
*/
|
|
137
137
|
get is2DArray(): boolean;
|
|
138
138
|
protected set is2DArray(value: boolean);
|
|
139
|
-
|
|
139
|
+
/** @internal */
|
|
140
|
+
protected _gammaSpace: boolean;
|
|
140
141
|
/**
|
|
141
142
|
* Define if the texture contains data in gamma space (most of the png/jpg aside bump).
|
|
142
143
|
* HDR texture are usually stored in linear space.
|
|
@@ -186,6 +186,7 @@ export class BaseTexture extends ThinTexture {
|
|
|
186
186
|
return this._texture._gammaSpace && !this._texture._useSRGBBuffer;
|
|
187
187
|
}
|
|
188
188
|
set gammaSpace(gamma) {
|
|
189
|
+
var _a;
|
|
189
190
|
if (!this._texture) {
|
|
190
191
|
if (this._gammaSpace === gamma) {
|
|
191
192
|
return;
|
|
@@ -198,7 +199,9 @@ export class BaseTexture extends ThinTexture {
|
|
|
198
199
|
}
|
|
199
200
|
this._texture._gammaSpace = gamma;
|
|
200
201
|
}
|
|
201
|
-
this.
|
|
202
|
+
(_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1, (mat) => {
|
|
203
|
+
return mat.hasTexture(this);
|
|
204
|
+
});
|
|
202
205
|
}
|
|
203
206
|
/**
|
|
204
207
|
* Gets or sets whether or not the texture contains RGBD data.
|
|
@@ -207,9 +210,16 @@ export class BaseTexture extends ThinTexture {
|
|
|
207
210
|
return this._texture != null && this._texture._isRGBD;
|
|
208
211
|
}
|
|
209
212
|
set isRGBD(value) {
|
|
213
|
+
var _a;
|
|
214
|
+
if (value === this.isRGBD) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
210
217
|
if (this._texture) {
|
|
211
218
|
this._texture._isRGBD = value;
|
|
212
219
|
}
|
|
220
|
+
(_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1, (mat) => {
|
|
221
|
+
return mat.hasTexture(this);
|
|
222
|
+
});
|
|
213
223
|
}
|
|
214
224
|
/**
|
|
215
225
|
* Are mip maps generated for this texture or not.
|
|
@@ -377,6 +387,7 @@ export class BaseTexture extends ThinTexture {
|
|
|
377
387
|
this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;
|
|
378
388
|
/** @internal */
|
|
379
389
|
this._isCube = false;
|
|
390
|
+
/** @internal */
|
|
380
391
|
this._gammaSpace = true;
|
|
381
392
|
/**
|
|
382
393
|
* Is Z inverted in the texture (useful in a cube texture).
|