@babylonjs/core 6.33.1 → 6.34.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.
Files changed (175) hide show
  1. package/Animations/animationGroup.js +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Animations/animationGroupMask.d.ts +4 -0
  4. package/Animations/animationGroupMask.js +4 -0
  5. package/Animations/animationGroupMask.js.map +1 -1
  6. package/Compute/computeShader.d.ts +5 -0
  7. package/Compute/computeShader.js +42 -32
  8. package/Compute/computeShader.js.map +1 -1
  9. package/Engines/WebGPU/Extensions/engine.computeShader.js +4 -2
  10. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  11. package/Engines/engine.d.ts +16 -10
  12. package/Engines/thinEngine.js +3 -2
  13. package/Engines/thinEngine.js.map +1 -1
  14. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +296 -0
  15. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +758 -0
  16. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -0
  17. package/FlowGraph/Blocks/Data/Math/index.d.ts +1 -5
  18. package/FlowGraph/Blocks/Data/Math/index.js +1 -5
  19. package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
  20. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +2 -2
  21. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -3
  22. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  23. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  24. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +3 -3
  25. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  26. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +1 -0
  27. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +5 -0
  28. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  29. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +25 -0
  30. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +22 -0
  31. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -0
  32. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -5
  33. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +12 -6
  34. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  35. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +19 -0
  36. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +22 -0
  37. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -0
  38. package/FlowGraph/Blocks/Data/index.d.ts +1 -0
  39. package/FlowGraph/Blocks/Data/index.js +1 -0
  40. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  41. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +10 -5
  42. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +15 -5
  43. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  44. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +1 -0
  45. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +2 -1
  46. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  47. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +1 -0
  48. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +3 -2
  49. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  50. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
  51. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +3 -3
  52. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  53. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +0 -5
  54. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +2 -3
  55. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  56. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +2 -2
  57. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -3
  58. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  59. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +2 -2
  60. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +3 -3
  61. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  62. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +2 -2
  63. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +2 -2
  64. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  65. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
  66. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +3 -3
  67. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +2 -2
  69. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +3 -3
  70. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +13 -5
  72. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +14 -12
  73. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +2 -6
  75. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +3 -4
  76. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +16 -0
  78. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -0
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -0
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +2 -2
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +3 -3
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +1 -6
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +4 -4
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +2 -2
  87. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +4 -4
  88. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +3 -2
  90. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +6 -5
  91. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +1 -0
  93. package/FlowGraph/Blocks/Execution/ControlFlow/index.js +1 -0
  94. package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
  95. package/FlowGraph/Blocks/Execution/{flowGraphLogBlock.d.ts → flowGraphConsoleLogBlock.d.ts} +3 -2
  96. package/FlowGraph/Blocks/Execution/{flowGraphLogBlock.js → flowGraphConsoleLogBlock.js} +7 -6
  97. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -0
  98. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +16 -8
  99. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +17 -10
  100. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  101. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +4 -3
  102. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -6
  103. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  104. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +12 -7
  105. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +10 -9
  106. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  107. package/FlowGraph/Blocks/Execution/index.d.ts +1 -2
  108. package/FlowGraph/Blocks/Execution/index.js +1 -3
  109. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  110. package/FlowGraph/flowGraph.d.ts +3 -1
  111. package/FlowGraph/flowGraph.js +6 -2
  112. package/FlowGraph/flowGraph.js.map +1 -1
  113. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +6 -2
  114. package/FlowGraph/flowGraphAsyncExecutionBlock.js +2 -1
  115. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  116. package/FlowGraph/flowGraphBlock.d.ts +7 -2
  117. package/FlowGraph/flowGraphBlock.js +36 -14
  118. package/FlowGraph/flowGraphBlock.js.map +1 -1
  119. package/FlowGraph/flowGraphContext.d.ts +9 -5
  120. package/FlowGraph/flowGraphContext.js +7 -2
  121. package/FlowGraph/flowGraphContext.js.map +1 -1
  122. package/FlowGraph/flowGraphCoordinator.d.ts +4 -5
  123. package/FlowGraph/flowGraphCoordinator.js +12 -7
  124. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  125. package/FlowGraph/flowGraphEventBlock.js +1 -1
  126. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  127. package/FlowGraph/flowGraphExecutionBlock.d.ts +3 -2
  128. package/FlowGraph/flowGraphExecutionBlock.js +7 -11
  129. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  130. package/FlowGraph/flowGraphPath.d.ts +20 -2
  131. package/FlowGraph/flowGraphPath.js +27 -7
  132. package/FlowGraph/flowGraphPath.js.map +1 -1
  133. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +3 -3
  134. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +3 -3
  135. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
  136. package/FlowGraph/index.d.ts +3 -0
  137. package/FlowGraph/index.js +3 -0
  138. package/FlowGraph/index.js.map +1 -1
  139. package/FlowGraph/serialization.js +20 -6
  140. package/FlowGraph/serialization.js.map +1 -1
  141. package/FlowGraph/typeDefinitions.d.ts +33 -0
  142. package/FlowGraph/typeDefinitions.js +2 -0
  143. package/FlowGraph/typeDefinitions.js.map +1 -0
  144. package/Lights/light.d.ts +15 -0
  145. package/Lights/light.js +18 -0
  146. package/Lights/light.js.map +1 -1
  147. package/Lights/shadowLight.d.ts +18 -1
  148. package/Lights/shadowLight.js +34 -1
  149. package/Lights/shadowLight.js.map +1 -1
  150. package/Meshes/Node/nodeGeometryBlock.js +9 -1
  151. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  152. package/Meshes/abstractMesh.js +3 -1
  153. package/Meshes/abstractMesh.js.map +1 -1
  154. package/XR/features/WebXRMeshDetector.d.ts +14 -2
  155. package/XR/features/WebXRMeshDetector.js +43 -8
  156. package/XR/features/WebXRMeshDetector.js.map +1 -1
  157. package/package.json +1 -1
  158. package/scene.d.ts +1 -2
  159. package/scene.js.map +1 -1
  160. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.d.ts +0 -172
  161. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +0 -235
  162. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +0 -1
  163. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.d.ts +0 -269
  164. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +0 -429
  165. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +0 -1
  166. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +0 -115
  167. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +0 -146
  168. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +0 -1
  169. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +0 -155
  170. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +0 -190
  171. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +0 -1
  172. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +0 -116
  173. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +0 -144
  174. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +0 -1
  175. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import type { FlowGraphContext } from "../../flowGraphContext";
2
2
  import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
3
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock";
4
4
  import type { IFlowGraphBlockConfiguration } from "../../flowGraphBlock";
5
5
  /**
6
6
  * @experimental
7
7
  * Block that logs a message to the console.
8
8
  */
9
- export declare class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {
9
+ export declare class FlowGraphConsoleLogBlock extends FlowGraphExecutionBlockWithOutSignal {
10
10
  /**
11
11
  * Input connection: The message to log.
12
12
  */
@@ -17,4 +17,5 @@ export declare class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock
17
17
  */
18
18
  _execute(context: FlowGraphContext): void;
19
19
  getClassName(): string;
20
+ static ClassName: string;
20
21
  }
@@ -1,11 +1,11 @@
1
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
1
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock.js";
2
2
  import { RichTypeAny } from "../../flowGraphRichTypes.js";
3
3
  import { RegisterClass } from "../../../Misc/typeStore.js";
4
4
  /**
5
5
  * @experimental
6
6
  * Block that logs a message to the console.
7
7
  */
8
- export class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ export class FlowGraphConsoleLogBlock extends FlowGraphExecutionBlockWithOutSignal {
9
9
  constructor(config) {
10
10
  super(config);
11
11
  this.message = this.registerDataInput("message", RichTypeAny);
@@ -17,11 +17,12 @@ export class FlowGraphLogBlock extends FlowGraphWithOnDoneExecutionBlock {
17
17
  const messageValue = this.message.getValue(context);
18
18
  console.log(messageValue);
19
19
  // activate the output flow block
20
- this.onDone._activateSignal(context);
20
+ this.out._activateSignal(context);
21
21
  }
22
22
  getClassName() {
23
- return "FGLogBlock";
23
+ return FlowGraphConsoleLogBlock.ClassName;
24
24
  }
25
25
  }
26
- RegisterClass("FGLogBlock", FlowGraphLogBlock);
27
- //# sourceMappingURL=flowGraphLogBlock.js.map
26
+ FlowGraphConsoleLogBlock.ClassName = "FGConsoleLogBlock";
27
+ RegisterClass(FlowGraphConsoleLogBlock.ClassName, FlowGraphConsoleLogBlock);
28
+ //# sourceMappingURL=flowGraphConsoleLogBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphConsoleLogBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,oCAAoC;IAM9E,YAAmB,MAAqC;QACpD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,OAAyB;QACrC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1B,iCAAiC;QACjC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,wBAAwB,CAAC,SAAS,CAAC;IAC9C,CAAC;;AAEa,kCAAS,GAAG,mBAAmB,CAAC;AAElD,aAAa,CAAC,wBAAwB,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport { RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * Block that logs a message to the console.\r\n */\r\nexport class FlowGraphConsoleLogBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The message to log.\r\n */\r\n public readonly message: FlowGraphDataConnection<any>;\r\n\r\n public constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.message = this.registerDataInput(\"message\", RichTypeAny);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _execute(context: FlowGraphContext): void {\r\n const messageValue = this.message.getValue(context);\r\n console.log(messageValue);\r\n // activate the output flow block\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public getClassName(): string {\r\n return FlowGraphConsoleLogBlock.ClassName;\r\n }\r\n\r\n public static ClassName = \"FGConsoleLogBlock\";\r\n}\r\nRegisterClass(FlowGraphConsoleLogBlock.ClassName, FlowGraphConsoleLogBlock);\r\n"]}
@@ -1,20 +1,28 @@
1
- import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
2
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
1
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock";
3
2
  import type { FlowGraphContext } from "../../flowGraphContext";
4
3
  import type { IFlowGraphBlockConfiguration } from "../../flowGraphBlock";
5
4
  /**
6
5
  * @experimental
6
+ * Parameters used to create a FlowGraphSendCustomEventBlock.
7
7
  */
8
- export declare class FlowGraphSendCustomEventBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ export interface IFlowGraphSendCustomEventBlockConfiguration extends IFlowGraphBlockConfiguration {
9
9
  /**
10
- * Input connection: The id of the event to send.
10
+ * The id of the event to send.
11
11
  */
12
- readonly eventId: FlowGraphDataConnection<string>;
12
+ eventId: string;
13
13
  /**
14
- * Input connection: The data to send with the event.
14
+ * The names of the data inputs for that event.
15
15
  */
16
- readonly eventData: FlowGraphDataConnection<any>;
17
- constructor(config?: IFlowGraphBlockConfiguration);
16
+ eventData: string[];
17
+ }
18
+ /**
19
+ * @experimental
20
+ */
21
+ export declare class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOutSignal {
22
+ config: IFlowGraphSendCustomEventBlockConfiguration;
23
+ constructor(config: IFlowGraphSendCustomEventBlockConfiguration);
24
+ configure(): void;
18
25
  _execute(context: FlowGraphContext): void;
19
26
  getClassName(): string;
27
+ static ClassName: string;
20
28
  }
@@ -1,24 +1,31 @@
1
- import { RichTypeAny, RichTypeString } from "../../flowGraphRichTypes.js";
2
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
1
+ import { RichTypeAny } from "../../flowGraphRichTypes.js";
2
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
3
  import { RegisterClass } from "../../../Misc/typeStore.js";
4
4
  /**
5
5
  * @experimental
6
6
  */
7
- export class FlowGraphSendCustomEventBlock extends FlowGraphWithOnDoneExecutionBlock {
7
+ export class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOutSignal {
8
8
  constructor(config) {
9
9
  super(config);
10
- this.eventId = this.registerDataInput("eventId", RichTypeString);
11
- this.eventData = this.registerDataInput("eventData", RichTypeAny);
10
+ this.config = config;
11
+ }
12
+ configure() {
13
+ super.configure();
14
+ for (let i = 0; i < this.config.eventData.length; i++) {
15
+ const dataName = this.config.eventData[i];
16
+ this.registerDataInput(dataName, RichTypeAny);
17
+ }
12
18
  }
13
19
  _execute(context) {
14
- const eventId = this.eventId.getValue(context);
15
- const eventData = this.eventData.getValue(context);
16
- context.configuration.coordinator.notifyCustomEvent(eventId, eventData);
17
- this.onDone._activateSignal(context);
20
+ const eventId = this.config.eventId;
21
+ const eventDatas = this.dataInputs.map((port) => port.getValue(context));
22
+ context.configuration.coordinator.notifyCustomEvent(eventId, eventDatas);
23
+ this.out._activateSignal(context);
18
24
  }
19
25
  getClassName() {
20
- return "FGSendCustomEventBlock";
26
+ return FlowGraphSendCustomEventBlock.ClassName;
21
27
  }
22
28
  }
29
+ FlowGraphSendCustomEventBlock.ClassName = "FGSendCustomEventBlock";
23
30
  RegisterClass("FGSendCustomEventBlock", FlowGraphSendCustomEventBlock);
24
31
  //# sourceMappingURL=flowGraphSendCustomEventBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphSendCustomEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,oCAA0C;AAEhF,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,iCAAiC;IAUhF,YAAmB,MAAqC;QACpD,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEnD,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAExE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,YAAY;QACf,OAAO,wBAAwB,CAAC;IACpC,CAAC;CACJ;AACD,aAAa,CAAC,wBAAwB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import { RichTypeAny, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n */\r\nexport class FlowGraphSendCustomEventBlock extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The id of the event to send.\r\n */\r\n public readonly eventId: FlowGraphDataConnection<string>;\r\n /**\r\n * Input connection: The data to send with the event.\r\n */\r\n public readonly eventData: FlowGraphDataConnection<any>;\r\n\r\n public constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.eventId = this.registerDataInput(\"eventId\", RichTypeString);\r\n this.eventData = this.registerDataInput(\"eventData\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const eventId = this.eventId.getValue(context);\r\n const eventData = this.eventData.getValue(context);\r\n\r\n context.configuration.coordinator.notifyCustomEvent(eventId, eventData);\r\n\r\n this.onDone._activateSignal(context);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FGSendCustomEventBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGSendCustomEventBlock\", FlowGraphSendCustomEventBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphSendCustomEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,oCAA0C;AAChE,OAAO,EAAE,oCAAoC,EAAE,MAAM,yCAAyC,CAAC;AAE/F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiBxD;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,oCAAoC;IACnF,YAA0B,MAAmD;QACzE,KAAK,CAAC,MAAM,CAAC,CAAC;QADQ,WAAM,GAAN,MAAM,CAA6C;IAE7E,CAAC;IAEM,SAAS;QACZ,KAAK,CAAC,SAAS,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC1C,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;SACjD;IACL,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACpC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAEzE,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAEzE,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,6BAA6B,CAAC,SAAS,CAAC;IACnD,CAAC;;AAEa,uCAAS,GAAG,wBAAwB,CAAC;AAEvD,aAAa,CAAC,wBAAwB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a FlowGraphSendCustomEventBlock.\r\n */\r\nexport interface IFlowGraphSendCustomEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The id of the event to send.\r\n */\r\n eventId: string;\r\n /**\r\n * The names of the data inputs for that event.\r\n */\r\n eventData: string[];\r\n}\r\n/**\r\n * @experimental\r\n */\r\nexport class FlowGraphSendCustomEventBlock extends FlowGraphExecutionBlockWithOutSignal {\r\n public constructor(public config: IFlowGraphSendCustomEventBlockConfiguration) {\r\n super(config);\r\n }\r\n\r\n public configure(): void {\r\n super.configure();\r\n for (let i = 0; i < this.config.eventData.length; i++) {\r\n const dataName = this.config.eventData[i];\r\n this.registerDataInput(dataName, RichTypeAny);\r\n }\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const eventId = this.config.eventId;\r\n const eventDatas = this.dataInputs.map((port) => port.getValue(context));\r\n\r\n context.configuration.coordinator.notifyCustomEvent(eventId, eventDatas);\r\n\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public getClassName(): string {\r\n return FlowGraphSendCustomEventBlock.ClassName;\r\n }\r\n\r\n public static ClassName = \"FGSendCustomEventBlock\";\r\n}\r\nRegisterClass(\"FGSendCustomEventBlock\", FlowGraphSendCustomEventBlock);\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { FlowGraphContext } from "../../flowGraphContext";
2
2
  import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
3
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock";
4
4
  import type { IFlowGraphBlockConfiguration } from "../../flowGraphBlock";
5
5
  import type { FlowGraphPath } from "../../flowGraphPath";
6
6
  import { FlowGraphPathComponent } from "../../flowGraphPathComponent";
@@ -19,12 +19,12 @@ export interface IFlowGraphSetPropertyBlockConfiguration extends IFlowGraphBlock
19
19
  * @experimental
20
20
  * Block that sets a property on a target object.
21
21
  */
22
- export declare class FlowGraphSetPropertyBlock<ValueT> extends FlowGraphWithOnDoneExecutionBlock {
22
+ export declare class FlowGraphSetPropertyBlock<ValueT> extends FlowGraphExecutionBlockWithOutSignal {
23
23
  config: IFlowGraphSetPropertyBlockConfiguration;
24
24
  /**
25
25
  * Input connection: The value to set on the property.
26
26
  */
27
- readonly value: FlowGraphDataConnection<ValueT>;
27
+ readonly a: FlowGraphDataConnection<ValueT>;
28
28
  /**
29
29
  * The component with the templated inputs for the provided path.
30
30
  */
@@ -33,4 +33,5 @@ export declare class FlowGraphSetPropertyBlock<ValueT> extends FlowGraphWithOnDo
33
33
  _execute(context: FlowGraphContext): void;
34
34
  serialize(serializationObject?: any): void;
35
35
  getClassName(): string;
36
+ static ClassName: string;
36
37
  }
@@ -1,30 +1,31 @@
1
1
  import { RichTypeAny } from "../../flowGraphRichTypes.js";
2
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
2
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
3
  import { RegisterClass } from "../../../Misc/typeStore.js";
4
4
  import { FlowGraphPathComponent } from "../../flowGraphPathComponent.js";
5
5
  /**
6
6
  * @experimental
7
7
  * Block that sets a property on a target object.
8
8
  */
9
- export class FlowGraphSetPropertyBlock extends FlowGraphWithOnDoneExecutionBlock {
9
+ export class FlowGraphSetPropertyBlock extends FlowGraphExecutionBlockWithOutSignal {
10
10
  constructor(config) {
11
11
  super(config);
12
12
  this.config = config;
13
- this.value = this.registerDataInput("value", RichTypeAny);
13
+ this.a = this.registerDataInput("a", RichTypeAny);
14
14
  this.templateComponent = new FlowGraphPathComponent(config.path, this);
15
15
  }
16
16
  _execute(context) {
17
- const value = this.value.getValue(context);
17
+ const value = this.a.getValue(context);
18
18
  this.templateComponent.setProperty(context, value);
19
- this.onDone._activateSignal(context);
19
+ this.out._activateSignal(context);
20
20
  }
21
21
  serialize(serializationObject = {}) {
22
22
  super.serialize(serializationObject);
23
23
  serializationObject.config.path = this.config.path.serialize();
24
24
  }
25
25
  getClassName() {
26
- return "FGSetPropertyBlock";
26
+ return FlowGraphSetPropertyBlock.ClassName;
27
27
  }
28
28
  }
29
+ FlowGraphSetPropertyBlock.ClassName = "FGSetPropertyBlock";
29
30
  RegisterClass("FGSetPropertyBlock", FlowGraphSetPropertyBlock);
30
31
  //# sourceMappingURL=flowGraphSetPropertyBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphSetPropertyBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AActE;;;GAGG;AACH,MAAM,OAAO,yBAAkC,SAAQ,iCAAiC;IAUpF,YAA0B,MAA+C;QACrE,KAAK,CAAC,MAAM,CAAC,CAAC;QADQ,WAAM,GAAN,MAAM,CAAyC;QAGrE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,iBAAiB,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnD,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,SAAS,CAAC,sBAA2B,EAAE;QAC1C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACnE,CAAC;IAEM,YAAY;QACf,OAAO,oBAAoB,CAAC;IAChC,CAAC;CACJ;AACD,aAAa,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport type { FlowGraphPath } from \"../../flowGraphPath\";\r\nimport { FlowGraphPathComponent } from \"../../flowGraphPathComponent\";\r\n\r\n/**\r\n * @experimental\r\n * Configuration for the set property block.\r\n */\r\nexport interface IFlowGraphSetPropertyBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The path of the entity whose property will be set. Needs a corresponding\r\n * entity on the context variables.\r\n */\r\n path: FlowGraphPath;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Block that sets a property on a target object.\r\n */\r\nexport class FlowGraphSetPropertyBlock<ValueT> extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The value to set on the property.\r\n */\r\n public readonly value: FlowGraphDataConnection<ValueT>;\r\n /**\r\n * The component with the templated inputs for the provided path.\r\n */\r\n public readonly templateComponent: FlowGraphPathComponent;\r\n\r\n public constructor(public config: IFlowGraphSetPropertyBlockConfiguration) {\r\n super(config);\r\n\r\n this.value = this.registerDataInput(\"value\", RichTypeAny);\r\n this.templateComponent = new FlowGraphPathComponent(config.path, this);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const value = this.value.getValue(context);\r\n this.templateComponent.setProperty(context, value);\r\n\r\n this.onDone._activateSignal(context);\r\n }\r\n\r\n public serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.config.path = this.config.path.serialize();\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FGSetPropertyBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGSetPropertyBlock\", FlowGraphSetPropertyBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphSetPropertyBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AActE;;;GAGG;AACH,MAAM,OAAO,yBAAkC,SAAQ,oCAAoC;IAUvF,YAA0B,MAA+C;QACrE,KAAK,CAAC,MAAM,CAAC,CAAC;QADQ,WAAM,GAAN,MAAM,CAAyC;QAGrE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAClD,IAAI,CAAC,iBAAiB,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnD,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,SAAS,CAAC,sBAA2B,EAAE;QAC1C,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACnE,CAAC;IAEM,YAAY;QACf,OAAO,yBAAyB,CAAC,SAAS,CAAC;IAC/C,CAAC;;AAEa,mCAAS,GAAG,oBAAoB,CAAC;AAEnD,aAAa,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport type { FlowGraphPath } from \"../../flowGraphPath\";\r\nimport { FlowGraphPathComponent } from \"../../flowGraphPathComponent\";\r\n\r\n/**\r\n * @experimental\r\n * Configuration for the set property block.\r\n */\r\nexport interface IFlowGraphSetPropertyBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * The path of the entity whose property will be set. Needs a corresponding\r\n * entity on the context variables.\r\n */\r\n path: FlowGraphPath;\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Block that sets a property on a target object.\r\n */\r\nexport class FlowGraphSetPropertyBlock<ValueT> extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The value to set on the property.\r\n */\r\n public readonly a: FlowGraphDataConnection<ValueT>;\r\n /**\r\n * The component with the templated inputs for the provided path.\r\n */\r\n public readonly templateComponent: FlowGraphPathComponent;\r\n\r\n public constructor(public config: IFlowGraphSetPropertyBlockConfiguration) {\r\n super(config);\r\n\r\n this.a = this.registerDataInput(\"a\", RichTypeAny);\r\n this.templateComponent = new FlowGraphPathComponent(config.path, this);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const value = this.a.getValue(context);\r\n this.templateComponent.setProperty(context, value);\r\n\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.config.path = this.config.path.serialize();\r\n }\r\n\r\n public getClassName(): string {\r\n return FlowGraphSetPropertyBlock.ClassName;\r\n }\r\n\r\n public static ClassName = \"FGSetPropertyBlock\";\r\n}\r\nRegisterClass(\"FGSetPropertyBlock\", FlowGraphSetPropertyBlock);\r\n"]}
@@ -1,21 +1,26 @@
1
1
  import type { FlowGraphContext } from "../../flowGraphContext";
2
2
  import type { FlowGraphDataConnection } from "../../flowGraphDataConnection";
3
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock";
3
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock";
4
4
  import type { IFlowGraphBlockConfiguration } from "../../flowGraphBlock";
5
+ /**
6
+ * @experimental
7
+ * The variable block configuration.
8
+ */
9
+ export interface IFlowGraphSetVariableBlockConfiguration extends IFlowGraphBlockConfiguration {
10
+ variableName: string;
11
+ }
5
12
  /**
6
13
  * Block to set a variable.
7
14
  * @experimental
8
15
  */
9
- export declare class FlowGraphSetVariableBlock<T> extends FlowGraphWithOnDoneExecutionBlock {
10
- /**
11
- * Input connection: The name of the variable to set.
12
- */
13
- readonly variableName: FlowGraphDataConnection<string>;
16
+ export declare class FlowGraphSetVariableBlock<T> extends FlowGraphExecutionBlockWithOutSignal {
17
+ config: IFlowGraphSetVariableBlockConfiguration;
14
18
  /**
15
19
  * Input connection: The value to set on the variable.
16
20
  */
17
21
  readonly input: FlowGraphDataConnection<T>;
18
- constructor(config?: IFlowGraphBlockConfiguration);
22
+ constructor(config: IFlowGraphSetVariableBlockConfiguration);
19
23
  _execute(context: FlowGraphContext): void;
20
24
  getClassName(): string;
25
+ static ClassName: string;
21
26
  }
@@ -1,25 +1,26 @@
1
- import { RichTypeString, RichTypeAny } from "../../flowGraphRichTypes.js";
2
- import { FlowGraphWithOnDoneExecutionBlock } from "../../flowGraphWithOnDoneExecutionBlock.js";
1
+ import { RichTypeAny } from "../../flowGraphRichTypes.js";
2
+ import { FlowGraphExecutionBlockWithOutSignal } from "../../flowGraphWithOnDoneExecutionBlock.js";
3
3
  import { RegisterClass } from "../../../Misc/typeStore.js";
4
4
  /**
5
5
  * Block to set a variable.
6
6
  * @experimental
7
7
  */
8
- export class FlowGraphSetVariableBlock extends FlowGraphWithOnDoneExecutionBlock {
8
+ export class FlowGraphSetVariableBlock extends FlowGraphExecutionBlockWithOutSignal {
9
9
  constructor(config) {
10
10
  super(config);
11
- this.variableName = this.registerDataInput("variableName", RichTypeString);
12
- this.input = this.registerDataInput("input", RichTypeAny);
11
+ this.config = config;
12
+ this.input = this.registerDataInput(config.variableName, RichTypeAny);
13
13
  }
14
14
  _execute(context) {
15
- const variableNameValue = this.variableName.getValue(context);
15
+ const variableNameValue = this.config.variableName;
16
16
  const inputValue = this.input.getValue(context);
17
17
  context.setVariable(variableNameValue, inputValue);
18
- this.onDone._activateSignal(context);
18
+ this.out._activateSignal(context);
19
19
  }
20
20
  getClassName() {
21
- return "FGSetVariableBlock";
21
+ return FlowGraphSetVariableBlock.ClassName;
22
22
  }
23
23
  }
24
- RegisterClass("FGSetVariableBlock", FlowGraphSetVariableBlock);
24
+ FlowGraphSetVariableBlock.ClassName = "FGSetVariableBlock";
25
+ RegisterClass(FlowGraphSetVariableBlock.ClassName, FlowGraphSetVariableBlock);
25
26
  //# sourceMappingURL=flowGraphSetVariableBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphSetVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AAGpD;;;GAGG;AACH,MAAM,OAAO,yBAA6B,SAAQ,iCAAiC;IAU/E,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,YAAY;QACf,OAAO,oBAAoB,CAAC;IAChC,CAAC;CACJ;AACD,aAAa,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RichTypeString, RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphWithOnDoneExecutionBlock } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\n\r\n/**\r\n * Block to set a variable.\r\n * @experimental\r\n */\r\nexport class FlowGraphSetVariableBlock<T> extends FlowGraphWithOnDoneExecutionBlock {\r\n /**\r\n * Input connection: The name of the variable to set.\r\n */\r\n public readonly variableName: FlowGraphDataConnection<string>;\r\n /**\r\n * Input connection: The value to set on the variable.\r\n */\r\n public readonly input: FlowGraphDataConnection<T>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.variableName = this.registerDataInput(\"variableName\", RichTypeString);\r\n this.input = this.registerDataInput(\"input\", RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const variableNameValue = this.variableName.getValue(context);\r\n const inputValue = this.input.getValue(context);\r\n context.setVariable(variableNameValue, inputValue);\r\n this.onDone._activateSignal(context);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FGSetVariableBlock\";\r\n }\r\n}\r\nRegisterClass(\"FGSetVariableBlock\", FlowGraphSetVariableBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphSetVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AAWpD;;;GAGG;AACH,MAAM,OAAO,yBAA6B,SAAQ,oCAAoC;IAMlF,YAAmB,MAA+C;QAC9D,KAAK,CAAC,MAAM,CAAC,CAAC;QADC,WAAM,GAAN,MAAM,CAAyC;QAG9D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACrC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACnD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,yBAAyB,CAAC,SAAS,CAAC;IAC/C,CAAC;;AAEa,mCAAS,GAAG,oBAAoB,CAAC;AAEnD,aAAa,CAAC,yBAAyB,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { RichTypeAny } from \"../../flowGraphRichTypes\";\r\nimport type { FlowGraphContext } from \"../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../flowGraphDataConnection\";\r\nimport { FlowGraphExecutionBlockWithOutSignal } from \"../../flowGraphWithOnDoneExecutionBlock\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\n\r\n/**\r\n * @experimental\r\n * The variable block configuration.\r\n */\r\nexport interface IFlowGraphSetVariableBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n variableName: string;\r\n}\r\n\r\n/**\r\n * Block to set a variable.\r\n * @experimental\r\n */\r\nexport class FlowGraphSetVariableBlock<T> extends FlowGraphExecutionBlockWithOutSignal {\r\n /**\r\n * Input connection: The value to set on the variable.\r\n */\r\n public readonly input: FlowGraphDataConnection<T>;\r\n\r\n constructor(public config: IFlowGraphSetVariableBlockConfiguration) {\r\n super(config);\r\n\r\n this.input = this.registerDataInput(config.variableName, RichTypeAny);\r\n }\r\n\r\n public _execute(context: FlowGraphContext): void {\r\n const variableNameValue = this.config.variableName;\r\n const inputValue = this.input.getValue(context);\r\n context.setVariable(variableNameValue, inputValue);\r\n this.out._activateSignal(context);\r\n }\r\n\r\n public getClassName(): string {\r\n return FlowGraphSetVariableBlock.ClassName;\r\n }\r\n\r\n public static ClassName = \"FGSetVariableBlock\";\r\n}\r\nRegisterClass(FlowGraphSetVariableBlock.ClassName, FlowGraphSetVariableBlock);\r\n"]}
@@ -1,7 +1,6 @@
1
- export * from "./flowGraphLogBlock";
1
+ export * from "./flowGraphConsoleLogBlock";
2
2
  export * from "./flowGraphSetVariableBlock";
3
3
  export * from "./flowGraphSetPropertyBlock";
4
4
  export * from "./flowGraphSendCustomEventBlock";
5
5
  export * from "./ControlFlow/index";
6
6
  export * from "./Animation/index";
7
- export * from "./Audio/index";
@@ -1,4 +1,4 @@
1
- export * from "./flowGraphLogBlock.js";
1
+ export * from "./flowGraphConsoleLogBlock.js";
2
2
  export * from "./flowGraphSetVariableBlock.js";
3
3
  export * from "./flowGraphSetPropertyBlock.js";
4
4
  export * from "./flowGraphSendCustomEventBlock.js";
@@ -6,6 +6,4 @@ export * from "./flowGraphSendCustomEventBlock.js";
6
6
  export * from "./ControlFlow/index.js";
7
7
  // eslint-disable-next-line import/no-internal-modules
8
8
  export * from "./Animation/index.js";
9
- // eslint-disable-next-line import/no-internal-modules
10
- export * from "./Audio/index.js";
11
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,sDAAsD;AACtD,cAAc,qBAAqB,CAAC;AACpC,sDAAsD;AACtD,cAAc,mBAAmB,CAAC;AAClC,sDAAsD;AACtD,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./flowGraphLogBlock\";\r\nexport * from \"./flowGraphSetVariableBlock\";\r\nexport * from \"./flowGraphSetPropertyBlock\";\r\nexport * from \"./flowGraphSendCustomEventBlock\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./ControlFlow/index\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./Animation/index\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./Audio/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Execution/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,sDAAsD;AACtD,cAAc,qBAAqB,CAAC;AACpC,sDAAsD;AACtD,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"./flowGraphConsoleLogBlock\";\r\nexport * from \"./flowGraphSetVariableBlock\";\r\nexport * from \"./flowGraphSetPropertyBlock\";\r\nexport * from \"./flowGraphSendCustomEventBlock\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./ControlFlow/index\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./Animation/index\";\r\n"]}
@@ -5,6 +5,7 @@ import { FlowGraphBlock } from "./flowGraphBlock";
5
5
  import type { FlowGraphCoordinator } from "./flowGraphCoordinator";
6
6
  import type { FlowGraphSignalConnection } from "./flowGraphSignalConnection";
7
7
  import type { FlowGraphDataConnection } from "./flowGraphDataConnection";
8
+ import type { ISerializedFlowGraph } from "./typeDefinitions";
8
9
  export declare enum FlowGraphState {
9
10
  /**
10
11
  * The graph is stopped
@@ -60,6 +61,7 @@ export declare class FlowGraph {
60
61
  * @returns the context, where you can get and set variables
61
62
  */
62
63
  createContext(): FlowGraphContext;
64
+ getContext(index: number): FlowGraphContext;
63
65
  /**
64
66
  * Add an event block. When the graph is started, it will start listening to events
65
67
  * from the block and execute the graph when they are triggered.
@@ -107,5 +109,5 @@ export declare class FlowGraph {
107
109
  * @param valueParseFunction a function to parse complex values in a scene
108
110
  * @returns
109
111
  */
110
- static Parse(serializationObject: any, coordinator: FlowGraphCoordinator, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraph;
112
+ static Parse(serializationObject: ISerializedFlowGraph, coordinator: FlowGraphCoordinator, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraph;
111
113
  }
@@ -48,12 +48,17 @@ export class FlowGraph {
48
48
  this._executionContexts.push(context);
49
49
  return context;
50
50
  }
51
+ getContext(index) {
52
+ return this._executionContexts[index];
53
+ }
51
54
  /**
52
55
  * Add an event block. When the graph is started, it will start listening to events
53
56
  * from the block and execute the graph when they are triggered.
54
57
  * @param block
55
58
  */
56
59
  addEventBlock(block) {
60
+ // todo: when adding a mesh pick block, check if the target of the pick is child of a mesh that is already on the list
61
+ // if it is, put the child before the parent
57
62
  this._eventBlocks.push(block);
58
63
  }
59
64
  /**
@@ -152,7 +157,6 @@ export class FlowGraph {
152
157
  * @param valueSerializeFunction a function to serialize complex values
153
158
  */
154
159
  serialize(serializationObject = {}, valueSerializeFunction) {
155
- serializationObject.variableDefinitions = {};
156
160
  serializationObject.allBlocks = [];
157
161
  this.visitAllBlocks((block) => {
158
162
  const serializedBlock = {};
@@ -212,7 +216,7 @@ export class FlowGraph {
212
216
  const blocks = [];
213
217
  // Parse all blocks
214
218
  for (const serializedBlock of serializationObject.allBlocks) {
215
- const block = FlowGraphBlock.Parse(serializedBlock);
219
+ const block = FlowGraphBlock.Parse(serializedBlock, coordinator.config.scene, valueParseFunction);
216
220
  blocks.push(block);
217
221
  if (block instanceof FlowGraphEventBlock) {
218
222
  graph.addEventBlock(block);
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4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AC,MAAM,EAAE,oBAAoB,CAAC,CAAC;oBAC1F,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;iBAChC;aACJ;YACD,IAAI,KAAK,YAAY,uBAAuB,EAAE;gBAC1C,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,aAAa,EAAE;oBACzC,KAAK,MAAM,oBAAoB,IAAI,SAAS,CAAC,iBAAiB,EAAE;wBAC5D,MAAM,UAAU,GAAG,SAAS,CAAC,+BAA+B,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;wBAC3F,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;qBACnC;iBACJ;aACJ;SACJ;QACD,KAAK,MAAM,iBAAiB,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACnE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;SACxE;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _isADescendantOf } from \"./utils\";\r\n\r\nexport enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface FlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n */\r\nexport class FlowGraph {\r\n /** @internal */\r\n public _eventBlocks: FlowGraphEventBlock[] = [];\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n private _coordinator: FlowGraphCoordinator;\r\n private _executionContexts: FlowGraphContext[] = [];\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: FlowGraphParams) {\r\n this._scene = params.scene;\r\n this._coordinator = params.coordinator;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => this.dispose());\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this._eventBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Started;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n for (const context of this._executionContexts) {\r\n const contextualOrder = this._getContextualOrder(context);\r\n for (const block of contextualOrder) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(context: FlowGraphContext): FlowGraphEventBlock[] {\r\n const order: FlowGraphEventBlock[] = [];\r\n\r\n for (const block1 of this._eventBlocks) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n if (block1.getClassName() === FlowGraphMeshPickEventBlock.ClassName) {\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock)._getReferencedMesh(context);\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock)._getReferencedMesh(context);\r\n if (mesh1 && mesh2 && _isADescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n order.splice(i, 0, block1);\r\n } else {\r\n order.push(block1);\r\n }\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n this._executionContexts.length = 0;\r\n this._eventBlocks.length = 0;\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n this._sceneDisposeObserver = null;\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const block of this._eventBlocks) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.variableDefinitions = {};\r\n serializationObject.allBlocks = [];\r\n this.visitAllBlocks((block) => {\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n });\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an output data connection that has a specific unique id\r\n * @param blocks\r\n * @param uniqueId\r\n * @returns\r\n */\r\n public static GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\r\n for (const block of blocks) {\r\n for (const dataOut of block.dataOutputs) {\r\n if (dataOut.uniqueId === uniqueId) {\r\n return dataOut;\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an input signal connection that has a specific unique id\r\n * @param blocks\r\n * @param uniqueId\r\n * @returns\r\n */\r\n public static GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\r\n for (const block of blocks) {\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n if (signalIn.uniqueId === uniqueId) {\r\n return signalIn;\r\n }\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Parses a graph from a given serialization object\r\n * @param serializationObject the object where the values are written\r\n * @param coordinator the flow graph coordinator\r\n * @param valueParseFunction a function to parse complex values in a scene\r\n * @returns\r\n */\r\n public static Parse(serializationObject: any, coordinator: FlowGraphCoordinator, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraph {\r\n const graph = coordinator.createGraph();\r\n const blocks: FlowGraphBlock[] = [];\r\n // Parse all blocks\r\n for (const serializedBlock of serializationObject.allBlocks) {\r\n const block = FlowGraphBlock.Parse(serializedBlock);\r\n blocks.push(block);\r\n if (block instanceof FlowGraphEventBlock) {\r\n graph.addEventBlock(block);\r\n }\r\n }\r\n // After parsing all blocks, connect them\r\n for (const block of blocks) {\r\n for (const dataIn of block.dataInputs) {\r\n for (const serializedConnection of dataIn.connectedPointIds) {\r\n const connection = FlowGraph.GetDataOutConnectionByUniqueId(blocks, serializedConnection);\r\n dataIn.connectTo(connection);\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const serializedConnection of signalOut.connectedPointIds) {\r\n const connection = FlowGraph.GetSignalInConnectionByUniqueId(blocks, serializedConnection);\r\n signalOut.connectTo(connection);\r\n }\r\n }\r\n }\r\n }\r\n for (const serializedContext of serializationObject.executionContexts) {\r\n FlowGraphContext.Parse(serializedContext, graph, valueParseFunction);\r\n }\r\n return graph;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAA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,CAAC,CAAC;YACnB,IAAI,KAAK,YAAY,mBAAmB,EAAE;gBACtC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAC9B;SACJ;QACD,yCAAyC;QACzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YACxB,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE;gBACnC,KAAK,MAAM,oBAAoB,IAAI,MAAM,CAAC,iBAAiB,EAAE;oBACzD,MAAM,UAAU,GAAG,SAAS,CAAC,8BAA8B,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;oBAC1F,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;iBAChC;aACJ;YACD,IAAI,KAAK,YAAY,uBAAuB,EAAE;gBAC1C,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,aAAa,EAAE;oBACzC,KAAK,MAAM,oBAAoB,IAAI,SAAS,CAAC,iBAAiB,EAAE;wBAC5D,MAAM,UAAU,GAAG,SAAS,CAAC,+BAA+B,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;wBAC3F,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;qBACnC;iBACJ;aACJ;SACJ;QACD,KAAK,MAAM,iBAAiB,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACnE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;SACxE;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { ISerializedFlowGraph } from \"./typeDefinitions\";\r\nimport { FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _isADescendantOf } from \"./utils\";\r\n\r\nexport enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n}\r\n\r\n/**\r\n * @experimental\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface FlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n */\r\nexport class FlowGraph {\r\n /** @internal */\r\n public _eventBlocks: FlowGraphEventBlock[] = [];\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n private _coordinator: FlowGraphCoordinator;\r\n private _executionContexts: FlowGraphContext[] = [];\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: FlowGraphParams) {\r\n this._scene = params.scene;\r\n this._coordinator = params.coordinator;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => this.dispose());\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n // todo: when adding a mesh pick block, check if the target of the pick is child of a mesh that is already on the list\r\n // if it is, put the child before the parent\r\n this._eventBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Started;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n for (const context of this._executionContexts) {\r\n const contextualOrder = this._getContextualOrder(context);\r\n for (const block of contextualOrder) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(context: FlowGraphContext): FlowGraphEventBlock[] {\r\n const order: FlowGraphEventBlock[] = [];\r\n\r\n for (const block1 of this._eventBlocks) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n if (block1.getClassName() === FlowGraphMeshPickEventBlock.ClassName) {\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock)._getReferencedMesh(context);\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock)._getReferencedMesh(context);\r\n if (mesh1 && mesh2 && _isADescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n order.splice(i, 0, block1);\r\n } else {\r\n order.push(block1);\r\n }\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n this._executionContexts.length = 0;\r\n this._eventBlocks.length = 0;\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n this._sceneDisposeObserver = null;\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const block of this._eventBlocks) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.allBlocks = [];\r\n this.visitAllBlocks((block) => {\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n });\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an output data connection that has a specific unique id\r\n * @param blocks\r\n * @param uniqueId\r\n * @returns\r\n */\r\n public static GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\r\n for (const block of blocks) {\r\n for (const dataOut of block.dataOutputs) {\r\n if (dataOut.uniqueId === uniqueId) {\r\n return dataOut;\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Given a list of blocks, find an input signal connection that has a specific unique id\r\n * @param blocks\r\n * @param uniqueId\r\n * @returns\r\n */\r\n public static GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\r\n for (const block of blocks) {\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n if (signalIn.uniqueId === uniqueId) {\r\n return signalIn;\r\n }\r\n }\r\n }\r\n }\r\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\r\n }\r\n\r\n /**\r\n * Parses a graph from a given serialization object\r\n * @param serializationObject the object where the values are written\r\n * @param coordinator the flow graph coordinator\r\n * @param valueParseFunction a function to parse complex values in a scene\r\n * @returns\r\n */\r\n public static Parse(\r\n serializationObject: ISerializedFlowGraph,\r\n coordinator: FlowGraphCoordinator,\r\n valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any\r\n ): FlowGraph {\r\n const graph = coordinator.createGraph();\r\n const blocks: FlowGraphBlock[] = [];\r\n // Parse all blocks\r\n for (const serializedBlock of serializationObject.allBlocks) {\r\n const block = FlowGraphBlock.Parse(serializedBlock, coordinator.config.scene, valueParseFunction);\r\n blocks.push(block);\r\n if (block instanceof FlowGraphEventBlock) {\r\n graph.addEventBlock(block);\r\n }\r\n }\r\n // After parsing all blocks, connect them\r\n for (const block of blocks) {\r\n for (const dataIn of block.dataInputs) {\r\n for (const serializedConnection of dataIn.connectedPointIds) {\r\n const connection = FlowGraph.GetDataOutConnectionByUniqueId(blocks, serializedConnection);\r\n dataIn.connectTo(connection);\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const serializedConnection of signalOut.connectedPointIds) {\r\n const connection = FlowGraph.GetSignalInConnectionByUniqueId(blocks, serializedConnection);\r\n signalOut.connectTo(connection);\r\n }\r\n }\r\n }\r\n }\r\n for (const serializedContext of serializationObject.executionContexts) {\r\n FlowGraphContext.Parse(serializedContext, graph, valueParseFunction);\r\n }\r\n return graph;\r\n }\r\n}\r\n"]}
@@ -9,9 +9,13 @@ import type { FlowGraphSignalConnection } from "./flowGraphSignalConnection";
9
9
  */
10
10
  export declare abstract class FlowGraphAsyncExecutionBlock extends FlowGraphExecutionBlock {
11
11
  /**
12
- * Output connection: The signal that is triggered when the execution of this block is done.
12
+ * Output connection: The signal that is triggered when the synchronous execution of this block is done.
13
13
  */
14
- onDone: FlowGraphSignalConnection;
14
+ out: FlowGraphSignalConnection;
15
+ /**
16
+ * Output connection: The signal that is triggered when the asynchronous execution of this block is done.
17
+ */
18
+ done: FlowGraphSignalConnection;
15
19
  constructor(config?: IFlowGraphBlockConfiguration);
16
20
  /**
17
21
  * @internal
@@ -7,7 +7,8 @@ import { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock.js";
7
7
  export class FlowGraphAsyncExecutionBlock extends FlowGraphExecutionBlock {
8
8
  constructor(config) {
9
9
  super(config);
10
- this.onDone = this._registerSignalOutput("onDone");
10
+ this.out = this._registerSignalOutput("out");
11
+ this.done = this._registerSignalOutput("done");
11
12
  }
12
13
  /**
13
14
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphAsyncExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphAsyncExecutionBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;;GAIG;AACH,MAAM,OAAgB,4BAA6B,SAAQ,uBAAuB;IAM9E,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAUD;;;OAGG;IACI,kBAAkB,CAAC,OAAyB;QAC/C,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CAGJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * An async execution block can start tasks that will be executed asynchronously.\r\n * It should also be responsible for clearing it in _cancelPendingTasks.\r\n * @experimental\r\n */\r\nexport abstract class FlowGraphAsyncExecutionBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Output connection: The signal that is triggered when the execution of this block is done.\r\n */\r\n public onDone: FlowGraphSignalConnection;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.onDone = this._registerSignalOutput(\"onDone\");\r\n }\r\n /**\r\n * @internal\r\n * This function can be overridden to start any\r\n * pending tasks this node might have, such as\r\n * timeouts and playing animations.\r\n * @param context\r\n */\r\n public abstract _preparePendingTasks(context: FlowGraphContext): void;\r\n\r\n /**\r\n * @internal\r\n * @param context\r\n */\r\n public _startPendingTasks(context: FlowGraphContext) {\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n }\r\n\r\n public abstract _cancelPendingTasks(context: FlowGraphContext): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphAsyncExecutionBlock.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphAsyncExecutionBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;;GAIG;AACH,MAAM,OAAgB,4BAA6B,SAAQ,uBAAuB;IAU9E,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAUD;;;OAGG;IACI,kBAAkB,CAAC,OAAyB;QAC/C,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CAGJ","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"./flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\r\n\r\n/**\r\n * An async execution block can start tasks that will be executed asynchronously.\r\n * It should also be responsible for clearing it in _cancelPendingTasks.\r\n * @experimental\r\n */\r\nexport abstract class FlowGraphAsyncExecutionBlock extends FlowGraphExecutionBlock {\r\n /**\r\n * Output connection: The signal that is triggered when the synchronous execution of this block is done.\r\n */\r\n public out: FlowGraphSignalConnection;\r\n /**\r\n * Output connection: The signal that is triggered when the asynchronous execution of this block is done.\r\n */\r\n public done: FlowGraphSignalConnection;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.out = this._registerSignalOutput(\"out\");\r\n this.done = this._registerSignalOutput(\"done\");\r\n }\r\n /**\r\n * @internal\r\n * This function can be overridden to start any\r\n * pending tasks this node might have, such as\r\n * timeouts and playing animations.\r\n * @param context\r\n */\r\n public abstract _preparePendingTasks(context: FlowGraphContext): void;\r\n\r\n /**\r\n * @internal\r\n * @param context\r\n */\r\n public _startPendingTasks(context: FlowGraphContext) {\r\n this._preparePendingTasks(context);\r\n context._addPendingBlock(this);\r\n }\r\n\r\n public abstract _cancelPendingTasks(context: FlowGraphContext): void;\r\n}\r\n"]}
@@ -1,8 +1,11 @@
1
1
  import type { FlowGraphContext } from "./flowGraphContext";
2
2
  import { FlowGraphDataConnection } from "./flowGraphDataConnection";
3
3
  import type { RichType } from "./flowGraphRichTypes";
4
+ import type { ISerializedFlowGraphBlock } from "./typeDefinitions";
5
+ import type { Scene } from "../scene";
4
6
  export interface IFlowGraphBlockConfiguration {
5
7
  name?: string;
8
+ [extraPropertyKey: string]: any;
6
9
  }
7
10
  /**
8
11
  * @experimental
@@ -28,6 +31,7 @@ export declare class FlowGraphBlock {
28
31
  * The data outputs of the block.
29
32
  */
30
33
  dataOutputs: FlowGraphDataConnection<any>[];
34
+ metadata: any;
31
35
  /** Constructor is protected so only subclasses can be instantiated */
32
36
  protected constructor(config?: IFlowGraphBlockConfiguration | undefined);
33
37
  configure(): void;
@@ -38,7 +42,8 @@ export declare class FlowGraphBlock {
38
42
  registerDataInput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T>;
39
43
  registerDataOutput<T>(name: string, className: RichType<T>): FlowGraphDataConnection<T>;
40
44
  getDataInput(name: string): FlowGraphDataConnection<any> | undefined;
41
- serialize(serializationObject?: any): void;
45
+ getDataOutput(name: string): FlowGraphDataConnection<any> | undefined;
46
+ serialize(serializationObject?: any, _valueSerializeFunction?: (key: string, value: any, serializationObject: any) => any): void;
42
47
  getClassName(): string;
43
- static Parse(serializationObject: any): FlowGraphBlock;
48
+ static Parse(serializationObject: ISerializedFlowGraphBlock, scene: Scene, valueParseFunction?: (key: string, serializationObject: any, scene: Scene) => any): FlowGraphBlock;
44
49
  }