forked from BabylonJS/Babylon.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flowGraphSignalConnection.ts
34 lines (31 loc) · 1.33 KB
/
flowGraphSignalConnection.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock";
import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnection";
import type { FlowGraphContext } from "./flowGraphContext";
import { RegisterClass } from "../Misc/typeStore";
/**
* @experimental
* Represents a connection point for a signal.
* When an output point is activated, it will activate the connected input point.
* When an input point is activated, it will execute the block it belongs to.
*/
export class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {
/**
* A signal input can be connected to more than one signal output,
* but a signal output can only connect to one signal input
*/
public _isSingularConnection(): boolean {
return this.connectionType === FlowGraphConnectionType.Output;
}
/**
* @internal
*/
public _activateSignal(context: FlowGraphContext): void {
if (this.connectionType === FlowGraphConnectionType.Input) {
this._ownerBlock._execute(context, this);
context._increaseExecutionId();
} else {
this._connectedPoint[0]?._activateSignal(context);
}
}
}
RegisterClass("FlowGraphSignalConnection", FlowGraphSignalConnection);