026c0cbd8388dfab1c41931b5a200995f92d07af1ae4c6f7831bfb535596b446.json 6.0 KB

1
  1. {"ast":null,"code":"import { Observable } from \"../../../Misc/observable.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Block used to trigger an observable when traversed\n * It can also be used to execute a function when traversed\n */\nexport class GeometryInterceptorBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryInterceptorBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n /**\n * Observable triggered when the block is traversed\n */\n this.onInterceptionObservable = new Observable(undefined, true);\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n }\n /**\n * Gets the time spent to build this block (in ms)\n */\n get buildExecutionTime() {\n return -1;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryInterceptorBlock\";\n }\n /**\n * Gets the input component\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n const input = this._inputs[0];\n output._storedFunction = state => {\n let value = input.getConnectedValue(state);\n if (this.customFunction) {\n value = this.customFunction(value, state);\n }\n this.onInterceptionObservable.notifyObservers(value);\n return value;\n };\n }\n}\nRegisterClass(\"BABYLON.GeometryInterceptorBlock\", GeometryInterceptorBlock);","map":{"version":3,"names":["Observable","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryInterceptorBlock","constructor","name","onInterceptionObservable","undefined","registerInput","AutoDetect","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","buildExecutionTime","getClassName","input","output","_buildBlock","state","_storedFunction","value","getConnectedValue","customFunction","notifyObservers"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryInterceptorBlock.js"],"sourcesContent":["import { Observable } from \"../../../Misc/observable.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Block used to trigger an observable when traversed\n * It can also be used to execute a function when traversed\n */\nexport class GeometryInterceptorBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryInterceptorBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n /**\n * Observable triggered when the block is traversed\n */\n this.onInterceptionObservable = new Observable(undefined, true);\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n }\n /**\n * Gets the time spent to build this block (in ms)\n */\n get buildExecutionTime() {\n return -1;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryInterceptorBlock\";\n }\n /**\n * Gets the input component\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n const input = this._inputs[0];\n output._storedFunction = (state) => {\n let value = input.getConnectedValue(state);\n if (this.customFunction) {\n value = this.customFunction(value, state);\n }\n this.onInterceptionObservable.notifyObservers(value);\n return value;\n };\n }\n}\nRegisterClass(\"BABYLON.GeometryInterceptorBlock\", GeometryInterceptorBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AACxD,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB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