6822b929532a0858529ad073c52a2d38a85ff4f56a23f1e5a1fd4450337ee63f.json 9.4 KB

1
  1. {"ast":null,"code":"import { RegisterClass } from \"../Misc/typeStore.js\";\nimport { FlowGraphConnection } from \"./flowGraphConnection.js\";\nimport { RichType } from \"./flowGraphRichTypes.js\";\n/**\n * @experimental\n * Represents a connection point for data.\n * An unconnected input point can have a default value.\n * An output point will only have a value if it is connected to an input point. Furthermore,\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\n */\nexport class FlowGraphDataConnection extends FlowGraphConnection {\n /**\n * Create a new data connection point.\n * @param name\n * @param connectionType\n * @param ownerBlock\n * @param richType\n */\n constructor(name, connectionType, ownerBlock,\n /**\n * the type of the data in this block\n */\n richType) {\n super(name, connectionType, ownerBlock);\n this.richType = richType;\n }\n /**\n * An output data block can connect to multiple input data blocks,\n * but an input data block can only connect to one output data block.\n * @returns true if the connection is singular\n */\n _isSingularConnection() {\n return this.connectionType === 0 /* FlowGraphConnectionType.Input */;\n }\n /**\n * Set the value of the connection in a specific context.\n * @param value the value to set\n * @param context the context to which the value is set\n */\n setValue(value, context) {\n context._setConnectionValue(this, value);\n }\n /**\n * Connect this point to another point.\n * @param point the point to connect to.\n */\n connectTo(point) {\n super.connectTo(point);\n }\n _getValueOrDefault(context) {\n if (context._hasConnectionValue(this)) {\n return context._getConnectionValue(this);\n } else {\n return this.richType.defaultValue;\n }\n }\n /**\n * Gets the value of the connection in a specific context.\n * @param context the context from which the value is retrieved\n * @returns the value of the connection\n */\n getValue(context) {\n if (this.connectionType === 1 /* FlowGraphConnectionType.Output */) {\n context._notifyExecuteNode(this._ownerBlock);\n this._ownerBlock._updateOutputs(context);\n return this._getValueOrDefault(context);\n }\n if (!this.isConnected()) {\n return this._getValueOrDefault(context);\n } else {\n return this._connectedPoint[0].getValue(context);\n }\n }\n /**\n * @returns class name of the object.\n */\n getClassName() {\n return \"FGDataConnection\";\n }\n /**\n * Serializes this object.\n * @param serializationObject the object to serialize to\n */\n serialize(serializationObject = {}) {\n super.serialize(serializationObject);\n serializationObject.richType = {};\n this.richType.serialize(serializationObject.richType);\n }\n /**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @returns the parsed connection\n */\n static Parse(serializationObject, ownerBlock) {\n const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);\n obj.richType = RichType.Parse(serializationObject.richType);\n return obj;\n }\n}\nRegisterClass(\"FGDataConnection\", FlowGraphDataConnection);","map":{"version":3,"names":["RegisterClass","FlowGraphConnection","RichType","FlowGraphDataConnection","constructor","name","connectionType","ownerBlock","richType","_isSingularConnection","setValue","value","context","_setConnectionValue","connectTo","point","_getValueOrDefault","_hasConnectionValue","_getConnectionValue","defaultValue","getValue","_notifyExecuteNode","_ownerBlock","_updateOutputs","isConnected","_connectedPoint","getClassName","serialize","serializationObject","Parse","obj"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/flowGraphDataConnection.js"],"sourcesContent":["import { RegisterClass } from \"../Misc/typeStore.js\";\nimport { FlowGraphConnection } from \"./flowGraphConnection.js\";\nimport { RichType } from \"./flowGraphRichTypes.js\";\n/**\n * @experimental\n * Represents a connection point for data.\n * An unconnected input point can have a default value.\n * An output point will only have a value if it is connected to an input point. Furthermore,\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\n */\nexport class FlowGraphDataConnection extends FlowGraphConnection {\n /**\n * Create a new data connection point.\n * @param name\n * @param connectionType\n * @param ownerBlock\n * @param richType\n */\n constructor(name, connectionType, ownerBlock, \n /**\n * the type of the data in this block\n */\n richType) {\n super(name, connectionType, ownerBlock);\n this.richType = richType;\n }\n /**\n * An output data block can connect to multiple input data blocks,\n * but an input data block can only connect to one output data block.\n * @returns true if the connection is singular\n */\n _isSingularConnection() {\n return this.connectionType === 0 /* FlowGraphConnectionType.Input */;\n }\n /**\n * Set the value of the connection in a specific context.\n * @param value the value to set\n * @param context the context to which the value is set\n */\n setValue(value, context) {\n context._setConnectionValue(this, value);\n }\n /**\n * Connect this point to another point.\n * @param point the point to connect to.\n */\n connectTo(point) {\n super.connectTo(point);\n }\n _getValueOrDefault(context) {\n if (context._hasConnectionValue(this)) {\n return context._getConnectionValue(this);\n }\n else {\n return this.richType.defaultValue;\n }\n }\n /**\n * Gets the value of the connection in a specific context.\n * @param context the context from which the value is retrieved\n * @returns the value of the connection\n */\n getValue(context) {\n if (this.connectionType === 1 /* FlowGraphConnectionType.Output */) {\n context._notifyExecuteNode(this._ownerBlock);\n this._ownerBlock._updateOutputs(context);\n return this._getValueOrDefault(context);\n }\n if (!this.isConnected()) {\n return this._getValueOrDefault(context);\n }\n else {\n return this._connectedPoint[0].getValue(context);\n }\n }\n /**\n * @returns class name of the object.\n */\n getClassName() {\n return \"FGDataConnection\";\n }\n /**\n * Serializes this object.\n * @param serializationObject the object to serialize to\n */\n serialize(serializationObject = {}) {\n super.serialize(serializationObject);\n serializationObject.richType = {};\n this.richType.serialize(serializationObject.richType);\n }\n /**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @returns the parsed connection\n */\n static Parse(serializationObject, ownerBlock) {\n const obj = FlowGraphConnection.Parse(serializationObject, ownerBlock);\n obj.richType = RichType.Parse(serializationObject.richType);\n return obj;\n }\n}\nRegisterClass(\"FGDataConnection\", FlowGraphDataConnection);\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,QAAQ,QAAQ,yBAAyB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,SAASF,mBAAmB,CAAC;EAC7D;AACJ;AACA;AACA;AACA;AACA;AACA;EACIG,WAAWA,CAACC,IAAI,EAAEC,cAAc,EAAEC,UAAU;EAC5C;AACJ;AACA;EACIC,QAAQ,EAAE;IACN,KAAK,CAACH,IAAI,EAAEC,cAAc,EAAEC,UAAU,CAA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AC,EAAE;IAChC,KAAK,CAACD,SAAS,CAACC,mBAAmB,CAAC;IACpCA,mBAAmB,CAACpB,QAAQ,GAAG,CAAC,CAAC;IACjC,IAAI,CAACA,QAAQ,CAACmB,SAAS,CAACC,mBAAmB,CAACpB,QAAQ,CAAC;EACzD;EACA;AACJ;AACA;AACA;AACA;AACA;EACI,OAAOqB,KAAKA,CAACD,mBAAmB,EAAErB,UAAU,EAAE;IAC1C,MAAMuB,GAAG,GAAG7B,mBAAmB,CAAC4B,KAAK,CAACD,mBAAmB,EAAErB,UAAU,CAAC;IACtEuB,GAAG,CAACtB,QAAQ,GAAGN,QAAQ,CAAC2B,KAAK,CAACD,mBAAmB,CAACpB,QAAQ,CAAC;IAC3D,OAAOsB,GAAG;EACd;AACJ;AACA9B,aAAa,CAAC,kBAAkB,EAAEG,uBAAuB,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}