@babylonjs/smart-filters 0.3.16-alpha → 0.4.0-alpha

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 (57) hide show
  1. package/dist/blocks/disableableShaderBlock.d.ts +56 -0
  2. package/dist/blocks/disableableShaderBlock.d.ts.map +1 -0
  3. package/dist/blocks/disableableShaderBlock.js +68 -0
  4. package/dist/blocks/disableableShaderBlock.js.map +1 -0
  5. package/dist/blocks/inputBlock.d.ts +2 -2
  6. package/dist/blocks/inputBlock.d.ts.map +1 -1
  7. package/dist/blocks/inputBlock.js +1 -1
  8. package/dist/blocks/inputBlock.js.map +1 -1
  9. package/dist/blocks/outputBlock.js +2 -2
  10. package/dist/blocks/outputBlock.js.map +1 -1
  11. package/dist/blocks/outputBlock.shader.d.ts.map +1 -1
  12. package/dist/blocks/outputBlock.shader.js +2 -5
  13. package/dist/blocks/outputBlock.shader.js.map +1 -1
  14. package/dist/blocks/shaderBlock.d.ts +4 -4
  15. package/dist/blocks/shaderBlock.d.ts.map +1 -1
  16. package/dist/blocks/shaderBlock.js +2 -2
  17. package/dist/blocks/shaderBlock.js.map +1 -1
  18. package/dist/index.d.ts +4 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +4 -3
  21. package/dist/index.js.map +1 -1
  22. package/dist/optimization/optimizedShaderBlock.d.ts +5 -5
  23. package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -1
  24. package/dist/optimization/optimizedShaderBlock.js +2 -2
  25. package/dist/optimization/optimizedShaderBlock.js.map +1 -1
  26. package/dist/optimization/smartFilterOptimizer.d.ts +10 -0
  27. package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -1
  28. package/dist/optimization/smartFilterOptimizer.js +30 -3
  29. package/dist/optimization/smartFilterOptimizer.js.map +1 -1
  30. package/dist/runtime/shaderRuntime.d.ts +5 -4
  31. package/dist/runtime/shaderRuntime.d.ts.map +1 -1
  32. package/dist/runtime/shaderRuntime.js +4 -4
  33. package/dist/runtime/shaderRuntime.js.map +1 -1
  34. package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -1
  35. package/dist/utils/buildTools/shaderConverter.js +7 -10
  36. package/dist/utils/buildTools/shaderConverter.js.map +1 -1
  37. package/dist/utils/shaderCodeUtils.d.ts +6 -5
  38. package/dist/utils/shaderCodeUtils.d.ts.map +1 -1
  39. package/dist/utils/shaderCodeUtils.js +19 -12
  40. package/dist/utils/shaderCodeUtils.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/blocks/disableableShaderBlock.ts +100 -0
  43. package/src/blocks/inputBlock.ts +3 -3
  44. package/src/blocks/outputBlock.shader.ts +2 -5
  45. package/src/blocks/outputBlock.ts +2 -2
  46. package/src/blocks/shaderBlock.ts +4 -4
  47. package/src/index.ts +4 -3
  48. package/src/optimization/optimizedShaderBlock.ts +7 -7
  49. package/src/optimization/smartFilterOptimizer.ts +43 -5
  50. package/src/runtime/shaderRuntime.ts +8 -7
  51. package/src/utils/buildTools/shaderConverter.ts +8 -14
  52. package/src/utils/shaderCodeUtils.ts +29 -16
  53. package/dist/blocks/disableableBlock.d.ts +0 -30
  54. package/dist/blocks/disableableBlock.d.ts.map +0 -1
  55. package/dist/blocks/disableableBlock.js +0 -22
  56. package/dist/blocks/disableableBlock.js.map +0 -1
  57. package/src/blocks/disableableBlock.ts +0 -40
@@ -5,15 +5,15 @@ import type { SmartFilter } from "../smartFilter";
5
5
  import type { ShaderProgram } from "../utils/shaderCodeUtils";
6
6
  import type { RuntimeData } from "../connection/connectionPoint";
7
7
  import { ShaderBlock } from "../blocks/shaderBlock.js";
8
- import { Binding } from "../runtime/shaderRuntime.js";
8
+ import { ShaderBinding } from "../runtime/shaderRuntime.js";
9
9
  import { ConnectionPointType } from "../connection/connectionPointType.js";
10
10
 
11
11
  /**
12
12
  * The shader bindings for the OptimizedShader block.
13
13
  * @internal
14
14
  */
15
- export class OptimizedShaderBinding extends Binding {
16
- private _shaderBindings: Binding[];
15
+ export class OptimizedShaderBinding extends ShaderBinding {
16
+ private _shaderBindings: ShaderBinding[];
17
17
  private _inputTextures: { [name: string]: RuntimeData<ConnectionPointType.Texture> };
18
18
 
19
19
  /**
@@ -22,7 +22,7 @@ export class OptimizedShaderBinding extends Binding {
22
22
  * @param inputTextures - The list of input textures to bind
23
23
  */
24
24
  constructor(
25
- shaderBindings: Binding[],
25
+ shaderBindings: ShaderBinding[],
26
26
  inputTextures: { [name: string]: RuntimeData<ConnectionPointType.Texture> }
27
27
  ) {
28
28
  super();
@@ -56,7 +56,7 @@ export class OptimizedShaderBinding extends Binding {
56
56
  * @internal
57
57
  */
58
58
  export class OptimizedShaderBlock extends ShaderBlock {
59
- private _shaderBindings: Nullable<Binding[]>;
59
+ private _shaderBindings: Nullable<ShaderBinding[]>;
60
60
  private _inputTextures: { [name: string]: RuntimeData<ConnectionPointType.Texture> } = {};
61
61
  private _shaderProgram: ShaderProgram;
62
62
 
@@ -104,7 +104,7 @@ export class OptimizedShaderBlock extends ShaderBlock {
104
104
  * Sets the list of shader bindings to use to render the block.
105
105
  * @param shaderBindings - The list of shader bindings to use to render the block
106
106
  */
107
- public setShaderBindings(shaderBindings: Binding[]): void {
107
+ public setShaderBindings(shaderBindings: ShaderBinding[]): void {
108
108
  this._shaderBindings = shaderBindings;
109
109
  }
110
110
 
@@ -112,7 +112,7 @@ export class OptimizedShaderBlock extends ShaderBlock {
112
112
  * Get the class instance that binds all the required data to the shader (effect) when rendering.
113
113
  * @returns The class instance that binds the data to the effect
114
114
  */
115
- public getShaderBinding(): Binding {
115
+ public getShaderBinding(): ShaderBinding {
116
116
  if (this._shaderBindings === null) {
117
117
  throw new Error("Shader bindings not set!");
118
118
  }
@@ -1,7 +1,7 @@
1
1
  import type { Nullable } from "@babylonjs/core/types";
2
2
 
3
3
  import type { ConnectionPoint } from "../connection/connectionPoint";
4
- import type { Binding } from "../runtime/shaderRuntime";
4
+ import type { ShaderBinding } from "../runtime/shaderRuntime";
5
5
  import type { InputBlock } from "../blocks/inputBlock";
6
6
  import type { BaseBlock } from "../blocks/baseBlock";
7
7
  import { SmartFilter } from "../smartFilter.js";
@@ -9,9 +9,15 @@ import { ConnectionPointType } from "../connection/connectionPointType.js";
9
9
  import { ShaderBlock } from "../blocks/shaderBlock.js";
10
10
  import { isTextureInputBlock } from "../blocks/inputBlock.js";
11
11
  import { OptimizedShaderBlock } from "./optimizedShaderBlock.js";
12
- import { decorateChar, decorateSymbol, getShaderFragmentCode, undecorateSymbol } from "../utils/shaderCodeUtils.js";
12
+ import {
13
+ AutoDisableMainInputColorName,
14
+ decorateChar,
15
+ decorateSymbol,
16
+ getShaderFragmentCode,
17
+ undecorateSymbol,
18
+ } from "../utils/shaderCodeUtils.js";
13
19
  import { DependencyGraph } from "./dependencyGraph.js";
14
- import { DisableableBlock } from "../blocks/disableableBlock.js";
20
+ import { DisableableShaderBlock, BlockDisableStrategy } from "../blocks/disableableShaderBlock.js";
15
21
 
16
22
  const showDebugData = false;
17
23
 
@@ -132,6 +138,9 @@ export class SmartFilterOptimizer {
132
138
  const connectionsToReconnect: [ConnectionPoint, ConnectionPoint][] = [];
133
139
 
134
140
  if (this._options.removeDisabledBlocks) {
141
+ // Need to propagate runtime data to ensure we can tell if a block is disabled
142
+ this._sourceSmartFilter.output.ownerBlock.propagateRuntimeData();
143
+
135
144
  const alreadyVisitedBlocks = new Set<BaseBlock>();
136
145
  this._disconnectDisabledBlocks(
137
146
  this._sourceSmartFilter.output.connectedTo.ownerBlock,
@@ -203,7 +212,7 @@ export class SmartFilterOptimizer {
203
212
  this._disconnectDisabledBlocks(input.connectedTo.ownerBlock, alreadyVisitedBlocks, inputsToReconnect);
204
213
  }
205
214
 
206
- if (block instanceof DisableableBlock && block.disabled.runtimeData.value) {
215
+ if (block instanceof DisableableShaderBlock && block.disabled.runtimeData.value) {
207
216
  block.disconnectFromGraph(inputsToReconnect);
208
217
  }
209
218
  }
@@ -508,6 +517,14 @@ export class SmartFilterOptimizer {
508
517
  throw `The connection point corresponding to the input named "${samplerName}" in block named "${block.name}" is not connected!`;
509
518
  }
510
519
 
520
+ // If we are using the AutoSample strategy, we must preprocess the code that samples the texture
521
+ if (
522
+ block instanceof DisableableShaderBlock &&
523
+ block.blockDisableStrategy === BlockDisableStrategy.AutoSample
524
+ ) {
525
+ code = this._applyAutoSampleStrategy(code, sampler);
526
+ }
527
+
511
528
  const parentBlock = input.connectedTo.ownerBlock;
512
529
 
513
530
  if (isTextureInputBlock(parentBlock)) {
@@ -629,7 +646,7 @@ export class SmartFilterOptimizer {
629
646
  });
630
647
 
631
648
  // Sets the remapping of the shader variables
632
- const blockOwnerToShaderBinding = new Map<ShaderBlock, Binding>();
649
+ const blockOwnerToShaderBinding = new Map<ShaderBlock, ShaderBinding>();
633
650
 
634
651
  let codeUniforms = "";
635
652
  let codeConsts = "";
@@ -703,4 +720,25 @@ export class SmartFilterOptimizer {
703
720
 
704
721
  return optimizedBlock;
705
722
  }
723
+
724
+ /**
725
+ * If this block used DisableStrategy.AutoSample, find all the sampleTexture calls which just pass the vUV,
726
+ * skip the first one, and for all others replace with the local variable created by the DisableStrategy.AutoSample
727
+ *
728
+ * @param code - The shader code to process
729
+ * @param sampler - The name of the sampler
730
+ *
731
+ * @returns The processed code
732
+ */
733
+ private _applyAutoSampleStrategy(code: string, sampler: string): string {
734
+ let isFirstMatch = true;
735
+ const rx = new RegExp(`sampleTexture\\s*\\(\\s*${sampler}\\s*,\\s*vUV\\s*\\)`, "g");
736
+ return code.replace(rx, (match) => {
737
+ if (isFirstMatch) {
738
+ isFirstMatch = false;
739
+ return match;
740
+ }
741
+ return decorateSymbol(AutoDisableMainInputColorName);
742
+ });
743
+ }
706
744
  }
@@ -7,15 +7,16 @@ import { EffectWrapper } from "@babylonjs/core/Materials/effectRenderer.js";
7
7
  import type { IDisposable } from "../IDisposable";
8
8
  import type { ShaderProgram } from "../utils/shaderCodeUtils";
9
9
  import { createStrongRef, type StrongRef } from "./strongRef.js";
10
- import type { IDisableableBlock } from "../blocks/disableableBlock";
11
- import { decorateSymbol, getShaderCreateOptions } from "../utils/shaderCodeUtils.js";
10
+ import type { IDisableableBlock } from "../blocks/disableableShaderBlock";
11
+ import { decorateSymbol, DisableUniform, getShaderCreateOptions } from "../utils/shaderCodeUtils.js";
12
12
 
13
13
  /**
14
14
  * The shader bindings for a ShaderBlock that can't be disabled.
15
15
  */
16
- export abstract class Binding {
16
+ export abstract class ShaderBinding {
17
17
  /**
18
18
  * Binds all the required data to the shader when rendering.
19
+ * Overridden by derived classes.
19
20
  * @param effect - defines the effect to bind the data to
20
21
  * @param width - defines the width of the output
21
22
  * @param height - defines the height of the output
@@ -47,7 +48,7 @@ export abstract class Binding {
47
48
  /**
48
49
  * The shader bindings for a disableable ShaderBlock.
49
50
  */
50
- export abstract class ShaderBinding extends Binding {
51
+ export abstract class DisableableShaderBinding extends ShaderBinding {
51
52
  private _disabled: StrongRef<boolean>;
52
53
 
53
54
  /**
@@ -66,7 +67,7 @@ export abstract class ShaderBinding extends Binding {
66
67
  * @param _height - defines the height of the output
67
68
  */
68
69
  public bind(effect: Effect, _width?: number, _height?: number): void {
69
- effect.setBool(this.getRemappedName("disabled"), this._disabled.value);
70
+ effect.setBool(this.getRemappedName(DisableUniform), this._disabled.value);
70
71
  }
71
72
  }
72
73
 
@@ -88,7 +89,7 @@ export class ShaderRuntime implements IDisposable {
88
89
  private readonly _engine: AbstractEngine;
89
90
  private readonly _effectRenderer: EffectRenderer;
90
91
  private readonly _effectWrapper: EffectWrapper;
91
- private readonly _shaderBinding: Binding;
92
+ private readonly _shaderBinding: ShaderBinding;
92
93
 
93
94
  /**
94
95
  * Creates a new @see ShaderRuntime.
@@ -96,7 +97,7 @@ export class ShaderRuntime implements IDisposable {
96
97
  * @param shaderProgram - defines the shader code associated with this runtime
97
98
  * @param shaderBinding - defines the shader bindings associated with this runtime
98
99
  */
99
- constructor(effectRenderer: EffectRenderer, shaderProgram: ShaderProgram, shaderBinding: Binding) {
100
+ constructor(effectRenderer: EffectRenderer, shaderProgram: ShaderProgram, shaderBinding: ShaderBinding) {
100
101
  this._engine = effectRenderer.engine;
101
102
  this._effectRenderer = effectRenderer;
102
103
  this._shaderBinding = shaderBinding;
@@ -36,8 +36,7 @@ const ShaderTemplate = `import type { ShaderProgram } from "${TYPE_IMPORT_PATH}"
36
36
  export const shaderProgram: ShaderProgram = {
37
37
  vertex: ${VERTEX_SHADER},
38
38
  fragment: {
39
- uniform: \`${UNIFORMS}
40
- uniform bool _disabled_;\`,${CONSTS_PROPERTY}
39
+ uniform: \`${UNIFORMS}\`,${CONSTS_PROPERTY}
41
40
  mainInputTexture: "${MAIN_INPUT_NAME}",
42
41
  mainFunctionName: "${MAIN_FUNCTION_NAME}",
43
42
  functions: [${FUNCTIONS}
@@ -206,7 +205,7 @@ function processFragmentShaderV1(fragmentShader: string): FragmentShaderInfo {
206
205
  const mainInputName = mainInputs[0];
207
206
 
208
207
  // Extract all the functions
209
- const { extractedFunctions, mainFunctionName } = extractFunctions(fragmentShaderWithRenamedSymbols, mainInputName);
208
+ const { extractedFunctions, mainFunctionName } = extractFunctions(fragmentShaderWithRenamedSymbols);
210
209
 
211
210
  return {
212
211
  finalUniforms,
@@ -234,13 +233,9 @@ function addLinePrefixes(input: string, prefix: string): string {
234
233
  /**
235
234
  * Extracts all the functions from the shader
236
235
  * @param fragment - The shader code to process
237
- * @param mainInputName - The name of the main input
238
236
  * @returns A list of functions
239
237
  */
240
- function extractFunctions(
241
- fragment: string,
242
- mainInputName: string
243
- ): {
238
+ function extractFunctions(fragment: string): {
244
239
  /**
245
240
  * The extracted functions
246
241
  */
@@ -276,15 +271,10 @@ function extractFunctions(
276
271
  inFunction = false;
277
272
  const { functionBody, functionName, isMainFunction } = processFunctionBody(currentFunction);
278
273
 
279
- let body = functionBody;
280
- if (isMainFunction) {
281
- body = functionBody.replace("{", `{\n if (_disabled_) return texture2D(${mainInputName}, vUV);\n`);
282
- }
283
-
284
274
  extractedFunctions.push(
285
275
  FunctionTemplate.replace(FUNCTION_NAME, functionName).replace(
286
276
  FUNCTION_CODE,
287
- addLinePrefixes(body, CodeLinePrefix)
277
+ addLinePrefixes(functionBody, CodeLinePrefix)
288
278
  )
289
279
  );
290
280
  if (isMainFunction) {
@@ -334,6 +324,10 @@ function processFunctionBody(functionBody: string): {
334
324
 
335
325
  const isMainFunction = functionBody.includes("// main");
336
326
 
327
+ if (isMainFunction) {
328
+ functionBody = functionBody.replace("// main", "");
329
+ }
330
+
337
331
  return { functionBody, functionName, isMainFunction };
338
332
  }
339
333
 
@@ -46,7 +46,7 @@ export type ShaderCode = {
46
46
  mainFunctionName: string;
47
47
 
48
48
  /**
49
- * The name of the main input texture.
49
+ * The name of the input texture which is passed through if the block is disabled.
50
50
  */
51
51
  mainInputTexture?: string;
52
52
 
@@ -110,28 +110,41 @@ export type ShaderCreationOptions = {
110
110
  onCompiled?: (effect: Effect) => void;
111
111
  };
112
112
 
113
+ export const AutoDisableMainInputColorName = "autoMainInputColor";
114
+ export const DisableUniform = "disabled";
115
+
113
116
  /**
114
- * Injects the disable uniform into a shader program.
115
- * @param shaderProgram - The shader program to inject the disable uniform into.
116
- * @returns The modified shader program
117
+ * Injects the disable uniform and adds a check for it at the beginning of the main function
118
+ * @param shaderProgram - The shader program to inject the disable feature into
117
119
  */
118
- export function injectDisableUniform(shaderProgram: ShaderProgram) {
120
+ export function injectAutoSampleDisableCode(shaderProgram: ShaderProgram) {
119
121
  const shaderFragment = shaderProgram.fragment;
120
122
 
121
- shaderFragment.uniform += "\nuniform bool _disabled_;";
123
+ // Inject the disable uniform
124
+ shaderFragment.uniform += `\nuniform bool ${decorateSymbol(DisableUniform)};`;
122
125
 
123
- for (let i = 0; i < shaderFragment.functions.length; ++i) {
124
- const func = shaderFragment.functions[i]!;
125
- if (func.name === shaderFragment.mainFunctionName) {
126
- func.code = func.code.replace(
127
- "{",
128
- `{\n if (_disabled_) return texture2D(${shaderProgram.fragment.mainInputTexture}, vUV);\n`
129
- );
130
- break;
131
- }
126
+ // Find the main function
127
+ const mainFunction = shaderFragment.functions.find((f) => f.name === shaderFragment.mainFunctionName);
128
+ if (!mainFunction) {
129
+ throw new Error(
130
+ `Main function not found when trying to inject auto disable into ${shaderFragment.mainFunctionName}`
131
+ );
132
+ }
133
+
134
+ // Ensure the shader has a main input texture
135
+ if (!shaderFragment.mainInputTexture) {
136
+ throw new Error(
137
+ `Main input texture not found when trying to inject auto disable into ${shaderFragment.mainFunctionName}`
138
+ );
132
139
  }
133
140
 
134
- return shaderProgram;
141
+ // Inject the code
142
+ const autoDisableVariableName = decorateSymbol(AutoDisableMainInputColorName);
143
+ mainFunction.code = mainFunction.code.replace(
144
+ "{",
145
+ `{\n vec4 ${autoDisableVariableName} = texture2D(${shaderFragment.mainInputTexture}, vUV);\n
146
+ if (${decorateSymbol(DisableUniform)}) return ${autoDisableVariableName};\n`
147
+ );
135
148
  }
136
149
 
137
150
  /**
@@ -1,30 +0,0 @@
1
- import type { SmartFilter } from "../smartFilter";
2
- import type { ConnectionPoint } from "../connection/connectionPoint";
3
- import { BaseBlock } from "../blocks/baseBlock.js";
4
- import { ConnectionPointType } from "../connection/connectionPointType.js";
5
- /**
6
- * The interface that describes the disableable block.
7
- */
8
- export interface IDisableableBlock {
9
- /**
10
- * The disabled connection point of the block.
11
- */
12
- disabled: ConnectionPoint<ConnectionPointType.Boolean>;
13
- }
14
- /**
15
- * A block that can be disabled.
16
- */
17
- export declare class DisableableBlock extends BaseBlock implements IDisableableBlock {
18
- /**
19
- * The disabled connection point of the block.
20
- */
21
- readonly disabled: import("../connection/connectionPointWithDefault").ConnectionPointWithDefault<ConnectionPointType.Boolean>;
22
- /**
23
- * Instantiates a new block.
24
- * @param smartFilter - Defines the smart filter the block belongs to
25
- * @param name - Defines the name of the block
26
- * @param disableOptimization - Defines if the block should not be optimized (default: false)
27
- */
28
- constructor(smartFilter: SmartFilter, name: string, disableOptimization?: boolean);
29
- }
30
- //# sourceMappingURL=disableableBlock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"disableableBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/disableableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,iBAAiB;IACxE;;OAEG;IACH,SAAgB,QAAQ,6GAItB;IAEF;;;;;OAKG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,UAAQ;CAGlF"}
@@ -1,22 +0,0 @@
1
- import { BaseBlock } from "../blocks/baseBlock.js";
2
- import { ConnectionPointType } from "../connection/connectionPointType.js";
3
- import { createStrongRef } from "../runtime/strongRef.js";
4
- /**
5
- * A block that can be disabled.
6
- */
7
- export class DisableableBlock extends BaseBlock {
8
- /**
9
- * Instantiates a new block.
10
- * @param smartFilter - Defines the smart filter the block belongs to
11
- * @param name - Defines the name of the block
12
- * @param disableOptimization - Defines if the block should not be optimized (default: false)
13
- */
14
- constructor(smartFilter, name, disableOptimization = false) {
15
- super(smartFilter, name, disableOptimization);
16
- /**
17
- * The disabled connection point of the block.
18
- */
19
- this.disabled = this._registerOptionalInput("disabled", ConnectionPointType.Boolean, createStrongRef(false));
20
- }
21
- }
22
- //# sourceMappingURL=disableableBlock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"disableableBlock.js","sourceRoot":"","sources":["../../src/blocks/disableableBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAY1D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAU3C;;;;;OAKG;IACH,YAAY,WAAwB,EAAE,IAAY,EAAE,mBAAmB,GAAG,KAAK;QAC3E,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC;QAhBlD;;WAEG;QACa,aAAQ,GAAG,IAAI,CAAC,sBAAsB,CAClD,UAAU,EACV,mBAAmB,CAAC,OAAO,EAC3B,eAAe,CAAC,KAAK,CAAC,CACzB,CAAC;IAUF,CAAC;CACJ"}
@@ -1,40 +0,0 @@
1
- import type { SmartFilter } from "../smartFilter";
2
- import type { ConnectionPoint } from "../connection/connectionPoint";
3
-
4
- import { BaseBlock } from "../blocks/baseBlock.js";
5
- import { ConnectionPointType } from "../connection/connectionPointType.js";
6
- import { createStrongRef } from "../runtime/strongRef.js";
7
-
8
- /**
9
- * The interface that describes the disableable block.
10
- */
11
- export interface IDisableableBlock {
12
- /**
13
- * The disabled connection point of the block.
14
- */
15
- disabled: ConnectionPoint<ConnectionPointType.Boolean>;
16
- }
17
-
18
- /**
19
- * A block that can be disabled.
20
- */
21
- export class DisableableBlock extends BaseBlock implements IDisableableBlock {
22
- /**
23
- * The disabled connection point of the block.
24
- */
25
- public readonly disabled = this._registerOptionalInput(
26
- "disabled",
27
- ConnectionPointType.Boolean,
28
- createStrongRef(false)
29
- );
30
-
31
- /**
32
- * Instantiates a new block.
33
- * @param smartFilter - Defines the smart filter the block belongs to
34
- * @param name - Defines the name of the block
35
- * @param disableOptimization - Defines if the block should not be optimized (default: false)
36
- */
37
- constructor(smartFilter: SmartFilter, name: string, disableOptimization = false) {
38
- super(smartFilter, name, disableOptimization);
39
- }
40
- }