a31419bd1b709380ebc448dda54abd29c59a5f344d28c54f52c74c0e997b5a9b.json 6.3 KB

1
  1. {"ast":null,"code":"import { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal.js\";\nimport { RichTypeNumber } from \"../../../flowGraphRichTypes.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\n/**\n * @experimental\n * Block that executes an action in a loop.\n */\nexport class FlowGraphForLoopBlock extends FlowGraphExecutionBlockWithOutSignal {\n constructor(config) {\n super(config);\n this.startIndex = this.registerDataInput(\"startIndex\", RichTypeNumber);\n this.endIndex = this.registerDataInput(\"endIndex\", RichTypeNumber);\n this.step = this.registerDataInput(\"step\", RichTypeNumber);\n this.index = this.registerDataOutput(\"index\", RichTypeNumber);\n this.onLoop = this._registerSignalOutput(\"onLoop\");\n }\n _executeLoop(context) {\n let index = context._getExecutionVariable(this, \"index\");\n const endIndex = context._getExecutionVariable(this, \"endIndex\");\n if (index < endIndex) {\n this.index.setValue(index, context);\n this.onLoop._activateSignal(context);\n const step = context._getExecutionVariable(this, \"step\", 1);\n index += step;\n context._setExecutionVariable(this, \"index\", index);\n this._executeLoop(context);\n } else {\n this.out._activateSignal(context);\n }\n }\n /**\n * @internal\n */\n _execute(context) {\n const index = this.startIndex.getValue(context);\n const endIndex = this.endIndex.getValue(context);\n const step = this.step.getValue(context);\n context._setExecutionVariable(this, \"index\", index);\n context._setExecutionVariable(this, \"endIndex\", endIndex);\n context._setExecutionVariable(this, \"step\", step);\n this._executeLoop(context);\n }\n /**\n * @returns class name of the block.\n */\n getClassName() {\n return \"FGForLoopBlock\";\n }\n}\nRegisterClass(\"FGForLoopBlock\", FlowGraphForLoopBlock);","map":{"version":3,"names":["FlowGraphExecutionBlockWithOutSignal","RichTypeNumber","RegisterClass","FlowGraphForLoopBlock","constructor","config","startIndex","registerDataInput","endIndex","step","index","registerDataOutput","onLoop","_registerSignalOutput","_executeLoop","context","_getExecutionVariable","setValue","_activateSignal","_setExecutionVariable","out","_execute","getValue","getClassName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js"],"sourcesContent":["import { FlowGraphExecutionBlockWithOutSignal } from \"../../../flowGraphExecutionBlockWithOutSignal.js\";\nimport { RichTypeNumber } from \"../../../flowGraphRichTypes.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\n/**\n * @experimental\n * Block that executes an action in a loop.\n */\nexport class FlowGraphForLoopBlock extends FlowGraphExecutionBlockWithOutSignal {\n constructor(config) {\n super(config);\n this.startIndex = this.registerDataInput(\"startIndex\", RichTypeNumber);\n this.endIndex = this.registerDataInput(\"endIndex\", RichTypeNumber);\n this.step = this.registerDataInput(\"step\", RichTypeNumber);\n this.index = this.registerDataOutput(\"index\", RichTypeNumber);\n this.onLoop = this._registerSignalOutput(\"onLoop\");\n }\n _executeLoop(context) {\n let index = context._getExecutionVariable(this, \"index\");\n const endIndex = context._getExecutionVariable(this, \"endIndex\");\n if (index < endIndex) {\n this.index.setValue(index, context);\n this.onLoop._activateSignal(context);\n const step = context._getExecutionVariable(this, \"step\", 1);\n index += step;\n context._setExecutionVariable(this, \"index\", index);\n this._executeLoop(context);\n }\n else {\n this.out._activateSignal(context);\n }\n }\n /**\n * @internal\n */\n _execute(context) {\n const index = this.startIndex.getValue(context);\n const endIndex = this.endIndex.getValue(context);\n const step = this.step.getValue(context);\n context._setExecutionVariable(this, \"index\", index);\n context._setExecutionVariable(this, \"endIndex\", endIndex);\n context._setExecutionVariable(this, \"step\", step);\n this._executeLoop(context);\n }\n /**\n * @returns class name of the block.\n */\n getClassName() {\n return \"FGForLoopBlock\";\n }\n}\nRegisterClass(\"FGForLoopBlock\", FlowGraphForLoopBlock);\n"],"mappings":"AAAA,SAASA,oCAAoC,QAAQ,kDAAkD;AACvG,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,aAAa,QAAQ,+BAA+B;AAC7D;AAC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