@babylonjs/loaders 9.26.1 → 9.27.0

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 (69) hide show
  1. package/SPLAT/gaussianSplattingStream.d.ts +79 -25
  2. package/SPLAT/gaussianSplattingStream.js +320 -95
  3. package/SPLAT/gaussianSplattingStream.js.map +1 -1
  4. package/glTF/2.0/Extensions/EXT_texture_avif.pure.js +1 -1
  5. package/glTF/2.0/Extensions/EXT_texture_avif.pure.js.map +1 -1
  6. package/glTF/2.0/Extensions/EXT_texture_webp.pure.js +1 -1
  7. package/glTF/2.0/Extensions/EXT_texture_webp.pure.js.map +1 -1
  8. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +143 -3
  9. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +622 -99
  10. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
  11. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.d.ts +47 -0
  12. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js +68 -0
  13. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js.map +1 -0
  14. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +2 -2
  15. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +1 -1
  16. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -1
  17. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.d.ts +24 -0
  18. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js +38 -0
  19. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js.map +1 -0
  20. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.d.ts +41 -0
  21. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js +63 -0
  22. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js.map +1 -0
  23. package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +6 -0
  24. package/glTF/2.0/Extensions/KHR_interactivity/index.js +6 -0
  25. package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -1
  26. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.d.ts +243 -0
  27. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.js +2335 -0
  28. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.js.map +1 -0
  29. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.d.ts +193 -0
  30. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js +919 -0
  31. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js.map +1 -0
  32. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +30 -10
  33. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +485 -54
  34. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
  35. package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.d.ts +2 -1
  36. package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js +7 -2
  37. package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js.map +1 -1
  38. package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.d.ts +24 -0
  39. package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js +89 -0
  40. package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js.map +1 -0
  41. package/glTF/2.0/Extensions/KHR_interactivity/pure.d.ts +6 -0
  42. package/glTF/2.0/Extensions/KHR_interactivity/pure.js +6 -0
  43. package/glTF/2.0/Extensions/KHR_interactivity/pure.js.map +1 -1
  44. package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +59 -1
  45. package/glTF/2.0/Extensions/KHR_interactivity.pure.js +129 -77
  46. package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
  47. package/glTF/2.0/Extensions/KHR_interactivity.types.d.ts +18 -1
  48. package/glTF/2.0/Extensions/KHR_interactivity.types.js.map +1 -1
  49. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +2 -0
  50. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +114 -56
  51. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
  52. package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +2 -0
  53. package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +80 -35
  54. package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
  55. package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js +1 -1
  56. package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js.map +1 -1
  57. package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js +3 -2
  58. package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js.map +1 -1
  59. package/glTF/2.0/Extensions/objectModelMapping.d.ts +4 -2
  60. package/glTF/2.0/Extensions/objectModelMapping.js +33 -4
  61. package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
  62. package/glTF/2.0/glTFLoader.pure.d.ts +3 -2
  63. package/glTF/2.0/glTFLoader.pure.js +50 -8
  64. package/glTF/2.0/glTFLoader.pure.js.map +1 -1
  65. package/glTF/2.0/glTFLoaderExtension.d.ts +2 -1
  66. package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
  67. package/glTF/2.0/glTFLoaderInterfaces.d.ts +9 -0
  68. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  69. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"interactivityGraphParser.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.ts"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;IACN,CAAC;CACJ","sourcesContent":["import { type IKHRInteractivity_Graph, type IKHRInteractivity_Node, type IKHRInteractivity_OutputSocketReference, type IKHRInteractivity_Variable } from \"babylonjs-gltf2interface\";\nimport { type IGLTF } from \"../../glTFLoaderInterfaces\";\nimport { type IGLTFToFlowGraphMapping, getMappingForDeclaration, getMappingForFullOperationName } from \"./declarationMapper\";\nimport { Logger } from \"core/Misc/logger\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphConnection, type ISerializedFlowGraphContext } from \"core/FlowGraph/typeDefinitions\";\nimport { RandomGUID } from \"core/Misc/guid\";\nimport { FlowGraphBlockNames } from \"core/FlowGraph/Blocks/flowGraphBlockNames\";\nimport { FlowGraphConnectionType } from \"core/FlowGraph/flowGraphConnection\";\nimport { FlowGraphTypes } from \"core/FlowGraph/flowGraphRichTypes\";\n\n/**\n * Description of a KHR_interactivity custom event, as parsed from the\n * glTF `events` array. Used by the importer to register the event with the\n * FlowGraph send/receive event blocks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface InteractivityEvent {\n /** Identifier of the event, used to match send and receive blocks. */\n eventId: string;\n /**\n * Optional payload schema for the event. Each entry describes one\n * value carried by the event: an `id` (the FlowGraph data socket name),\n * a `type` (glTF interactivity type name) and an optional default\n * `value`. `eventData` (the boolean) is currently unused.\n */\n eventData?: {\n eventData: boolean;\n id: string;\n type: string;\n value?: any;\n }[];\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const gltfTypeToBabylonType: {\n [key: string]: { length: number; flowGraphType: FlowGraphTypes; elementType: \"number\" | \"boolean\" | \"string\" };\n} = {\n float: { length: 1, flowGraphType: FlowGraphTypes.Number, elementType: \"number\" },\n bool: { length: 1, flowGraphType: FlowGraphTypes.Boolean, elementType: \"boolean\" },\n float2: { length: 2, flowGraphType: FlowGraphTypes.Vector2, elementType: \"number\" },\n float3: { length: 3, flowGraphType: FlowGraphTypes.Vector3, elementType: \"number\" },\n float4: { length: 4, flowGraphType: FlowGraphTypes.Vector4, elementType: \"number\" },\n float4x4: { length: 16, flowGraphType: FlowGraphTypes.Matrix, elementType: \"number\" },\n float2x2: { length: 4, flowGraphType: FlowGraphTypes.Matrix2D, elementType: \"number\" },\n float3x3: { length: 9, flowGraphType: FlowGraphTypes.Matrix3D, elementType: \"number\" },\n int: { length: 1, flowGraphType: FlowGraphTypes.Integer, elementType: \"number\" },\n // KHR_interactivity opaque reference type. Represented as a JSON Pointer string\n // (e.g. \"/nodes/17/\") that addresses a glTF object. The empty string is the\n // canonical \"null reference\" sentinel used by the parser.\n ref: { length: 1, flowGraphType: FlowGraphTypes.String, elementType: \"string\" },\n};\n\n/**\n * Parses a KHR_interactivity graph definition (the raw glTF JSON object) into\n * the serialized FlowGraph form consumed by {@link ParseFlowGraphAsync}.\n *\n * The class walks the interactivity types, declarations, variables, events\n * and nodes in order and emits an {@link ISerializedFlowGraph} via\n * {@link serializeToFlowGraph}.\n */\nexport class InteractivityGraphToFlowGraphParser {\n /**\n * Note - the graph should be rejected if the same type is defined twice.\n * We currently don't validate that.\n */\n private _types: { length: number; flowGraphType: FlowGraphTypes; elementType: \"number\" | \"boolean\" | \"string\" }[] = [];\n private _mappings: { flowGraphMapping: IGLTFToFlowGraphMapping; fullOperationName: string }[] = [];\n private _staticVariables: { type: FlowGraphTypes; value: any[] }[] = [];\n private _events: InteractivityEvent[] = [];\n private _internalEventsCounter: number = 0;\n private _nodes: { blocks: ISerializedFlowGraphBlock[]; fullOperationName: string }[] = [];\n /**\n * Extra blocks the parser inserts between existing nodes (e.g. the seconds→frames multiply for\n * connected animation-time inputs). Kept separate from any node's `blocks` array so per-node\n * post-processing that indexes into that array (such as the animation extraProcessors targeting\n * the last block) is not disturbed, then concatenated into the serialized graph.\n */\n private _insertedBlocks: ISerializedFlowGraphBlock[] = [];\n\n constructor(\n private _interactivityGraph: IKHRInteractivity_Graph,\n private _gltf: IGLTF,\n public _animationTargetFps: number = 60\n ) {\n // start with types\n this._parseTypes();\n // continue with declarations\n this._parseDeclarations();\n this._parseVariables();\n this._parseEvents();\n this._parseNodes();\n }\n\n public get arrays() {\n return {\n types: this._types,\n mappings: this._mappings,\n staticVariables: this._staticVariables,\n events: this._events,\n nodes: this._nodes,\n };\n }\n\n private _parseTypes() {\n if (!this._interactivityGraph.types) {\n return;\n }\n for (const type of this._interactivityGraph.types) {\n this._types.push(gltfTypeToBabylonType[type.signature]);\n }\n }\n\n private _parseDeclarations() {\n if (!this._interactivityGraph.declarations) {\n return;\n }\n for (const declaration of this._interactivityGraph.declarations) {\n // make sure we have the mapping for this operation\n const mapping = getMappingForDeclaration(declaration);\n // mapping is defined, because we generate an empty mapping if it's not found\n if (!mapping) {\n Logger.Error([\"No mapping found for declaration\", declaration]);\n throw new Error(\"Error parsing declarations\");\n }\n this._mappings.push({\n flowGraphMapping: mapping,\n fullOperationName: declaration.extension ? declaration.op + \":\" + declaration.extension : declaration.op,\n });\n }\n }\n\n private _parseVariables() {\n if (!this._interactivityGraph.variables) {\n return;\n }\n for (const variable of this._interactivityGraph.variables) {\n const parsed = this._parseVariable(variable);\n // set the default values here\n this._staticVariables.push(parsed);\n }\n }\n\n private _parseVariable(variable: IKHRInteractivity_Variable, dataTransform?: (value: any, parser: InteractivityGraphToFlowGraphParser) => any) {\n const type = this._types[variable.type];\n if (!type) {\n Logger.Error([\"No type found for variable\", variable]);\n throw new Error(\"Error parsing variables\");\n }\n if (variable.value) {\n if (variable.value.length !== type.length) {\n Logger.Error([\"Invalid value length for variable\", variable, type]);\n throw new Error(\"Error parsing variables\");\n }\n }\n const value = variable.value || [];\n if (!value.length) {\n switch (type.flowGraphType) {\n case FlowGraphTypes.Boolean:\n value.push(false);\n break;\n case FlowGraphTypes.Integer:\n value.push(0);\n break;\n case FlowGraphTypes.Number:\n value.push(NaN);\n break;\n case FlowGraphTypes.String:\n // Default for a `ref`-typed value is the null reference, encoded as the empty string.\n value.push(\"\" as any);\n break;\n case FlowGraphTypes.Vector2:\n value.push(NaN, NaN);\n break;\n case FlowGraphTypes.Vector3:\n value.push(NaN, NaN, NaN);\n break;\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Matrix2D:\n case FlowGraphTypes.Quaternion:\n value.fill(NaN, 0, 4);\n break;\n case FlowGraphTypes.Matrix:\n value.fill(NaN, 0, 16);\n break;\n case FlowGraphTypes.Matrix3D:\n value.fill(NaN, 0, 9);\n break;\n default:\n break;\n }\n }\n // in case of NaN, Infinity, we need to parse the string to the object itself\n if (type.elementType === \"number\" && typeof value[0] === \"string\") {\n value[0] = parseFloat(value[0]);\n }\n return { type: type.flowGraphType, value: dataTransform ? dataTransform(value, this) : value };\n }\n\n private _parseEvents() {\n if (!this._interactivityGraph.events) {\n return;\n }\n for (const event of this._interactivityGraph.events) {\n const converted: InteractivityEvent = {\n eventId: event.id || \"internalEvent_\" + this._internalEventsCounter++,\n };\n if (event.values) {\n converted.eventData = Object.keys(event.values).map((key) => {\n const eventValue = event.values?.[key];\n if (!eventValue) {\n Logger.Error([\"No value found for event key\", key]);\n throw new Error(\"Error parsing events\");\n }\n const type = this._types[eventValue.type];\n if (!type) {\n Logger.Error([\"No type found for event value\", eventValue]);\n throw new Error(\"Error parsing events\");\n }\n const value = typeof eventValue.value !== \"undefined\" ? this._parseVariable(eventValue) : undefined;\n return {\n id: key,\n type: type.flowGraphType,\n eventData: true,\n value,\n };\n });\n }\n this._events.push(converted);\n }\n }\n\n private _parseNodes() {\n if (!this._interactivityGraph.nodes) {\n return;\n }\n for (const node of this._interactivityGraph.nodes) {\n // some validation\n if (typeof node.declaration !== \"number\") {\n Logger.Error([\"No declaration found for node\", node]);\n throw new Error(\"Error parsing nodes\");\n }\n const mapping = this._mappings[node.declaration];\n if (!mapping) {\n Logger.Error([\"No mapping found for node\", node]);\n throw new Error(\"Error parsing nodes\");\n }\n if (mapping.flowGraphMapping.validation) {\n const validationResult = mapping.flowGraphMapping.validation(node, this._interactivityGraph, this._gltf);\n if (!validationResult.valid) {\n throw new Error(`Error validating interactivity node ${this._interactivityGraph.declarations?.[node.declaration].op} - ${validationResult.error}`);\n }\n }\n const blocks: ISerializedFlowGraphBlock[] = [];\n // create block(s) for this node using the mapping\n for (const blockType of mapping.flowGraphMapping.blocks) {\n const block = this._getEmptyBlock(blockType, mapping.fullOperationName);\n this._parseNodeConfiguration(node, block, mapping.flowGraphMapping, blockType);\n blocks.push(block);\n }\n this._nodes.push({ blocks, fullOperationName: mapping.fullOperationName });\n }\n }\n\n private _getEmptyBlock(className: string, type: string): ISerializedFlowGraphBlock {\n return {\n uniqueId: RandomGUID(),\n className,\n dataInputs: [],\n dataOutputs: [],\n signalInputs: [],\n signalOutputs: [],\n config: {},\n type,\n metadata: {},\n };\n }\n\n private _parseNodeConfiguration(node: IKHRInteractivity_Node, block: ISerializedFlowGraphBlock, nodeMapping: IGLTFToFlowGraphMapping, blockType: FlowGraphBlockNames | string) {\n const gltfConfiguration = node.configuration;\n if (gltfConfiguration) {\n for (const key in gltfConfiguration) {\n const gltfProperty = gltfConfiguration[key];\n if (!gltfProperty) {\n throw new Error(\"Error parsing node configuration\");\n }\n\n const propertyMapping = nodeMapping.configuration?.[key];\n const belongsToBlock = propertyMapping && propertyMapping.toBlock ? propertyMapping.toBlock === blockType : nodeMapping.blocks.indexOf(blockType) === 0;\n if (belongsToBlock) {\n let value = propertyMapping?.defaultValue;\n if (gltfProperty?.value) {\n value = gltfProperty.value;\n }\n\n if (!propertyMapping?.isArray) {\n if (value.length !== 1) {\n Logger.Warn(`Invalid non-array value length: ${value.length}`);\n }\n\n value = value[0];\n }\n\n if (propertyMapping?.dataTransformer) {\n value = propertyMapping.dataTransformer(value, this);\n }\n\n if (value !== undefined) {\n // Update the flow graph block config.\n block.config[propertyMapping?.name || key] = {\n value: value,\n };\n }\n }\n }\n }\n }\n\n private _parseNodeConnections(context: ISerializedFlowGraphContext) {\n for (let i = 0; i < this._nodes.length; i++) {\n // get the corresponding gltf node\n const gltfNode = this._interactivityGraph.nodes?.[i];\n if (!gltfNode) {\n // should never happen but let's still check\n Logger.Error([\"No node found for interactivity node\", this._nodes[i]]);\n throw new Error(\"Error parsing node connections\");\n }\n const flowGraphBlocks = this._nodes[i];\n const outputMapper = this._mappings[gltfNode.declaration];\n // validate\n if (!outputMapper) {\n Logger.Error([\"No mapping found for node\", gltfNode]);\n throw new Error(\"Error parsing node connections\");\n }\n // KHR_interactivity spec section 3.2.4 \"Unsupported Operations\":\n // nodes referring to unsupported operations are demoted to no-ops.\n // Activations of their input flow sockets are ignored, their output\n // flow sockets are never activated, and their output value sockets\n // return constant type-default values. They have no backing\n // FlowGraph blocks (blocks.length === 0), so there is nothing to\n // wire for this node — skip all of its connections.\n if (flowGraphBlocks.blocks.length === 0) {\n Logger.Warn(`Skipping connections for no-op node #${i} (unsupported operation: ${flowGraphBlocks.fullOperationName})`);\n continue;\n }\n const flowsFromGLTF = gltfNode.flows || {};\n const flowsKeys = Object.keys(flowsFromGLTF).sort(); // sorting as some operations require sorted keys\n // connect the flows\n for (const flowKey of flowsKeys) {\n const flow = flowsFromGLTF[flowKey];\n const flowMapping = outputMapper.flowGraphMapping.outputs?.flows?.[flowKey];\n const socketOutName = flowMapping?.name || flowKey;\n // get the input node of this block\n const inputNodeId = flow.node;\n const nodeIn = this._nodes[inputNodeId];\n if (!nodeIn) {\n Logger.Error([\"No node found for input node id\", inputNodeId]);\n throw new Error(\"Error parsing node connections\");\n }\n // Spec 3.2.4: input flow activations on no-op nodes are ignored,\n // so a flow connection into a no-op target is itself a no-op.\n // Drop it instead of crashing on the missing target block.\n if (nodeIn.blocks.length === 0) {\n Logger.Warn(`Dropping flow connection from node #${i} \"${flowKey}\" to no-op node #${inputNodeId} (unsupported operation: ${nodeIn.fullOperationName})`);\n continue;\n }\n // create a serialized socket\n const socketOut = this._createNewSocketConnection(socketOutName, true);\n const block = (flowMapping && flowMapping.toBlock && flowGraphBlocks.blocks.find((b) => b.className === flowMapping.toBlock)) || flowGraphBlocks.blocks[0];\n block.signalOutputs.push(socketOut);\n // get the mapper for the input node - in case it mapped to multiple blocks\n const inputMapper = getMappingForFullOperationName(nodeIn.fullOperationName);\n if (!inputMapper) {\n Logger.Error([\"No mapping found for input node\", nodeIn]);\n throw new Error(\"Error parsing node connections\");\n }\n let flowInMapping = inputMapper.inputs?.flows?.[flow.socket || \"in\"];\n let arrayMapping = false;\n if (!flowInMapping) {\n for (const key in inputMapper.inputs?.flows) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n arrayMapping = true;\n flowInMapping = inputMapper.inputs?.flows?.[key];\n }\n }\n }\n const nodeInSocketName = flowInMapping ? (arrayMapping ? flowInMapping.name.replace(\"$1\", flow.socket || \"\") : flowInMapping.name) : flow.socket || \"in\";\n const inputBlock = (flowInMapping && flowInMapping.toBlock && nodeIn.blocks.find((b) => b.className === flowInMapping.toBlock)) || nodeIn.blocks[0];\n // in all of the flow graph input connections, find the one with the same name as the socket\n let socketIn = inputBlock.signalInputs.find((s) => s.name === nodeInSocketName);\n // if the socket doesn't exist, create the input socket for the connection\n if (!socketIn) {\n socketIn = this._createNewSocketConnection(nodeInSocketName);\n inputBlock.signalInputs.push(socketIn);\n }\n // connect the sockets\n socketIn.connectedPointIds.push(socketOut.uniqueId);\n socketOut.connectedPointIds.push(socketIn.uniqueId);\n }\n // connect the values\n const valuesFromGLTF = gltfNode.values || {};\n const valuesKeys = Object.keys(valuesFromGLTF);\n for (const valueKey of valuesKeys) {\n const value = valuesFromGLTF[valueKey];\n let valueMapping = outputMapper.flowGraphMapping.inputs?.values?.[valueKey];\n let arrayMapping = false;\n if (!valueMapping) {\n for (const key in outputMapper.flowGraphMapping.inputs?.values) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n arrayMapping = true;\n valueMapping = outputMapper.flowGraphMapping.inputs?.values?.[key];\n }\n }\n }\n const socketInName = valueMapping ? (arrayMapping ? valueMapping.name.replace(\"$1\", valueKey) : valueMapping.name) : valueKey;\n // create a serialized socket\n const socketIn = this._createNewSocketConnection(socketInName);\n const block = (valueMapping && valueMapping.toBlock && flowGraphBlocks.blocks.find((b) => b.className === valueMapping.toBlock)) || flowGraphBlocks.blocks[0];\n block.dataInputs.push(socketIn);\n // Captured before the connected branch below shadows `valueMapping`. When set and the\n // value is supplied by a connection, the seconds→frames `dataTransformer` cannot run\n // (it is parse-time only), so the raw connected value is scaled by a runtime multiply.\n const convertConnectedTimeToFrames = !!valueMapping?.convertConnectedTimeToFrames;\n if ((value as IKHRInteractivity_Variable).value !== undefined) {\n const convertedValue = this._parseVariable(value as IKHRInteractivity_Variable, valueMapping && valueMapping.dataTransformer);\n context._connectionValues[socketIn.uniqueId] = convertedValue;\n } else if (typeof (value as IKHRInteractivity_OutputSocketReference).node !== \"undefined\") {\n const nodeOutId = (value as IKHRInteractivity_OutputSocketReference).node;\n const nodeOutSocketName = (value as IKHRInteractivity_OutputSocketReference).socket || \"value\";\n const nodeOut = this._nodes[nodeOutId];\n if (!nodeOut) {\n Logger.Error([\"No node found for output socket reference\", value]);\n throw new Error(\"Error parsing node connections\");\n }\n // Spec 3.2.4: output value sockets of no-op nodes return\n // constant type-default values. Leave the consumer's\n // dataInput unconnected (no connectedPointIds) so the\n // FlowGraph runtime falls back to the RichType default.\n if (nodeOut.blocks.length === 0) {\n Logger.Warn(\n `Dropping value connection from no-op node #${nodeOutId} (unsupported operation: ${nodeOut.fullOperationName}) into node #${i} \"${valueKey}\"; consumer will use type-default value`\n );\n continue;\n }\n const outputMapper = getMappingForFullOperationName(nodeOut.fullOperationName);\n if (!outputMapper) {\n Logger.Error([\"No mapping found for output socket reference\", value]);\n throw new Error(\"Error parsing node connections\");\n }\n let valueMapping = outputMapper.outputs?.values?.[nodeOutSocketName];\n let arrayMapping = false;\n // check if there is an array mapping defined\n if (!valueMapping) {\n // search for a value mapping that has an array mapping\n for (const key in outputMapper.outputs?.values) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n arrayMapping = true;\n valueMapping = outputMapper.outputs?.values?.[key];\n }\n }\n }\n const socketOutName = valueMapping ? (arrayMapping ? valueMapping.name.replace(\"$1\", nodeOutSocketName) : valueMapping?.name) : nodeOutSocketName;\n const outBlock = (valueMapping && valueMapping.toBlock && nodeOut.blocks.find((b) => b.className === valueMapping.toBlock)) || nodeOut.blocks[0];\n let socketOut = outBlock.dataOutputs.find((s) => s.name === socketOutName);\n // if the socket doesn't exist, create it\n if (!socketOut) {\n socketOut = this._createNewSocketConnection(socketOutName, true);\n outBlock.dataOutputs.push(socketOut);\n }\n // connect the sockets\n if (convertConnectedTimeToFrames) {\n this._connectWithSecondsToFramesConversion(context, socketOut, socketIn);\n } else {\n socketIn.connectedPointIds.push(socketOut.uniqueId);\n socketOut.connectedPointIds.push(socketIn.uniqueId);\n }\n } else {\n Logger.Error([\"Invalid value for value connection\", value]);\n throw new Error(\"Error parsing node connections\");\n }\n }\n\n // inter block connections\n if (outputMapper.flowGraphMapping.interBlockConnectors) {\n for (const connector of outputMapper.flowGraphMapping.interBlockConnectors) {\n const input = connector.input;\n const output = connector.output;\n const isVariable = connector.isVariable;\n this._connectFlowGraphNodes(input, output, flowGraphBlocks.blocks[connector.inputBlockIndex], flowGraphBlocks.blocks[connector.outputBlockIndex], isVariable);\n }\n }\n\n if (outputMapper.flowGraphMapping.extraProcessor) {\n const declaration = this._interactivityGraph.declarations?.[gltfNode.declaration];\n if (!declaration) {\n Logger.Error([\"No declaration found for extra processor\", gltfNode]);\n throw new Error(\"Error parsing node connections\");\n }\n flowGraphBlocks.blocks = outputMapper.flowGraphMapping.extraProcessor(\n gltfNode,\n declaration,\n outputMapper.flowGraphMapping,\n this,\n flowGraphBlocks.blocks,\n context,\n this._gltf\n );\n }\n }\n }\n\n private _createNewSocketConnection(name: string, isOutput?: boolean): ISerializedFlowGraphConnection {\n return {\n uniqueId: RandomGUID(),\n name,\n _connectionType: isOutput ? FlowGraphConnectionType.Output : FlowGraphConnectionType.Input,\n connectedPointIds: [],\n };\n }\n\n /**\n * Wires an upstream data output into a downstream data input through a runtime multiply block that\n * scales the value by the animation target fps. This converts a KHR animation time (seconds),\n * delivered by a connection (e.g. a `pointer/get` on the `maxTime` animation pointer), into the\n * Babylon animation frames expected by the play/stop-animation blocks. Literal times are already\n * converted at parse time by the input's `dataTransformer`, so this is only used for connections.\n * @param context the serialized flow graph context that stores literal socket values\n * @param upstreamOutput the data output socket providing the time value (in seconds)\n * @param downstreamInput the data input socket that expects the time in frames\n */\n private _connectWithSecondsToFramesConversion(\n context: ISerializedFlowGraphContext,\n upstreamOutput: ISerializedFlowGraphConnection,\n downstreamInput: ISerializedFlowGraphConnection\n ): void {\n const multiplyBlock = this._getEmptyBlock(FlowGraphBlockNames.Multiply, FlowGraphBlockNames.Multiply);\n // Scalar (float) multiply; matches how the `math/mul` mapping configures the block.\n multiplyBlock.config = { type: FlowGraphTypes.Number };\n const inputA = this._createNewSocketConnection(\"a\");\n const inputB = this._createNewSocketConnection(\"b\");\n const output = this._createNewSocketConnection(\"value\", true);\n multiplyBlock.dataInputs.push(inputA, inputB);\n multiplyBlock.dataOutputs.push(output);\n // The second factor is the constant animation target fps.\n context._connectionValues[inputB.uniqueId] = { type: FlowGraphTypes.Number, value: [this._animationTargetFps] };\n // upstream time output -> multiply.a\n inputA.connectedPointIds.push(upstreamOutput.uniqueId);\n upstreamOutput.connectedPointIds.push(inputA.uniqueId);\n // multiply.value (frames) -> downstream time input\n downstreamInput.connectedPointIds.push(output.uniqueId);\n output.connectedPointIds.push(downstreamInput.uniqueId);\n // Register the inserted block separately so serializeToFlowGraph picks it up without\n // appending to any node's block list (which would break per-node extraProcessors).\n this._insertedBlocks.push(multiplyBlock);\n }\n\n private _connectFlowGraphNodes(input: string, output: string, serializedInput: ISerializedFlowGraphBlock, serializedOutput: ISerializedFlowGraphBlock, isVariable?: boolean) {\n const inputArray = isVariable ? serializedInput.dataInputs : serializedInput.signalInputs;\n const outputArray = isVariable ? serializedOutput.dataOutputs : serializedOutput.signalOutputs;\n const inputConnection = inputArray.find((s) => s.name === input) || this._createNewSocketConnection(input);\n const outputConnection = outputArray.find((s) => s.name === output) || this._createNewSocketConnection(output, true);\n // of not found add it to the array\n if (!inputArray.find((s) => s.name === input)) {\n inputArray.push(inputConnection);\n }\n if (!outputArray.find((s) => s.name === output)) {\n outputArray.push(outputConnection);\n }\n // connect the sockets\n inputConnection.connectedPointIds.push(outputConnection.uniqueId);\n outputConnection.connectedPointIds.push(inputConnection.uniqueId);\n }\n\n /**\n * Returns the deterministic FlowGraph user-variable name used for the\n * static variable at the given declaration index.\n * @param index zero-based index into the interactivity graph's `variables` array.\n * @returns the FlowGraph variable name (e.g. `staticVariable_3`).\n */\n public getVariableName(index: number) {\n return \"staticVariable_\" + index;\n }\n\n /**\n * Serializes the parsed interactivity graph into the {@link ISerializedFlowGraph}\n * payload consumed by `ParseFlowGraphAsync`. Performs node-connection wiring\n * and seeds the execution context with the graph's static variables.\n * @returns the serialized FlowGraph for the parsed KHR_interactivity graph.\n */\n public serializeToFlowGraph(): ISerializedFlowGraph {\n const context: ISerializedFlowGraphContext = {\n uniqueId: RandomGUID(),\n _userVariables: {},\n _connectionValues: {},\n };\n this._parseNodeConnections(context);\n for (let i = 0; i < this._staticVariables.length; i++) {\n const variable = this._staticVariables[i];\n context._userVariables[this.getVariableName(i)] = variable;\n }\n\n const allBlocks = this._nodes.reduce((acc, val) => acc.concat(val.blocks), [] as ISerializedFlowGraphBlock[]).concat(this._insertedBlocks);\n\n return {\n rightHanded: true,\n allBlocks,\n executionContexts: [context],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"interactivityGraphParser.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,wBAAwB,EACxB,4BAA4B,EAC5B,gCAAgC,EAChC,4CAA4C,EAC5C,qBAAqB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB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AAI,CAAC,eAAe,CAAC,CAAC;QAE3I,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,IAAI,SAAS,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE;YACtE,QAAQ,EAAE;gBACN,gBAAgB,EAAE;oBACd,UAAU,EAAE,IAAI,CAAC,WAAW;oBAC5B,mBAAmB,EAAE,sCAAsC;oBAC3D,MAAM,EAAE,0BAA0B,CAAC,IAAI,CAAC,eAAe,CAAC;iBAChB;aAC/C;YACD,WAAW,EAAE,IAAI;YACjB,SAAS;YACT,iBAAiB,EAAE,CAAC,OAAO,CAAC;SAC/B,CAAC;IACN,CAAC;CACJ","sourcesContent":["import { type IKHRInteractivity_Graph, type IKHRInteractivity_Node, type IKHRInteractivity_OutputSocketReference, type IKHRInteractivity_Variable } from \"babylonjs-gltf2interface\";\nimport { type IGLTF } from \"../../glTFLoaderInterfaces\";\nimport {\n type IGLTFToFlowGraphMapping,\n type IGLTFToFlowGraphMappingObject,\n getMappingForDeclaration,\n getNoOpMappingForDeclaration,\n HasDefaultInteractivityFlowInput,\n NormalizeInteractivityEventDataConfiguration,\n ParseDebugLogTemplate,\n} from \"./declarationMapper\";\nimport { Logger } from \"core/Misc/logger\";\nimport { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphConnection, type ISerializedFlowGraphContext } from \"core/FlowGraph/typeDefinitions\";\nimport { RandomGUID } from \"core/Misc/guid\";\nimport { FlowGraphBlockNames } from \"core/FlowGraph/Blocks/flowGraphBlockNames\";\nimport { FlowGraphConnectionType } from \"core/FlowGraph/flowGraphConnection\";\nimport { type FlowGraph } from \"core/FlowGraph/flowGraph\";\nimport { FlowGraphTypes } from \"core/FlowGraph/flowGraphRichTypes\";\nimport {\n _CreateKHRInteractivityRuntimeValueSnapshot,\n CloneKHRInteractivityGraph,\n CreateEffectiveKHRInteractivityGraph,\n gltfTypeToBabylonType,\n KHR_INTERACTIVITY_SPECIFICATION_COMMIT,\n type IKHRInteractivityBlockProvenance,\n type IKHRInteractivityConfigurationProvenance,\n type IKHRInteractivityDeclarationModel,\n type IKHRInteractivityGraphProvenance,\n type IKHRInteractivitySocketProvenance,\n} from \"./interactivityGraphModel\";\nimport { DelayReferencePrefix, EventReferencePrefix } from \"./interactivityReferences\";\n\n/**\n * Description of a KHR_interactivity custom event, as parsed from the\n * glTF `events` array. Used by the importer to register the event with the\n * FlowGraph send/receive event blocks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface InteractivityEvent {\n /** Identifier of the event, used to match send and receive blocks. */\n eventId: string;\n /**\n * Optional payload schema for the event. Each entry describes one\n * value carried by the event: an `id` (the FlowGraph data socket name),\n * a `type` (glTF interactivity type name) and an optional default\n * `value`. `eventData` (the boolean) is currently unused.\n */\n eventData?: {\n eventData: boolean;\n id: string;\n type: string;\n value?: any;\n }[];\n}\nexport { gltfTypeToBabylonType } from \"./interactivityGraphModel\";\n\nfunction _GetOwnMapping<T>(mapping: { [name: string]: T } | undefined, key: string): T | undefined {\n return mapping && Object.prototype.hasOwnProperty.call(mapping, key) ? mapping[key] : undefined;\n}\n\nfunction _CloneMetadataValue<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((entry) => _CloneMetadataValue(entry)) as T;\n }\n if (value !== null && typeof value === \"object\") {\n const clone: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n Object.defineProperty(clone, key, {\n configurable: true,\n enumerable: true,\n value: _CloneMetadataValue(entry),\n writable: true,\n });\n }\n return clone as T;\n }\n return value;\n}\n\nfunction _IsSerializableConfigurationValue(value: unknown): boolean {\n return (\n value === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof value) ||\n (Array.isArray(value) && value.every(_IsSerializableConfigurationValue)) ||\n (typeof value === \"object\" && Object.values(value as Record<string, unknown>).every(_IsSerializableConfigurationValue))\n );\n}\n\n/**\n * Captures import-time defaults for unconnected runtime inputs that have no authored KHR socket.\n * @param flowGraph the fully parsed FlowGraph\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function _CaptureKHRInteractivityRuntimeInputDefaults(flowGraph: FlowGraph): void {\n for (const block of flowGraph.getAllBlocks()) {\n const provenance = block.metadata?.khrInteractivity as IKHRInteractivityBlockProvenance | undefined;\n if (!provenance) {\n continue;\n }\n if (Object.prototype.hasOwnProperty.call(provenance.generatedConfiguration ?? {}, \"eventData\")) {\n provenance.generatedConfigurationRuntime ||= {};\n if (!Object.prototype.hasOwnProperty.call(provenance.generatedConfigurationRuntime, \"eventData\")) {\n Object.defineProperty(provenance.generatedConfigurationRuntime, \"eventData\", {\n configurable: true,\n enumerable: true,\n value: _CreateKHRInteractivityRuntimeValueSnapshot(NormalizeInteractivityEventDataConfiguration(block.config?.eventData)),\n writable: true,\n });\n }\n }\n for (const input of block.dataInputs) {\n if (input.isConnected()) {\n continue;\n }\n const socketProvenance = input.metadata?.khrInteractivity as IKHRInteractivitySocketProvenance | undefined;\n if (socketProvenance) {\n socketProvenance.runtimeValueSnapshot ??= _CreateKHRInteractivityRuntimeValueSnapshot((input as any)._defaultValue);\n continue;\n }\n if (provenance.generatedInputDefaults && Object.prototype.hasOwnProperty.call(provenance.generatedInputDefaults, input.name)) {\n continue;\n }\n provenance.generatedInputDefaults ||= {};\n Object.defineProperty(provenance.generatedInputDefaults, input.name, {\n configurable: true,\n enumerable: true,\n value: _CreateKHRInteractivityRuntimeValueSnapshot((input as any)._defaultValue),\n writable: true,\n });\n }\n }\n}\n\n/**\n * Parses a KHR_interactivity graph definition (the raw glTF JSON object) into\n * the serialized FlowGraph form consumed by {@link ParseFlowGraphAsync}.\n *\n * The class walks the interactivity types, declarations, variables, events\n * and nodes in order and emits an {@link ISerializedFlowGraph} via\n * {@link serializeToFlowGraph}.\n */\nexport class InteractivityGraphToFlowGraphParser {\n /**\n * Note - the graph should be rejected if the same type is defined twice.\n * We currently don't validate that.\n */\n private _types: { length: number; flowGraphType: FlowGraphTypes; elementType: \"number\" | \"boolean\" | \"string\" | \"any\" }[] = [];\n private _mappings: { flowGraphMapping: IGLTFToFlowGraphMapping; fullOperationName: string; declaration: IKHRInteractivityDeclarationModel }[] = [];\n private _staticVariables: { type: FlowGraphTypes; value: any[] }[] = [];\n private _events: InteractivityEvent[] = [];\n private _internalEventsCounter: number = 0;\n private _nodes: { blocks: ISerializedFlowGraphBlock[]; fullOperationName: string }[] = [];\n /**\n * Extra blocks the parser inserts between existing nodes (e.g. the seconds→frames multiply for\n * connected animation-time inputs). Kept separate from any node's `blocks` array so per-node\n * post-processing that indexes into that array (such as the animation extraProcessors targeting\n * the last block) is not disturbed, then concatenated into the serialized graph.\n */\n private _insertedBlocks: ISerializedFlowGraphBlock[] = [];\n\n constructor(\n interactivityGraph: IKHRInteractivity_Graph,\n private _gltf: IGLTF,\n public _animationTargetFps: number = 60,\n private _graphIndex: number = 0,\n private _supportedExtensions?: ReadonlySet<string>,\n private _declarationModels?: readonly IKHRInteractivityDeclarationModel[],\n canonicalGraph?: IKHRInteractivity_Graph\n ) {\n this._canonicalGraph = CloneKHRInteractivityGraph(canonicalGraph ?? interactivityGraph);\n this._interactivityGraph = this._declarationModels\n ? CreateEffectiveKHRInteractivityGraph(interactivityGraph, this._declarationModels, this._gltf.nodes?.length ?? 0)\n : CloneKHRInteractivityGraph(interactivityGraph);\n // start with types\n this._parseTypes();\n // continue with declarations\n this._parseDeclarations();\n this._parseVariables();\n this._parseEvents();\n this._parseNodes();\n }\n\n private _interactivityGraph: IKHRInteractivity_Graph;\n private _canonicalGraph: IKHRInteractivity_Graph;\n\n private get _strictValidation(): boolean {\n return !!this._declarationModels;\n }\n\n private _getAllowedDynamicValueSockets(operation: string, node: IKHRInteractivity_Node, direction: \"input\" | \"output\"): ReadonlySet<string> | undefined {\n if ((operation === \"debug/log\" || operation === \"flow/log:BABYLON\") && direction === \"input\") {\n const message = node.configuration?.[operation === \"debug/log\" ? \"message\" : \"messageTemplate\"]?.value?.[0];\n return new Set(typeof message === \"string\" ? ParseDebugLogTemplate(message).sockets : []);\n }\n if ((operation === \"event/send\" && direction === \"input\") || (operation === \"event/receive\" && direction === \"output\")) {\n const eventIndex = node.configuration?.event?.value?.[0];\n if (typeof eventIndex === \"number\") {\n return new Set(Object.keys(this._interactivityGraph.events?.[eventIndex]?.values ?? {}));\n }\n }\n if (operation === \"variable/set\" && direction === \"input\") {\n return new Set((node.configuration?.variables?.value ?? []).map(String));\n }\n if (operation === \"math/switch\" && direction === \"input\") {\n return new Set((node.configuration?.cases?.value ?? []).map(String));\n }\n if ((operation === \"pointer/get\" || operation === \"pointer/set\" || operation === \"pointer/interpolate\") && direction === \"input\") {\n const pointer = node.configuration?.pointer?.value?.[0];\n if (typeof pointer === \"string\") {\n return new Set(\n pointer\n .split(\"/\")\n .filter((segment) => (segment.startsWith(\"[\") && !segment.startsWith(\"[[\")) || (segment.startsWith(\"{\") && !segment.startsWith(\"{{\")))\n .map((segment) =>\n segment\n .substring(1, segment.length - 1)\n .replace(/~1/g, \"/\")\n .replace(/~0/g, \"~\")\n )\n );\n }\n }\n return undefined;\n }\n\n private _getAllowedDynamicFlowSockets(node: IKHRInteractivity_Node, mapping: IGLTFToFlowGraphMapping, direction: \"input\" | \"output\"): ReadonlySet<string> | undefined {\n for (const [key, property] of Object.entries(mapping.configuration ?? {})) {\n const generatesSockets = direction === \"input\" ? property.generatesInputFlowSockets : property.generatesOutputFlowSockets;\n if (!generatesSockets) {\n continue;\n }\n const configuredValues = node.configuration?.[key]?.value;\n const validValues =\n configuredValues &&\n configuredValues.length > 0 &&\n (property.configurationType !== \"int\" || configuredValues.length === 1) &&\n configuredValues.every(\n (value) => typeof value === \"number\" && Number.isInteger(value) && value >= (property.minimum ?? -2147483648) && value <= (property.maximum ?? 2147483647)\n );\n const values = validValues ? configuredValues : property.defaultValue;\n if (direction === \"input\") {\n const count = Array.isArray(values) && typeof values[0] === \"number\" ? values[0] : 0;\n return new Set(Array.from({ length: count }, (_, index) => String(index)));\n }\n return new Set(Array.isArray(values) ? values.map(String) : []);\n }\n return undefined;\n }\n\n public get arrays() {\n return {\n types: this._types,\n mappings: this._mappings,\n staticVariables: this._staticVariables,\n events: this._events,\n nodes: this._nodes,\n };\n }\n\n private _parseTypes() {\n if (!this._interactivityGraph.types) {\n return;\n }\n for (const type of this._interactivityGraph.types) {\n this._types.push(gltfTypeToBabylonType[type.signature]);\n }\n }\n\n private _parseDeclarations() {\n if (!this._interactivityGraph.declarations) {\n return;\n }\n for (let index = 0; index < this._interactivityGraph.declarations.length; index++) {\n const declaration = this._interactivityGraph.declarations[index];\n const declarationModel = this._declarationModels?.[index];\n const extensionEnabled = !declaration.extension || !this._supportedExtensions || this._supportedExtensions.has(declaration.extension);\n const supportedMapping =\n declarationModel?.support === \"unsupported-extension\" ? undefined : extensionEnabled ? getMappingForDeclaration(declaration, false) : undefined;\n if (!supportedMapping && !declaration.extension) {\n throw new Error(`Unknown core KHR_interactivity operation \"${declaration.op}\".`);\n }\n const mapping = supportedMapping ?? (declaration.extension ? getNoOpMappingForDeclaration(declaration) : undefined);\n if (!mapping) {\n Logger.Error([\"No mapping found for declaration\", declaration]);\n throw new Error(\"Error parsing declarations\");\n }\n this._mappings.push({\n flowGraphMapping: mapping,\n fullOperationName: declaration.extension ? declaration.op + \":\" + declaration.extension : declaration.op,\n declaration:\n declarationModel ??\n ({\n index,\n operation: declaration.extension ? `${declaration.op}:${declaration.extension}` : declaration.op,\n support: supportedMapping ? (declaration.extension ? \"extension\" : \"core\") : \"unsupported-extension\",\n source: declaration,\n } satisfies IKHRInteractivityDeclarationModel),\n });\n }\n }\n\n private _parseVariables() {\n if (!this._interactivityGraph.variables) {\n return;\n }\n for (const variable of this._interactivityGraph.variables) {\n const parsed = this._parseVariable(variable);\n // set the default values here\n this._staticVariables.push(parsed);\n }\n }\n\n private _parseVariable(variable: IKHRInteractivity_Variable, dataTransform?: (value: any, parser: InteractivityGraphToFlowGraphParser) => any) {\n const type = this._types[variable.type];\n if (!type) {\n Logger.Error([\"No type found for variable\", variable]);\n throw new Error(\"Error parsing variables\");\n }\n if (variable.value) {\n if (this._interactivityGraph.types?.[variable.type]?.signature !== \"custom\" && variable.value.length !== type.length) {\n Logger.Error([\"Invalid value length for variable\", variable, type]);\n throw new Error(\"Error parsing variables\");\n }\n }\n const value = variable.value ? variable.value.slice() : [];\n if (!value.length) {\n switch (type.flowGraphType) {\n case FlowGraphTypes.Boolean:\n value.push(false);\n break;\n case FlowGraphTypes.Integer:\n value.push(0);\n break;\n case FlowGraphTypes.Number:\n value.push(NaN);\n break;\n case FlowGraphTypes.String:\n // Default for a `ref`-typed value is the null reference, encoded as the empty string.\n value.push(\"\" as any);\n break;\n case FlowGraphTypes.Vector2:\n value.push(NaN, NaN);\n break;\n case FlowGraphTypes.Vector3:\n value.push(NaN, NaN, NaN);\n break;\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Matrix2D:\n case FlowGraphTypes.Quaternion:\n value.push(NaN, NaN, NaN, NaN);\n break;\n case FlowGraphTypes.Matrix:\n for (let i = 0; i < 16; i++) {\n value.push(NaN);\n }\n break;\n case FlowGraphTypes.Matrix3D:\n for (let i = 0; i < 9; i++) {\n value.push(NaN);\n }\n break;\n default:\n break;\n }\n }\n // in case of NaN, Infinity, we need to parse the string to the object itself\n if (type.elementType === \"number\" && typeof value[0] === \"string\") {\n value[0] = parseFloat(value[0]);\n } else if (type.flowGraphType === FlowGraphTypes.String && typeof value[0] === \"string\") {\n value[0] = this._normalizeStaticReference(value[0]);\n }\n return { type: type.flowGraphType, value: dataTransform ? dataTransform(value, this) : value };\n }\n\n private _normalizeStaticReference(reference: string): string {\n if (!reference || reference.startsWith(EventReferencePrefix) || reference.startsWith(DelayReferencePrefix)) {\n return \"\";\n }\n if (!reference.startsWith(\"/\")) {\n return \"\";\n }\n let current: unknown = this._gltf;\n for (const rawSegment of reference.substring(1).split(\"/\")) {\n const segment = rawSegment.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n if (Array.isArray(current)) {\n if (!/^(0|[1-9]\\d*)$/.test(segment)) {\n return \"\";\n }\n current = current[parseInt(segment, 10)];\n } else if (current !== null && typeof current === \"object\" && Object.prototype.hasOwnProperty.call(current, segment)) {\n current = (current as Record<string, unknown>)[segment];\n } else {\n return \"\";\n }\n }\n return current !== null && typeof current === \"object\" ? reference : \"\";\n }\n\n private _parseEvents() {\n if (!this._interactivityGraph.events) {\n return;\n }\n const eventIds = new Set(this._interactivityGraph.events.flatMap((event) => (event.id === undefined ? [] : [event.id])));\n const internalPrefix = `__babylon_khr_internal_${this._graphIndex}_`;\n for (const event of this._interactivityGraph.events) {\n let generatedEventId: string | undefined;\n if (event.id === undefined) {\n do {\n generatedEventId = internalPrefix + this._internalEventsCounter++;\n } while (eventIds.has(generatedEventId));\n eventIds.add(generatedEventId);\n }\n const converted: InteractivityEvent = {\n eventId: event.id ?? generatedEventId!,\n };\n if (event.values) {\n converted.eventData = Object.keys(event.values).map((key) => {\n const eventValue = event.values?.[key];\n if (!eventValue) {\n Logger.Error([\"No value found for event key\", key]);\n throw new Error(\"Error parsing events\");\n }\n const type = this._types[eventValue.type];\n if (!type) {\n Logger.Error([\"No type found for event value\", eventValue]);\n throw new Error(\"Error parsing events\");\n }\n const value = typeof eventValue.value !== \"undefined\" ? this._parseVariable(eventValue) : undefined;\n return {\n id: key,\n type: type.flowGraphType,\n eventData: true,\n value,\n };\n });\n }\n this._events.push(converted);\n }\n }\n\n private _parseNodes() {\n if (!this._interactivityGraph.nodes) {\n return;\n }\n for (let nodeIndex = 0; nodeIndex < this._interactivityGraph.nodes.length; nodeIndex++) {\n const node = this._interactivityGraph.nodes[nodeIndex];\n // some validation\n if (typeof node.declaration !== \"number\") {\n Logger.Error([\"No declaration found for node\", node]);\n throw new Error(\"Error parsing nodes\");\n }\n const mapping = this._mappings[node.declaration];\n if (!mapping) {\n Logger.Error([\"No mapping found for node\", node]);\n throw new Error(\"Error parsing nodes\");\n }\n if (mapping.flowGraphMapping.validation) {\n const validationResult = mapping.flowGraphMapping.validation(node, this._interactivityGraph, this._gltf);\n if (!validationResult.valid) {\n throw new Error(`Error validating interactivity node ${this._interactivityGraph.declarations?.[node.declaration].op} - ${validationResult.error}`);\n }\n }\n const blocks: ISerializedFlowGraphBlock[] = [];\n if (mapping.declaration.support === \"unsupported-extension\") {\n blocks.push(this._createUnsupportedExtensionBlock(node, nodeIndex, mapping));\n }\n // create block(s) for this node using the mapping\n for (let role = 0; role < mapping.flowGraphMapping.blocks.length; role++) {\n const blockType = mapping.flowGraphMapping.blocks[role];\n const block = this._getEmptyBlock(blockType, mapping.fullOperationName, nodeIndex, node.declaration, role);\n this._parseNodeConfiguration(node, block, mapping.flowGraphMapping, blockType);\n blocks.push(block);\n }\n this._nodes.push({ blocks, fullOperationName: mapping.fullOperationName });\n }\n }\n\n private _createBlockProvenance(nodeIndex: number, declarationIndex: number, operation: string, role: number): IKHRInteractivityBlockProvenance {\n return {\n graphIndex: this._graphIndex,\n nodeIndex,\n declarationIndex,\n operation,\n role,\n sourcePath: `/extensions/KHR_interactivity/graphs/${this._graphIndex}/nodes/${nodeIndex}`,\n };\n }\n\n private _getEmptyBlock(className: string, type: string, nodeIndex?: number, declarationIndex?: number, role?: number): ISerializedFlowGraphBlock {\n return {\n uniqueId: RandomGUID(),\n className,\n dataInputs: [],\n dataOutputs: [],\n signalInputs: [],\n signalOutputs: [],\n config: {},\n type,\n metadata:\n nodeIndex === undefined\n ? {}\n : {\n khrInteractivity: this._createBlockProvenance(nodeIndex, declarationIndex!, type, role ?? 0),\n },\n };\n }\n\n private _setSocketProvenance(\n connection: ISerializedFlowGraphConnection,\n nodeIndex: number,\n declarationIndex: number,\n operation: string,\n role: number,\n kind: IKHRInteractivitySocketProvenance[\"kind\"],\n direction: IKHRInteractivitySocketProvenance[\"direction\"],\n socket: string\n ): void {\n connection.metadata = {\n ...(connection.metadata ?? {}),\n khrInteractivity: {\n ...this._createBlockProvenance(nodeIndex, declarationIndex, operation, role),\n kind,\n direction,\n socket,\n } satisfies IKHRInteractivitySocketProvenance,\n };\n }\n\n private _getBlockRole(blocks: readonly ISerializedFlowGraphBlock[], block: ISerializedFlowGraphBlock): number {\n return (block.metadata?.khrInteractivity as IKHRInteractivityBlockProvenance | undefined)?.role ?? blocks.indexOf(block);\n }\n\n private _createUnsupportedExtensionBlock(\n node: IKHRInteractivity_Node,\n nodeIndex: number,\n mapping: { flowGraphMapping: IGLTFToFlowGraphMapping; fullOperationName: string; declaration: IKHRInteractivityDeclarationModel }\n ): ISerializedFlowGraphBlock {\n const block = this._getEmptyBlock(\"KHR_interactivity/FlowGraphUnsupportedInteractivityBlock\", mapping.fullOperationName, nodeIndex, node.declaration, 0);\n const inputFlowSockets = new Set<string>();\n for (const sourceNode of this._interactivityGraph.nodes ?? []) {\n for (const flow of Object.values(sourceNode.flows ?? {})) {\n if (flow.node === nodeIndex) {\n inputFlowSockets.add(flow.socket ?? \"in\");\n }\n }\n }\n const toSockets = (sockets: typeof mapping.declaration.source.inputValueSockets) =>\n Object.entries(sockets ?? {}).map(([name, definition]) => ({\n name,\n type: this._types[definition.type]?.flowGraphType,\n signature: this._interactivityGraph.types?.[definition.type]?.signature,\n }));\n block.config = {\n operation: mapping.fullOperationName,\n inputValueSockets: toSockets(mapping.declaration.source.inputValueSockets),\n outputValueSockets: toSockets(mapping.declaration.source.outputValueSockets),\n inputFlowSockets: Array.from(inputFlowSockets).sort(),\n outputFlowSockets: Object.keys(node.flows ?? {}).sort(),\n };\n for (const socket of block.config.inputValueSockets) {\n const connection = this._createNewSocketConnection(socket.name);\n this._setSocketProvenance(connection, nodeIndex, node.declaration, mapping.fullOperationName, 0, \"value\", \"input\", socket.name);\n block.dataInputs.push(connection);\n }\n for (const socket of block.config.outputValueSockets) {\n const connection = this._createNewSocketConnection(socket.name, true);\n this._setSocketProvenance(connection, nodeIndex, node.declaration, mapping.fullOperationName, 0, \"value\", \"output\", socket.name);\n block.dataOutputs.push(connection);\n }\n for (const socket of block.config.inputFlowSockets) {\n const connection = this._createNewSocketConnection(socket);\n this._setSocketProvenance(connection, nodeIndex, node.declaration, mapping.fullOperationName, 0, \"flow\", \"input\", socket);\n block.signalInputs.push(connection);\n }\n for (const socket of block.config.outputFlowSockets) {\n const connection = this._createNewSocketConnection(socket, true);\n this._setSocketProvenance(connection, nodeIndex, node.declaration, mapping.fullOperationName, 0, \"flow\", \"output\", socket);\n block.signalOutputs.push(connection);\n }\n return block;\n }\n\n private _parseNodeConfiguration(node: IKHRInteractivity_Node, block: ISerializedFlowGraphBlock, nodeMapping: IGLTFToFlowGraphMapping, blockType: FlowGraphBlockNames | string) {\n const gltfConfiguration = node.configuration;\n if (gltfConfiguration) {\n for (const key in gltfConfiguration) {\n const gltfProperty = gltfConfiguration[key];\n if (!gltfProperty) {\n throw new Error(\"Error parsing node configuration\");\n }\n\n const propertyMapping = nodeMapping.configuration?.[key];\n if (!propertyMapping && this._strictValidation) {\n continue;\n }\n if (propertyMapping?.validationOnly) {\n continue;\n }\n const belongsToBlock = propertyMapping && propertyMapping.toBlock ? propertyMapping.toBlock === blockType : nodeMapping.blocks.indexOf(blockType) === 0;\n if (belongsToBlock) {\n let value = propertyMapping?.defaultValue;\n if (gltfProperty?.value) {\n value = gltfProperty.value;\n }\n\n if (!propertyMapping?.isArray) {\n if (value.length !== 1) {\n Logger.Warn(`Invalid non-array value length: ${value.length}`);\n }\n\n value = value[0];\n }\n\n if (propertyMapping?.dataTransformer) {\n value = propertyMapping.dataTransformer(value, this);\n }\n\n if (value !== undefined) {\n // Update the flow graph block config.\n block.config[propertyMapping?.name || key] = {\n value: value,\n };\n }\n }\n }\n }\n }\n\n private _parseNodeConnections(context: ISerializedFlowGraphContext) {\n for (let i = 0; i < this._nodes.length; i++) {\n // get the corresponding gltf node\n const gltfNode = this._interactivityGraph.nodes?.[i];\n if (!gltfNode) {\n // should never happen but let's still check\n Logger.Error([\"No node found for interactivity node\", this._nodes[i]]);\n throw new Error(\"Error parsing node connections\");\n }\n const flowGraphBlocks = this._nodes[i];\n const outputMapper = this._mappings[gltfNode.declaration];\n // validate\n if (!outputMapper) {\n Logger.Error([\"No mapping found for node\", gltfNode]);\n throw new Error(\"Error parsing node connections\");\n }\n // KHR_interactivity spec section 3.2.4 \"Unsupported Operations\":\n // nodes referring to unsupported operations are demoted to no-ops.\n // Activations of their input flow sockets are ignored, their output\n // flow sockets are never activated, and their output value sockets\n // return constant type-default values. They have no backing\n // FlowGraph blocks (blocks.length === 0), so there is nothing to\n // wire for this node — skip all of its connections.\n if (flowGraphBlocks.blocks.length === 0) {\n Logger.Warn(`Skipping connections for no-op node #${i} (unsupported operation: ${flowGraphBlocks.fullOperationName})`);\n continue;\n }\n const flowsFromGLTF = gltfNode.flows || {};\n const flowsKeys = Object.keys(flowsFromGLTF).sort(); // sorting as some operations require sorted keys\n // connect the flows\n for (const flowKey of flowsKeys) {\n const flow = flowsFromGLTF[flowKey];\n let flowMapping = _GetOwnMapping(outputMapper.flowGraphMapping.outputs?.flows, flowKey);\n if (this._strictValidation && flowMapping?.compatibilityOnly) {\n flowMapping = undefined;\n }\n let outputArrayMapping = false;\n if (!flowMapping) {\n for (const key in outputMapper.flowGraphMapping.outputs?.flows) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n const wildcardMapping = outputMapper.flowGraphMapping.outputs?.flows?.[key];\n if (!this._strictValidation || !wildcardMapping?.compatibilityOnly) {\n outputArrayMapping = true;\n flowMapping = wildcardMapping;\n break;\n }\n }\n }\n }\n const allowedDynamicOutputs = outputArrayMapping ? this._getAllowedDynamicFlowSockets(gltfNode, outputMapper.flowGraphMapping, \"output\") : undefined;\n if (this._strictValidation && allowedDynamicOutputs && !allowedDynamicOutputs.has(flowKey)) {\n flowMapping = undefined;\n }\n if (!flowMapping && !this._isUnsupportedExtensionBlock(flowGraphBlocks.blocks[0])) {\n continue;\n }\n const socketOutName = flowMapping ? (outputArrayMapping ? flowMapping.name.replace(\"$1\", flowKey) : flowMapping.name) : flowKey;\n // get the input node of this block\n const inputNodeId = flow.node;\n const nodeIn = this._nodes[inputNodeId];\n if (!nodeIn) {\n Logger.Error([\"No node found for input node id\", inputNodeId]);\n throw new Error(\"Error parsing node connections\");\n }\n // Spec 3.2.4: input flow activations on no-op nodes are ignored,\n // so a flow connection into a no-op target is itself a no-op.\n // Drop it instead of crashing on the missing target block.\n if (nodeIn.blocks.length === 0) {\n Logger.Warn(`Dropping flow connection from node #${i} \"${flowKey}\" to no-op node #${inputNodeId} (unsupported operation: ${nodeIn.fullOperationName})`);\n continue;\n }\n // create a serialized socket\n const block = (flowMapping && flowMapping.toBlock && flowGraphBlocks.blocks.find((b) => b.className === flowMapping.toBlock)) || flowGraphBlocks.blocks[0];\n const socketOut = block.signalOutputs.find((socket) => socket.name === socketOutName) ?? this._createNewSocketConnection(socketOutName, true);\n if (!block.signalOutputs.includes(socketOut)) {\n block.signalOutputs.push(socketOut);\n }\n this._setSocketProvenance(\n socketOut,\n i,\n gltfNode.declaration,\n flowGraphBlocks.fullOperationName,\n this._getBlockRole(flowGraphBlocks.blocks, block),\n \"flow\",\n \"output\",\n flowKey\n );\n // get the mapper for the input node - in case it mapped to multiple blocks\n const inputMapper = this._mappings[this._interactivityGraph.nodes![inputNodeId].declaration]?.flowGraphMapping;\n if (!inputMapper) {\n Logger.Error([\"No mapping found for input node\", nodeIn]);\n throw new Error(\"Error parsing node connections\");\n }\n let flowInMapping = _GetOwnMapping(inputMapper.inputs?.flows, flow.socket || \"in\");\n if (this._strictValidation && flowInMapping?.compatibilityOnly) {\n flowInMapping = undefined;\n }\n let arrayMapping = false;\n if (!flowInMapping) {\n for (const key in inputMapper.inputs?.flows) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n const wildcardMapping = inputMapper.inputs?.flows?.[key];\n if (!this._strictValidation || !wildcardMapping?.compatibilityOnly) {\n arrayMapping = true;\n flowInMapping = wildcardMapping;\n }\n }\n }\n const allowedDynamicInputs = arrayMapping ? this._getAllowedDynamicFlowSockets(this._interactivityGraph.nodes![inputNodeId], inputMapper, \"input\") : undefined;\n if (this._strictValidation && allowedDynamicInputs && !allowedDynamicInputs.has(flow.socket ?? \"in\")) {\n flowInMapping = undefined;\n }\n if (!flowInMapping && (flow.socket ?? \"in\") === \"in\" && HasDefaultInteractivityFlowInput(nodeIn.fullOperationName)) {\n flowInMapping = { name: \"in\" };\n }\n if (!flowInMapping && !this._isUnsupportedExtensionBlock(nodeIn.blocks[0])) {\n continue;\n }\n }\n const nodeInSocketName = flowInMapping ? (arrayMapping ? flowInMapping.name.replace(\"$1\", flow.socket || \"\") : flowInMapping.name) : flow.socket || \"in\";\n const inputBlock = (flowInMapping && flowInMapping.toBlock && nodeIn.blocks.find((b) => b.className === flowInMapping.toBlock)) || nodeIn.blocks[0];\n // in all of the flow graph input connections, find the one with the same name as the socket\n let socketIn = inputBlock.signalInputs.find((s) => s.name === nodeInSocketName);\n // if the socket doesn't exist, create the input socket for the connection\n if (!socketIn) {\n socketIn = this._createNewSocketConnection(nodeInSocketName);\n inputBlock.signalInputs.push(socketIn);\n }\n this._setSocketProvenance(\n socketIn,\n inputNodeId,\n this._interactivityGraph.nodes![inputNodeId].declaration,\n nodeIn.fullOperationName,\n this._getBlockRole(nodeIn.blocks, inputBlock),\n \"flow\",\n \"input\",\n flow.socket ?? \"in\"\n );\n // connect the sockets\n socketIn.connectedPointIds.push(socketOut.uniqueId);\n socketOut.connectedPointIds.push(socketIn.uniqueId);\n }\n // connect the values\n const valuesFromGLTF = gltfNode.values || {};\n const valuesKeys = Object.keys(valuesFromGLTF);\n for (const valueKey of valuesKeys) {\n const value = valuesFromGLTF[valueKey];\n let valueMapping = _GetOwnMapping(outputMapper.flowGraphMapping.inputs?.values, valueKey);\n if (this._strictValidation && valueMapping?.compatibilityOnly) {\n valueMapping = undefined;\n }\n let arrayMapping = false;\n if (!valueMapping) {\n for (const key in outputMapper.flowGraphMapping.inputs?.values) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n const wildcardMapping = outputMapper.flowGraphMapping.inputs?.values?.[key];\n if (!this._strictValidation || !wildcardMapping?.compatibilityOnly) {\n arrayMapping = true;\n valueMapping = wildcardMapping;\n }\n }\n }\n }\n const allowedDynamicInputs = arrayMapping ? this._getAllowedDynamicValueSockets(outputMapper.fullOperationName, gltfNode, \"input\") : undefined;\n if (!valueMapping || (allowedDynamicInputs && !allowedDynamicInputs.has(valueKey))) {\n continue;\n }\n const socketInName = valueMapping ? (arrayMapping ? valueMapping.name.replace(\"$1\", valueKey) : valueMapping.name) : valueKey;\n // create a serialized socket\n const block = (valueMapping && valueMapping.toBlock && flowGraphBlocks.blocks.find((b) => b.className === valueMapping.toBlock)) || flowGraphBlocks.blocks[0];\n const socketIn = block.dataInputs.find((socket) => socket.name === socketInName) ?? this._createNewSocketConnection(socketInName);\n if (!block.dataInputs.includes(socketIn)) {\n block.dataInputs.push(socketIn);\n }\n this._setSocketProvenance(\n socketIn,\n i,\n gltfNode.declaration,\n flowGraphBlocks.fullOperationName,\n this._getBlockRole(flowGraphBlocks.blocks, block),\n \"value\",\n \"input\",\n valueKey\n );\n const socketProvenance = socketIn.metadata!.khrInteractivity as IKHRInteractivitySocketProvenance;\n socketProvenance.sourceValue = _CloneMetadataValue(this._canonicalGraph.nodes?.[i]?.values?.[valueKey] ?? value);\n // Captured before the connected branch below shadows `valueMapping`. When set and the\n // value is supplied by a connection, the seconds→frames `dataTransformer` cannot run\n // (it is parse-time only), so the raw connected value is scaled by a runtime multiply.\n const convertConnectedTimeToFrames = !!valueMapping?.convertConnectedTimeToFrames;\n if ((value as IKHRInteractivity_Variable).value !== undefined) {\n const convertedValue = this._parseVariable(value as IKHRInteractivity_Variable, valueMapping && valueMapping.dataTransformer);\n context._connectionValues[socketIn.uniqueId] = convertedValue;\n socketIn.defaultValue = convertedValue;\n socketProvenance.runtimeValue = _CloneMetadataValue(convertedValue.value);\n } else if (typeof (value as IKHRInteractivity_OutputSocketReference).node !== \"undefined\") {\n const nodeOutId = (value as IKHRInteractivity_OutputSocketReference).node;\n const nodeOutSocketName = (value as IKHRInteractivity_OutputSocketReference).socket || \"value\";\n const nodeOut = this._nodes[nodeOutId];\n if (!nodeOut) {\n Logger.Error([\"No node found for output socket reference\", value]);\n throw new Error(\"Error parsing node connections\");\n }\n // Spec 3.2.4: output value sockets of no-op nodes return\n // constant type-default values. Leave the consumer's\n // dataInput unconnected (no connectedPointIds) so the\n // FlowGraph runtime falls back to the RichType default.\n if (nodeOut.blocks.length === 0) {\n Logger.Warn(\n `Dropping value connection from no-op node #${nodeOutId} (unsupported operation: ${nodeOut.fullOperationName}) into node #${i} \"${valueKey}\"; consumer will use type-default value`\n );\n continue;\n }\n const outputMapper = this._mappings[this._interactivityGraph.nodes![nodeOutId].declaration]?.flowGraphMapping;\n if (!outputMapper) {\n Logger.Error([\"No mapping found for output socket reference\", value]);\n throw new Error(\"Error parsing node connections\");\n }\n let valueMapping = _GetOwnMapping(outputMapper.outputs?.values, nodeOutSocketName);\n if (this._strictValidation && valueMapping?.compatibilityOnly) {\n valueMapping = undefined;\n }\n let arrayMapping = false;\n // check if there is an array mapping defined\n if (!valueMapping) {\n // search for a value mapping that has an array mapping\n for (const key in outputMapper.outputs?.values) {\n if (key.startsWith(\"[\") && key.endsWith(\"]\")) {\n const wildcardMapping = outputMapper.outputs?.values?.[key];\n if (!this._strictValidation || !wildcardMapping?.compatibilityOnly) {\n arrayMapping = true;\n valueMapping = wildcardMapping;\n }\n }\n }\n const allowedDynamicOutputs = arrayMapping\n ? this._getAllowedDynamicValueSockets(nodeOut.fullOperationName, this._interactivityGraph.nodes![nodeOutId], \"output\")\n : undefined;\n if (!valueMapping || (allowedDynamicOutputs && !allowedDynamicOutputs.has(nodeOutSocketName))) {\n continue;\n }\n }\n const socketOutName = valueMapping ? (arrayMapping ? valueMapping.name.replace(\"$1\", nodeOutSocketName) : valueMapping?.name) : nodeOutSocketName;\n const outBlock = (valueMapping && valueMapping.toBlock && nodeOut.blocks.find((b) => b.className === valueMapping.toBlock)) || nodeOut.blocks[0];\n let socketOut = outBlock.dataOutputs.find((s) => s.name === socketOutName);\n // if the socket doesn't exist, create it\n if (!socketOut) {\n socketOut = this._createNewSocketConnection(socketOutName, true);\n outBlock.dataOutputs.push(socketOut);\n }\n this._setSocketProvenance(\n socketOut,\n nodeOutId,\n this._interactivityGraph.nodes![nodeOutId].declaration,\n nodeOut.fullOperationName,\n this._getBlockRole(nodeOut.blocks, outBlock),\n \"value\",\n \"output\",\n nodeOutSocketName\n );\n // connect the sockets\n if (convertConnectedTimeToFrames) {\n this._connectWithSecondsToFramesConversion(context, socketOut, socketIn, i, gltfNode.declaration, flowGraphBlocks.fullOperationName);\n } else {\n socketIn.connectedPointIds.push(socketOut.uniqueId);\n socketOut.connectedPointIds.push(socketIn.uniqueId);\n }\n } else {\n Logger.Error([\"Invalid value for value connection\", value]);\n throw new Error(\"Error parsing node connections\");\n }\n }\n\n // inter block connections\n if (outputMapper.flowGraphMapping.interBlockConnectors) {\n for (const connector of outputMapper.flowGraphMapping.interBlockConnectors) {\n const input = connector.input;\n const output = connector.output;\n const isVariable = connector.isVariable;\n this._connectFlowGraphNodes(input, output, flowGraphBlocks.blocks[connector.inputBlockIndex], flowGraphBlocks.blocks[connector.outputBlockIndex], isVariable);\n }\n }\n\n if (outputMapper.flowGraphMapping.extraProcessor) {\n const declaration = this._interactivityGraph.declarations?.[gltfNode.declaration];\n if (!declaration) {\n Logger.Error([\"No declaration found for extra processor\", gltfNode]);\n throw new Error(\"Error parsing node connections\");\n }\n flowGraphBlocks.blocks = outputMapper.flowGraphMapping.extraProcessor(\n gltfNode,\n declaration,\n outputMapper.flowGraphMapping,\n this,\n flowGraphBlocks.blocks,\n context,\n this._gltf\n );\n }\n this._ensureMappedSocketProvenance(i, gltfNode, flowGraphBlocks.blocks, outputMapper);\n }\n }\n\n private _ensureMappedSocketProvenance(\n nodeIndex: number,\n node: IKHRInteractivity_Node,\n blocks: ISerializedFlowGraphBlock[],\n mapping: { flowGraphMapping: IGLTFToFlowGraphMapping; fullOperationName: string }\n ): void {\n const ensureConnections = (\n socketMappings: Record<string, IGLTFToFlowGraphMappingObject> | undefined,\n kind: IKHRInteractivitySocketProvenance[\"kind\"],\n direction: IKHRInteractivitySocketProvenance[\"direction\"]\n ): void => {\n for (const [sourceName, property] of Object.entries(socketMappings ?? {})) {\n if ((sourceName.startsWith(\"[\") && sourceName.endsWith(\"]\")) || (this._strictValidation && property.compatibilityOnly)) {\n continue;\n }\n const block = (property.toBlock && blocks.find((candidate) => candidate.className === property.toBlock)) || blocks[0];\n if (!block) {\n continue;\n }\n const connections =\n kind === \"value\" ? (direction === \"input\" ? block.dataInputs : block.dataOutputs) : direction === \"input\" ? block.signalInputs : block.signalOutputs;\n let connection = connections.find((candidate) => candidate.name === property.name);\n if (!connection) {\n connection = this._createNewSocketConnection(property.name, direction === \"output\");\n connections.push(connection);\n }\n this._setSocketProvenance(connection, nodeIndex, node.declaration, mapping.fullOperationName, this._getBlockRole(blocks, block), kind, direction, sourceName);\n }\n };\n\n ensureConnections(mapping.flowGraphMapping.outputs?.values, \"value\", \"output\");\n ensureConnections(mapping.flowGraphMapping.inputs?.flows, \"flow\", \"input\");\n ensureConnections(mapping.flowGraphMapping.outputs?.flows, \"flow\", \"output\");\n if (HasDefaultInteractivityFlowInput(mapping.fullOperationName)) {\n const block = blocks[0];\n if (block) {\n let connection = block.signalInputs.find((candidate) => candidate.name === \"in\");\n if (!connection) {\n connection = this._createNewSocketConnection(\"in\");\n block.signalInputs.push(connection);\n }\n this._setSocketProvenance(connection, nodeIndex, node.declaration, mapping.fullOperationName, this._getBlockRole(blocks, block), \"flow\", \"input\", \"in\");\n }\n }\n for (const [sourceKey, property] of Object.entries(mapping.flowGraphMapping.configuration ?? {})) {\n const block = (property.toBlock && blocks.find((candidate) => candidate.className === property.toBlock)) || blocks[0];\n const provenance = block?.metadata?.khrInteractivity as IKHRInteractivityBlockProvenance | undefined;\n if (!block || !provenance) {\n continue;\n }\n const serializedRuntimeValue = block.config?.[property.name];\n const runtimeValue =\n serializedRuntimeValue !== null && typeof serializedRuntimeValue === \"object\" && Object.prototype.hasOwnProperty.call(serializedRuntimeValue, \"value\")\n ? serializedRuntimeValue.value\n : serializedRuntimeValue;\n provenance.configuration ||= {};\n const configurationProvenance: IKHRInteractivityConfigurationProvenance = {\n sourceValue: _CloneMetadataValue(this._canonicalGraph.nodes?.[nodeIndex]?.configuration?.[sourceKey]?.value),\n runtimeValue: _CloneMetadataValue(runtimeValue),\n };\n Object.defineProperty(provenance.configuration, sourceKey, {\n configurable: true,\n enumerable: true,\n value: configurationProvenance,\n writable: true,\n });\n }\n for (const block of blocks) {\n const provenance = block.metadata?.khrInteractivity as IKHRInteractivityBlockProvenance | undefined;\n if (!provenance) {\n continue;\n }\n const mappedConfigurationNames = new Set(\n Object.values(mapping.flowGraphMapping.configuration ?? {})\n .filter((property) => (property.toBlock ? block.className === property.toBlock : provenance.role === 0))\n .map((property) => property.name)\n );\n const ignoredConfigurationNames = new Set([\"glTF\"]);\n for (const [key, value] of Object.entries(block.config ?? {})) {\n if (mappedConfigurationNames.has(key) || ignoredConfigurationNames.has(key)) {\n continue;\n }\n const normalizedValue =\n key === \"eventData\"\n ? NormalizeInteractivityEventDataConfiguration(value)\n : value !== null && typeof value === \"object\" && Object.prototype.hasOwnProperty.call(value, \"value\")\n ? (value as { value: unknown }).value\n : value;\n if (!_IsSerializableConfigurationValue(normalizedValue)) {\n continue;\n }\n provenance.generatedConfiguration ||= {};\n Object.defineProperty(provenance.generatedConfiguration, key, {\n configurable: true,\n enumerable: true,\n value: _CloneMetadataValue(normalizedValue),\n writable: true,\n });\n }\n }\n }\n\n private _createNewSocketConnection(name: string, isOutput?: boolean): ISerializedFlowGraphConnection {\n return {\n uniqueId: RandomGUID(),\n name,\n _connectionType: isOutput ? FlowGraphConnectionType.Output : FlowGraphConnectionType.Input,\n connectedPointIds: [],\n };\n }\n\n private _isUnsupportedExtensionBlock(block: ISerializedFlowGraphBlock | undefined): boolean {\n return block?.className === \"KHR_interactivity/FlowGraphUnsupportedInteractivityBlock\";\n }\n\n /**\n * Wires an upstream data output into a downstream data input through a runtime multiply block that\n * scales the value by the animation target fps. This converts a KHR animation time (seconds),\n * delivered by a connection (e.g. a `pointer/get` on the `maxTime` animation pointer), into the\n * Babylon animation frames expected by the play/stop-animation blocks. Literal times are already\n * converted at parse time by the input's `dataTransformer`, so this is only used for connections.\n * @param context the serialized flow graph context that stores literal socket values\n * @param upstreamOutput the data output socket providing the time value (in seconds)\n * @param downstreamInput the data input socket that expects the time in frames\n * @param nodeIndex source node receiving the converted value\n * @param declarationIndex source declaration used by the receiving node\n * @param operation owning KHR operation\n */\n private _connectWithSecondsToFramesConversion(\n context: ISerializedFlowGraphContext,\n upstreamOutput: ISerializedFlowGraphConnection,\n downstreamInput: ISerializedFlowGraphConnection,\n nodeIndex: number,\n declarationIndex: number,\n operation: string\n ): void {\n const multiplyBlock = this._getEmptyBlock(FlowGraphBlockNames.Multiply, operation, nodeIndex, declarationIndex, -1);\n // Scalar (float) multiply; matches how the `math/mul` mapping configures the block.\n multiplyBlock.config = { type: FlowGraphTypes.Number };\n const inputA = this._createNewSocketConnection(\"a\");\n const inputB = this._createNewSocketConnection(\"b\");\n const output = this._createNewSocketConnection(\"value\", true);\n multiplyBlock.dataInputs.push(inputA, inputB);\n multiplyBlock.dataOutputs.push(output);\n // The second factor is the constant animation target fps.\n const frameRateValue = { type: FlowGraphTypes.Number, value: [this._animationTargetFps] };\n context._connectionValues[inputB.uniqueId] = frameRateValue;\n inputB.defaultValue = frameRateValue;\n // upstream time output -> multiply.a\n inputA.connectedPointIds.push(upstreamOutput.uniqueId);\n upstreamOutput.connectedPointIds.push(inputA.uniqueId);\n // multiply.value (frames) -> downstream time input\n downstreamInput.connectedPointIds.push(output.uniqueId);\n output.connectedPointIds.push(downstreamInput.uniqueId);\n // Register the inserted block separately so serializeToFlowGraph picks it up without\n // appending to any node's block list (which would break per-node extraProcessors).\n this._insertedBlocks.push(multiplyBlock);\n }\n\n private _connectFlowGraphNodes(input: string, output: string, serializedInput: ISerializedFlowGraphBlock, serializedOutput: ISerializedFlowGraphBlock, isVariable?: boolean) {\n const inputArray = isVariable ? serializedInput.dataInputs : serializedInput.signalInputs;\n const outputArray = isVariable ? serializedOutput.dataOutputs : serializedOutput.signalOutputs;\n const inputConnection = inputArray.find((s) => s.name === input) || this._createNewSocketConnection(input);\n const outputConnection = outputArray.find((s) => s.name === output) || this._createNewSocketConnection(output, true);\n // of not found add it to the array\n if (!inputArray.find((s) => s.name === input)) {\n inputArray.push(inputConnection);\n }\n if (!outputArray.find((s) => s.name === output)) {\n outputArray.push(outputConnection);\n }\n // connect the sockets\n inputConnection.connectedPointIds.push(outputConnection.uniqueId);\n outputConnection.connectedPointIds.push(inputConnection.uniqueId);\n }\n\n /**\n * Returns the deterministic FlowGraph user-variable name used for the\n * static variable at the given declaration index.\n * @param index zero-based index into the interactivity graph's `variables` array.\n * @returns the FlowGraph variable name (e.g. `staticVariable_3`).\n */\n public getVariableName(index: number) {\n return \"staticVariable_\" + index;\n }\n\n /**\n * Serializes the parsed interactivity graph into the {@link ISerializedFlowGraph}\n * payload consumed by `ParseFlowGraphAsync`. Performs node-connection wiring\n * and seeds the execution context with the graph's static variables.\n * @returns the serialized FlowGraph for the parsed KHR_interactivity graph.\n */\n public serializeToFlowGraph(): ISerializedFlowGraph {\n const context: ISerializedFlowGraphContext = {\n uniqueId: RandomGUID(),\n _userVariables: {},\n _connectionValues: {},\n };\n this._parseNodeConnections(context);\n for (let i = 0; i < this._staticVariables.length; i++) {\n const variable = this._staticVariables[i];\n context._userVariables[this.getVariableName(i)] = variable;\n }\n\n const allBlocks = this._nodes.reduce((acc, val) => acc.concat(val.blocks), [] as ISerializedFlowGraphBlock[]).concat(this._insertedBlocks);\n\n return {\n name: this._interactivityGraph.name ?? `Graph ${this._graphIndex + 1}`,\n metadata: {\n khrInteractivity: {\n graphIndex: this._graphIndex,\n specificationCommit: KHR_INTERACTIVITY_SPECIFICATION_COMMIT,\n source: CloneKHRInteractivityGraph(this._canonicalGraph),\n } satisfies IKHRInteractivityGraphProvenance,\n },\n rightHanded: true,\n allBlocks,\n executionContexts: [context],\n };\n }\n}\n"]}
@@ -18,9 +18,10 @@ export declare class InteractivityHostResolver implements IFlowGraphHostResolver
18
18
  decodeEventReference(reference: string): string | undefined;
19
19
  /**
20
20
  * @param reference the reference to decode
21
+ * @param collection optional glTF root collection the reference must address
21
22
  * @returns the index the reference denotes, or `undefined` when it is not an indexed JSON Pointer
22
23
  */
23
- decodeIndexReference(reference: string): number | undefined;
24
+ decodeIndexReference(reference: string, collection?: string): number | undefined;
24
25
  /**
25
26
  * Maps a Babylon object loaded from the glTF back to a JSON Pointer addressing it.
26
27
  *
@@ -22,13 +22,18 @@ export class InteractivityHostResolver {
22
22
  }
23
23
  /**
24
24
  * @param reference the reference to decode
25
+ * @param collection optional glTF root collection the reference must address
25
26
  * @returns the index the reference denotes, or `undefined` when it is not an indexed JSON Pointer
26
27
  */
27
- decodeIndexReference(reference) {
28
+ decodeIndexReference(reference, collection) {
28
29
  if (reference.length === 0 || reference[0] !== "/") {
29
30
  return undefined;
30
31
  }
31
- const tail = reference.substring(reference.lastIndexOf("/") + 1);
32
+ const prefix = collection ? `/${collection}/` : "/";
33
+ if (!reference.startsWith(prefix)) {
34
+ return undefined;
35
+ }
36
+ const tail = collection ? reference.substring(prefix.length) : reference.substring(reference.lastIndexOf("/") + 1);
32
37
  // RFC 6901 array indices are unsigned decimal integers with no leading zeros, so reject
33
38
  // anything else rather than letting `Number` accept "0x2", "1e1" or " 3".
34
39
  if (!/^(0|[1-9]\d*)$/.test(tail)) {
@@ -1 +1 @@
1
- {"version":3,"file":"interactivityHostResolver.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEpF;;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I,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;YAC/E,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QACD,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { type IFlowGraphHostResolver } from \"core/FlowGraph/flowGraphHostResolver\";\r\nimport { GetEventReference, GetEventReferenceKey } from \"./interactivityReferences\";\r\n\r\n/**\r\n * Supplies the KHR_interactivity representation of opaque `ref` values to the FlowGraph engine.\r\n *\r\n * The engine itself has no notion of the glTF object model: it asks this resolver how to represent\r\n * event sources and runtime objects as references, and how to read one back.\r\n */\r\nexport class InteractivityHostResolver implements IFlowGraphHostResolver {\r\n /**\r\n * @param key the FlowGraph event source key\r\n * @returns the KHR_interactivity event reference\r\n */\r\n public encodeEventReference(key: string): string {\r\n return GetEventReference(key);\r\n }\r\n\r\n /**\r\n * @param reference the value to decode\r\n * @returns the FlowGraph event source key, or `undefined` when the value is not an event reference\r\n */\r\n public decodeEventReference(reference: string): string | undefined {\r\n return GetEventReferenceKey(reference);\r\n }\r\n\r\n /**\r\n * @param reference the reference to decode\r\n * @returns the index the reference denotes, or `undefined` when it is not an indexed JSON Pointer\r\n */\r\n public decodeIndexReference(reference: string): number | undefined {\r\n if (reference.length === 0 || reference[0] !== \"/\") {\r\n return undefined;\r\n }\r\n const tail = reference.substring(reference.lastIndexOf(\"/\") + 1);\r\n // RFC 6901 array indices are unsigned decimal integers with no leading zeros, so reject\r\n // anything else rather than letting `Number` accept \"0x2\", \"1e1\" or \" 3\".\r\n if (!/^(0|[1-9]\\d*)$/.test(tail)) {\r\n return undefined;\r\n }\r\n return parseInt(tail, 10);\r\n }\r\n\r\n /**\r\n * Maps a Babylon object loaded from the glTF back to a JSON Pointer addressing it.\r\n *\r\n * The glTF loader stamps `_internalMetadata.gltf.pointers` with one entry per JSON Pointer the\r\n * object can be addressed by; a single-primitive mesh, for example, holds both `/nodes/<i>` and\r\n * `/meshes/<j>/primitives/<k>`. The hint is the path segment preceding the template parameter\r\n * being resolved, so a template like `/nodes/{nodeRef}/globalMatrix` picks the `/nodes/<i>`\r\n * pointer even when another pointer was added to the object first.\r\n * @param object the Babylon object to address\r\n * @param hint the expected root segment of the pointer, when known\r\n * @returns the JSON Pointer for the object, or `undefined` when it is not addressable\r\n */\r\n public getObjectReference(object: object, hint?: string): string | undefined {\r\n const pointers = (object as { _internalMetadata?: { gltf?: { pointers?: unknown } } })._internalMetadata?.gltf?.pointers;\r\n if (!Array.isArray(pointers)) {\r\n return undefined;\r\n }\r\n const stringPointers = pointers.filter((pointer: unknown): pointer is string => typeof pointer === \"string\");\r\n if (stringPointers.length === 0) {\r\n return undefined;\r\n }\r\n if (hint) {\r\n const match = stringPointers.find((pointer) => pointer.split(\"/\")[1] === hint);\r\n if (match) {\r\n return match;\r\n }\r\n }\r\n return stringPointers[0];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"interactivityHostResolver.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEpF;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IAClC;;;OAGG;IACI,oBAAoB,CAAC,GAAW;QACnC,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,SAAiB;QACzC,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACI,oBAAoB,CAAC,SAAiB,EAAE,UAAmB;QAC9D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAA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GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;YAC/E,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QACD,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { type IFlowGraphHostResolver } from \"core/FlowGraph/flowGraphHostResolver\";\r\nimport { GetEventReference, GetEventReferenceKey } from \"./interactivityReferences\";\r\n\r\n/**\r\n * Supplies the KHR_interactivity representation of opaque `ref` values to the FlowGraph engine.\r\n *\r\n * The engine itself has no notion of the glTF object model: it asks this resolver how to represent\r\n * event sources and runtime objects as references, and how to read one back.\r\n */\r\nexport class InteractivityHostResolver implements IFlowGraphHostResolver {\r\n /**\r\n * @param key the FlowGraph event source key\r\n * @returns the KHR_interactivity event reference\r\n */\r\n public encodeEventReference(key: string): string {\r\n return GetEventReference(key);\r\n }\r\n\r\n /**\r\n * @param reference the value to decode\r\n * @returns the FlowGraph event source key, or `undefined` when the value is not an event reference\r\n */\r\n public decodeEventReference(reference: string): string | undefined {\r\n return GetEventReferenceKey(reference);\r\n }\r\n\r\n /**\r\n * @param reference the reference to decode\r\n * @param collection optional glTF root collection the reference must address\r\n * @returns the index the reference denotes, or `undefined` when it is not an indexed JSON Pointer\r\n */\r\n public decodeIndexReference(reference: string, collection?: string): number | undefined {\r\n if (reference.length === 0 || reference[0] !== \"/\") {\r\n return undefined;\r\n }\r\n const prefix = collection ? `/${collection}/` : \"/\";\r\n if (!reference.startsWith(prefix)) {\r\n return undefined;\r\n }\r\n const tail = collection ? reference.substring(prefix.length) : reference.substring(reference.lastIndexOf(\"/\") + 1);\r\n // RFC 6901 array indices are unsigned decimal integers with no leading zeros, so reject\r\n // anything else rather than letting `Number` accept \"0x2\", \"1e1\" or \" 3\".\r\n if (!/^(0|[1-9]\\d*)$/.test(tail)) {\r\n return undefined;\r\n }\r\n return parseInt(tail, 10);\r\n }\r\n\r\n /**\r\n * Maps a Babylon object loaded from the glTF back to a JSON Pointer addressing it.\r\n *\r\n * The glTF loader stamps `_internalMetadata.gltf.pointers` with one entry per JSON Pointer the\r\n * object can be addressed by; a single-primitive mesh, for example, holds both `/nodes/<i>` and\r\n * `/meshes/<j>/primitives/<k>`. The hint is the path segment preceding the template parameter\r\n * being resolved, so a template like `/nodes/{nodeRef}/globalMatrix` picks the `/nodes/<i>`\r\n * pointer even when another pointer was added to the object first.\r\n * @param object the Babylon object to address\r\n * @param hint the expected root segment of the pointer, when known\r\n * @returns the JSON Pointer for the object, or `undefined` when it is not addressable\r\n */\r\n public getObjectReference(object: object, hint?: string): string | undefined {\r\n const pointers = (object as { _internalMetadata?: { gltf?: { pointers?: unknown } } })._internalMetadata?.gltf?.pointers;\r\n if (!Array.isArray(pointers)) {\r\n return undefined;\r\n }\r\n const stringPointers = pointers.filter((pointer: unknown): pointer is string => typeof pointer === \"string\");\r\n if (stringPointers.length === 0) {\r\n return undefined;\r\n }\r\n if (hint) {\r\n const match = stringPointers.find((pointer) => pointer.split(\"/\")[1] === hint);\r\n if (match) {\r\n return match;\r\n }\r\n }\r\n return stringPointers[0];\r\n }\r\n}\r\n"]}
@@ -0,0 +1,24 @@
1
+ import { type INode } from "../../glTFLoaderInterfaces.js";
2
+ type InteractivityNodeState = "hoverable" | "selectable";
3
+ /**
4
+ * Initializes authored and inherited selectability or hoverability state.
5
+ * @param nodes all nodes in the glTF asset
6
+ * @param state state kind to initialize
7
+ * @param getAuthoredState reads the extension-authored local state
8
+ */
9
+ export declare function InitializeInteractivityNodeState(nodes: readonly INode[], state: InteractivityNodeState, getAuthoredState: (node: INode) => boolean | undefined): void;
10
+ /**
11
+ * Gets the locally authored runtime state for a node.
12
+ * @param node glTF node
13
+ * @param state state kind
14
+ * @returns local state, defaulting to true
15
+ */
16
+ export declare function GetInteractivityNodeState(node: INode, state: InteractivityNodeState): boolean;
17
+ /**
18
+ * Updates local state and reapplies inherited state to the affected subtree.
19
+ * @param node glTF node
20
+ * @param state state kind
21
+ * @param value new local state
22
+ */
23
+ export declare function SetInteractivityNodeState(node: INode, state: InteractivityNodeState, value: boolean): void;
24
+ export {};
@@ -0,0 +1,89 @@
1
+ const _NodeSets = /*#__PURE__*/ new WeakMap();
2
+ const _Hoverable = /*#__PURE__*/ new WeakMap();
3
+ const _Selectable = /*#__PURE__*/ new WeakMap();
4
+ function _GetStateMap(state) {
5
+ return state === "selectable" ? _Selectable : _Hoverable;
6
+ }
7
+ function _GetLocalState(node, state) {
8
+ return _GetStateMap(state).get(node) ?? true;
9
+ }
10
+ function _GetEffectiveState(node, state) {
11
+ let current = node;
12
+ while (current) {
13
+ if (!_GetLocalState(current, state)) {
14
+ return false;
15
+ }
16
+ current = current.parent;
17
+ }
18
+ return true;
19
+ }
20
+ function _ApplyMeshState(mesh, state, value) {
21
+ if (state === "selectable") {
22
+ mesh.isPickable = value;
23
+ }
24
+ else {
25
+ mesh._isPointerMovePickable = value;
26
+ }
27
+ }
28
+ function _ApplyNodeState(node, state) {
29
+ const effective = _GetEffectiveState(node, state);
30
+ const meshes = node._primitiveBabylonMeshes ?? [];
31
+ for (const mesh of meshes) {
32
+ _ApplyMeshState(mesh, state, effective);
33
+ }
34
+ const transformNode = node._babylonTransformNode;
35
+ if (transformNode && "isPickable" in transformNode) {
36
+ _ApplyMeshState(transformNode, state, effective);
37
+ }
38
+ }
39
+ function _IsDescendantNode(node, ancestor) {
40
+ let current = node;
41
+ while (current) {
42
+ if (current === ancestor) {
43
+ return true;
44
+ }
45
+ current = current.parent;
46
+ }
47
+ return false;
48
+ }
49
+ /**
50
+ * Initializes authored and inherited selectability or hoverability state.
51
+ * @param nodes all nodes in the glTF asset
52
+ * @param state state kind to initialize
53
+ * @param getAuthoredState reads the extension-authored local state
54
+ */
55
+ export function InitializeInteractivityNodeState(nodes, state, getAuthoredState) {
56
+ const stateMap = _GetStateMap(state);
57
+ for (const node of nodes) {
58
+ _NodeSets.set(node, nodes);
59
+ stateMap.set(node, getAuthoredState(node) ?? true);
60
+ }
61
+ for (const node of nodes) {
62
+ _ApplyNodeState(node, state);
63
+ }
64
+ }
65
+ /**
66
+ * Gets the locally authored runtime state for a node.
67
+ * @param node glTF node
68
+ * @param state state kind
69
+ * @returns local state, defaulting to true
70
+ */
71
+ export function GetInteractivityNodeState(node, state) {
72
+ return _GetLocalState(node, state);
73
+ }
74
+ /**
75
+ * Updates local state and reapplies inherited state to the affected subtree.
76
+ * @param node glTF node
77
+ * @param state state kind
78
+ * @param value new local state
79
+ */
80
+ export function SetInteractivityNodeState(node, state, value) {
81
+ _GetStateMap(state).set(node, value);
82
+ const nodes = _NodeSets.get(node) ?? [node];
83
+ for (const candidate of nodes) {
84
+ if (_IsDescendantNode(candidate, node)) {
85
+ _ApplyNodeState(candidate, state);
86
+ }
87
+ }
88
+ }
89
+ //# sourceMappingURL=interactivityNodeState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactivityNodeState.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.ts"],"names":[],"mappings":"AAKA,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,OAAO,EAA2B,CAAC;AACvE,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,OAAO,EAAkB,CAAC;AAC/D,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,OAAO,EAAkB,CAAC;AAEhE,SAAS,YAAY,CAAC,KAA6B;IAC/C,OAAO,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AAC7D,CAAC;AAED,SAAS,cAAc,CAAC,IAAW,EAAE,KAA6B;IAC9D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AACjD,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAW,EAAE,KAA6B;IAClE,IAAI,OAAO,GAAsB,IAAI,CAAC;IACtC,OAAO,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U,gCAAgC,CAAC,KAAuB,EAAE,KAA6B,EAAE,gBAAsD;IAC3J,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3B,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;IACvD,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAW,EAAE,KAA6B;IAChF,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAW,EAAE,KAA6B,EAAE,KAAc;IAChG,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC5B,IAAI,iBAAiB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;YACrC,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;AACL,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh.pure\";\nimport { type INode } from \"../../glTFLoaderInterfaces\";\n\ntype InteractivityNodeState = \"hoverable\" | \"selectable\";\n\nconst _NodeSets = /*#__PURE__*/ new WeakMap<INode, readonly INode[]>();\nconst _Hoverable = /*#__PURE__*/ new WeakMap<INode, boolean>();\nconst _Selectable = /*#__PURE__*/ new WeakMap<INode, boolean>();\n\nfunction _GetStateMap(state: InteractivityNodeState): WeakMap<INode, boolean> {\n return state === \"selectable\" ? _Selectable : _Hoverable;\n}\n\nfunction _GetLocalState(node: INode, state: InteractivityNodeState): boolean {\n return _GetStateMap(state).get(node) ?? true;\n}\n\nfunction _GetEffectiveState(node: INode, state: InteractivityNodeState): boolean {\n let current: INode | undefined = node;\n while (current) {\n if (!_GetLocalState(current, state)) {\n return false;\n }\n current = current.parent;\n }\n return true;\n}\n\nfunction _ApplyMeshState(mesh: AbstractMesh, state: InteractivityNodeState, value: boolean): void {\n if (state === \"selectable\") {\n mesh.isPickable = value;\n } else {\n mesh._isPointerMovePickable = value;\n }\n}\n\nfunction _ApplyNodeState(node: INode, state: InteractivityNodeState): void {\n const effective = _GetEffectiveState(node, state);\n const meshes = node._primitiveBabylonMeshes ?? [];\n for (const mesh of meshes) {\n _ApplyMeshState(mesh, state, effective);\n }\n const transformNode = node._babylonTransformNode;\n if (transformNode && \"isPickable\" in transformNode) {\n _ApplyMeshState(transformNode as AbstractMesh, state, effective);\n }\n}\n\nfunction _IsDescendantNode(node: INode, ancestor: INode): boolean {\n let current: INode | undefined = node;\n while (current) {\n if (current === ancestor) {\n return true;\n }\n current = current.parent;\n }\n return false;\n}\n\n/**\n * Initializes authored and inherited selectability or hoverability state.\n * @param nodes all nodes in the glTF asset\n * @param state state kind to initialize\n * @param getAuthoredState reads the extension-authored local state\n */\nexport function InitializeInteractivityNodeState(nodes: readonly INode[], state: InteractivityNodeState, getAuthoredState: (node: INode) => boolean | undefined): void {\n const stateMap = _GetStateMap(state);\n for (const node of nodes) {\n _NodeSets.set(node, nodes);\n stateMap.set(node, getAuthoredState(node) ?? true);\n }\n for (const node of nodes) {\n _ApplyNodeState(node, state);\n }\n}\n\n/**\n * Gets the locally authored runtime state for a node.\n * @param node glTF node\n * @param state state kind\n * @returns local state, defaulting to true\n */\nexport function GetInteractivityNodeState(node: INode, state: InteractivityNodeState): boolean {\n return _GetLocalState(node, state);\n}\n\n/**\n * Updates local state and reapplies inherited state to the affected subtree.\n * @param node glTF node\n * @param state state kind\n * @param value new local state\n */\nexport function SetInteractivityNodeState(node: INode, state: InteractivityNodeState, value: boolean): void {\n _GetStateMap(state).set(node, value);\n const nodes = _NodeSets.get(node) ?? [node];\n for (const candidate of nodes) {\n if (_IsDescendantNode(candidate, node)) {\n _ApplyNodeState(candidate, state);\n }\n }\n}\n"]}
@@ -2,3 +2,9 @@
2
2
  export * from "./declarationMapper.js";
3
3
  export * from "./interactivityGraphParser.js";
4
4
  export * from "./flowGraphGLTFDataProvider.js";
5
+ export * from "./flowGraphEventReferenceBlock.js";
6
+ export * from "./flowGraphObjectReferenceBlock.js";
7
+ export * from "./flowGraphUnsupportedInteractivityBlock.js";
8
+ export * from "./interactivityGraphModel.js";
9
+ export * from "./interactivityGraphExporter.js";
10
+ export * from "./interactivityNodeState.js";
@@ -2,4 +2,10 @@
2
2
  export * from "./declarationMapper.js";
3
3
  export * from "./interactivityGraphParser.js";
4
4
  export * from "./flowGraphGLTFDataProvider.js";
5
+ export * from "./flowGraphEventReferenceBlock.js";
6
+ export * from "./flowGraphObjectReferenceBlock.js";
7
+ export * from "./flowGraphUnsupportedInteractivityBlock.js";
8
+ export * from "./interactivityGraphModel.js";
9
+ export * from "./interactivityGraphExporter.js";
10
+ export * from "./interactivityNodeState.js";
5
11
  //# sourceMappingURL=pure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./declarationMapper\";\nexport * from \"./interactivityGraphParser\";\nexport * from \"./flowGraphGLTFDataProvider\";\n"]}
1
+ {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./declarationMapper\";\nexport * from \"./interactivityGraphParser\";\nexport * from \"./flowGraphGLTFDataProvider\";\nexport * from \"./flowGraphEventReferenceBlock\";\nexport * from \"./flowGraphObjectReferenceBlock\";\nexport * from \"./flowGraphUnsupportedInteractivityBlock\";\nexport * from \"./interactivityGraphModel\";\nexport * from \"./interactivityGraphExporter\";\nexport * from \"./interactivityNodeState\";\n"]}