@babylonjs/loaders 9.26.0 → 9.26.2

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 (129) hide show
  1. package/FBX/fbxConstraintBehavior.d.ts +188 -0
  2. package/FBX/fbxConstraintBehavior.js +532 -0
  3. package/FBX/fbxConstraintBehavior.js.map +1 -0
  4. package/FBX/fbxFileLoader.pure.d.ts +175 -6
  5. package/FBX/fbxFileLoader.pure.js +1521 -286
  6. package/FBX/fbxFileLoader.pure.js.map +1 -1
  7. package/FBX/index.d.ts +4 -1
  8. package/FBX/index.js +1 -0
  9. package/FBX/index.js.map +1 -1
  10. package/FBX/interpreter/animation.d.ts +73 -33
  11. package/FBX/interpreter/animation.js +620 -223
  12. package/FBX/interpreter/animation.js.map +1 -1
  13. package/FBX/interpreter/animationCurve.d.ts +91 -0
  14. package/FBX/interpreter/animationCurve.js +623 -0
  15. package/FBX/interpreter/animationCurve.js.map +1 -0
  16. package/FBX/interpreter/blendShapes.js +9 -18
  17. package/FBX/interpreter/blendShapes.js.map +1 -1
  18. package/FBX/interpreter/connections.d.ts +1 -1
  19. package/FBX/interpreter/connections.js +173 -34
  20. package/FBX/interpreter/connections.js.map +1 -1
  21. package/FBX/interpreter/constraints.d.ts +68 -0
  22. package/FBX/interpreter/constraints.js +143 -0
  23. package/FBX/interpreter/constraints.js.map +1 -0
  24. package/FBX/interpreter/fbxInterpreter.d.ts +89 -4
  25. package/FBX/interpreter/fbxInterpreter.js +474 -122
  26. package/FBX/interpreter/fbxInterpreter.js.map +1 -1
  27. package/FBX/interpreter/geometry.d.ts +1 -1
  28. package/FBX/interpreter/geometry.js +150 -92
  29. package/FBX/interpreter/geometry.js.map +1 -1
  30. package/FBX/interpreter/legacyDocument.d.ts +11 -0
  31. package/FBX/interpreter/legacyDocument.js +425 -0
  32. package/FBX/interpreter/legacyDocument.js.map +1 -0
  33. package/FBX/interpreter/materialModel.d.ts +71 -0
  34. package/FBX/interpreter/materialModel.js +622 -0
  35. package/FBX/interpreter/materialModel.js.map +1 -0
  36. package/FBX/interpreter/materials.d.ts +13 -1
  37. package/FBX/interpreter/materials.js +88 -5
  38. package/FBX/interpreter/materials.js.map +1 -1
  39. package/FBX/interpreter/nodeTransform.d.ts +32 -0
  40. package/FBX/interpreter/nodeTransform.js +54 -0
  41. package/FBX/interpreter/nodeTransform.js.map +1 -0
  42. package/FBX/interpreter/nurbs.d.ts +99 -0
  43. package/FBX/interpreter/nurbs.js +627 -0
  44. package/FBX/interpreter/nurbs.js.map +1 -0
  45. package/FBX/interpreter/propertyTemplates.d.ts +23 -0
  46. package/FBX/interpreter/propertyTemplates.js +109 -2
  47. package/FBX/interpreter/propertyTemplates.js.map +1 -1
  48. package/FBX/interpreter/rig.js +16 -0
  49. package/FBX/interpreter/rig.js.map +1 -1
  50. package/FBX/interpreter/sceneDiagnostics.js +28 -3
  51. package/FBX/interpreter/sceneDiagnostics.js.map +1 -1
  52. package/FBX/interpreter/skeleton.d.ts +4 -18
  53. package/FBX/interpreter/skeleton.js +16 -94
  54. package/FBX/interpreter/skeleton.js.map +1 -1
  55. package/FBX/parsers/fbxAsciiParser.js +119 -9
  56. package/FBX/parsers/fbxAsciiParser.js.map +1 -1
  57. package/FBX/parsers/fbxBinaryParser.js +74 -22
  58. package/FBX/parsers/fbxBinaryParser.js.map +1 -1
  59. package/FBX/pure.d.ts +1 -0
  60. package/FBX/pure.js +1 -0
  61. package/FBX/pure.js.map +1 -1
  62. package/FBX/types/fbxTypes.d.ts +18 -2
  63. package/FBX/types/fbxTypes.js +40 -12
  64. package/FBX/types/fbxTypes.js.map +1 -1
  65. package/SPLAT/gaussianSplattingStream.d.ts +79 -25
  66. package/SPLAT/gaussianSplattingStream.js +320 -95
  67. package/SPLAT/gaussianSplattingStream.js.map +1 -1
  68. package/USD/usdCommandProtocol.d.ts +20 -4
  69. package/USD/usdCommandProtocol.js +25 -3
  70. package/USD/usdCommandProtocol.js.map +1 -1
  71. package/USD/usdFileLoader.pure.js +2 -0
  72. package/USD/usdFileLoader.pure.js.map +1 -1
  73. package/USD/usdSceneMaterializer.js +430 -92
  74. package/USD/usdSceneMaterializer.js.map +1 -1
  75. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +110 -3
  76. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +468 -74
  77. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
  78. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.d.ts +47 -0
  79. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js +68 -0
  80. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js.map +1 -0
  81. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +2 -2
  82. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +1 -1
  83. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -1
  84. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.d.ts +24 -0
  85. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js +38 -0
  86. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js.map +1 -0
  87. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.d.ts +41 -0
  88. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js +63 -0
  89. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js.map +1 -0
  90. package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +5 -0
  91. package/glTF/2.0/Extensions/KHR_interactivity/index.js +5 -0
  92. package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -1
  93. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.d.ts +112 -0
  94. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js +773 -0
  95. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js.map +1 -0
  96. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +18 -10
  97. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +299 -54
  98. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
  99. package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.d.ts +2 -1
  100. package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js +7 -2
  101. package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js.map +1 -1
  102. package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.d.ts +24 -0
  103. package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js +89 -0
  104. package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js.map +1 -0
  105. package/glTF/2.0/Extensions/KHR_interactivity/pure.d.ts +5 -0
  106. package/glTF/2.0/Extensions/KHR_interactivity/pure.js +5 -0
  107. package/glTF/2.0/Extensions/KHR_interactivity/pure.js.map +1 -1
  108. package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +55 -1
  109. package/glTF/2.0/Extensions/KHR_interactivity.pure.js +124 -76
  110. package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
  111. package/glTF/2.0/Extensions/KHR_interactivity.types.d.ts +18 -1
  112. package/glTF/2.0/Extensions/KHR_interactivity.types.js.map +1 -1
  113. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +2 -0
  114. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +114 -56
  115. package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
  116. package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +2 -0
  117. package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +80 -35
  118. package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
  119. package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js +3 -2
  120. package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js.map +1 -1
  121. package/glTF/2.0/Extensions/objectModelMapping.d.ts +4 -2
  122. package/glTF/2.0/Extensions/objectModelMapping.js +33 -4
  123. package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
  124. package/glTF/2.0/glTFLoader.pure.d.ts +1 -1
  125. package/glTF/2.0/glTFLoader.pure.js +9 -4
  126. package/glTF/2.0/glTFLoader.pure.js.map +1 -1
  127. package/glTF/2.0/glTFLoaderExtension.d.ts +2 -1
  128. package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
  129. package/package.json +3 -3
@@ -14,37 +14,45 @@ export function getMappingForFullOperationName(fullOperationName) {
14
14
  export function getMappingForDeclaration(declaration, returnNoOpIfNotAvailable = true) {
15
15
  const mapping = declaration.extension ? gltfExtensionsToFlowGraphMapping[declaration.extension]?.[declaration.op] : gltfToFlowGraphMapping[declaration.op];
16
16
  if (!mapping) {
17
- Logger.Warn(`No mapping found for operation ${declaration.op} and extension ${declaration.extension || "KHR_interactivity"}`);
18
17
  if (returnNoOpIfNotAvailable) {
19
- const inputs = {};
20
- const outputs = {
21
- flows: {},
22
- };
23
- if (declaration.inputValueSockets) {
24
- inputs.values = {};
25
- for (const key in declaration.inputValueSockets) {
26
- inputs.values[key] = {
27
- name: key,
28
- };
29
- }
30
- }
31
- if (declaration.outputValueSockets) {
32
- outputs.values = {};
33
- Object.keys(declaration.outputValueSockets).forEach((key) => {
34
- outputs.values[key] = {
35
- name: key,
36
- };
37
- });
38
- }
39
- return {
40
- blocks: [], // no blocks, just mapping
41
- inputs,
42
- outputs,
43
- };
18
+ Logger.Warn(`No mapping found for operation ${declaration.op} and extension ${declaration.extension || "KHR_interactivity"}`);
19
+ return getNoOpMappingForDeclaration(declaration);
44
20
  }
45
21
  }
46
22
  return mapping;
47
23
  }
24
+ /**
25
+ * Creates the typed no-op mapping required for an unsupported extension declaration.
26
+ * @param declaration unsupported extension declaration
27
+ * @returns a mapping that preserves the declared value sockets
28
+ */
29
+ export function getNoOpMappingForDeclaration(declaration) {
30
+ const inputs = {};
31
+ const outputs = {
32
+ flows: {},
33
+ };
34
+ if (declaration.inputValueSockets) {
35
+ inputs.values = {};
36
+ for (const key in declaration.inputValueSockets) {
37
+ inputs.values[key] = {
38
+ name: key,
39
+ };
40
+ }
41
+ }
42
+ if (declaration.outputValueSockets) {
43
+ outputs.values = {};
44
+ Object.keys(declaration.outputValueSockets).forEach((key) => {
45
+ outputs.values[key] = {
46
+ name: key,
47
+ };
48
+ });
49
+ }
50
+ return {
51
+ blocks: [],
52
+ inputs,
53
+ outputs,
54
+ };
55
+ }
48
56
  /**
49
57
  * This function will add new mapping to glTF interactivity.
50
58
  * Other extensions can define new types of blocks, this is the way to let interactivity know how to parse them.
@@ -74,6 +82,12 @@ const gltfExtensionsToFlowGraphMapping = {
74
82
  inputs: {
75
83
  values: {
76
84
  message: { name: "message" },
85
+ "[segment]": { name: "$1", compatibilityOnly: true },
86
+ },
87
+ },
88
+ outputs: {
89
+ flows: {
90
+ out: { name: "out", compatibilityOnly: true },
77
91
  },
78
92
  },
79
93
  },
@@ -98,6 +112,7 @@ const gltfToFlowGraphMapping = {
98
112
  inputs: {},
99
113
  outputs: {
100
114
  values: {
115
+ timeSinceStart: { name: "timeSinceStart", gltfType: "number" },
101
116
  timeSinceLastTick: { name: "deltaTime", gltfType: "number" /*, dataTransformer: (time: number) => time / 1000*/ },
102
117
  // KHR_interactivity `ref event` output (the event reference).
103
118
  event: { name: "event" },
@@ -109,11 +124,30 @@ const gltfToFlowGraphMapping = {
109
124
  },
110
125
  "event/send": {
111
126
  blocks: ["FlowGraphSendCustomEventBlock" /* FlowGraphBlockNames.SendCustomEvent */],
127
+ configuration: {
128
+ event: {
129
+ name: "eventId",
130
+ configurationType: "int",
131
+ required: true,
132
+ indexSource: "events",
133
+ validationOnly: true,
134
+ },
135
+ },
136
+ inputs: {
137
+ values: {
138
+ "[segment]": { name: "$1" },
139
+ },
140
+ },
141
+ outputs: {
142
+ flows: {
143
+ out: { name: "out" },
144
+ },
145
+ },
112
146
  extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
113
147
  // set eventId and eventData. The configuration object of the glTF should have a single object.
114
148
  // validate that we are running it on the right block.
115
- if (declaration.op !== "event/send" || !gltfBlock.configuration || Object.keys(gltfBlock.configuration).length !== 1) {
116
- throw new Error("Receive event should have a single configuration object, the event itself");
149
+ if (declaration.op !== "event/send" || !gltfBlock.configuration?.event) {
150
+ throw new Error("Send event should have a single configuration object, the event itself");
117
151
  }
118
152
  const eventConfiguration = gltfBlock.configuration["event"];
119
153
  const eventId = eventConfiguration.value?.[0];
@@ -130,10 +164,20 @@ const gltfToFlowGraphMapping = {
130
164
  },
131
165
  "event/receive": {
132
166
  blocks: ["FlowGraphReceiveCustomEventBlock" /* FlowGraphBlockNames.ReceiveCustomEvent */],
167
+ configuration: {
168
+ event: {
169
+ name: "eventId",
170
+ configurationType: "int",
171
+ required: true,
172
+ indexSource: "events",
173
+ validationOnly: true,
174
+ },
175
+ },
133
176
  outputs: {
134
177
  values: {
135
178
  // KHR_interactivity `ref event` output (the event reference).
136
179
  event: { name: "event" },
180
+ "[segment]": { name: "$1" },
137
181
  },
138
182
  flows: {
139
183
  out: { name: "done" },
@@ -164,7 +208,7 @@ const gltfToFlowGraphMapping = {
164
208
  extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
165
209
  // set eventId and eventData. The configuration object of the glTF should have a single object.
166
210
  // validate that we are running it on the right block.
167
- if (declaration.op !== "event/receive" || !gltfBlock.configuration || Object.keys(gltfBlock.configuration).length !== 1) {
211
+ if (declaration.op !== "event/receive" || !gltfBlock.configuration?.event) {
168
212
  throw new Error("Receive event should have a single configuration object, the event itself");
169
213
  }
170
214
  const eventConfiguration = gltfBlock.configuration["event"];
@@ -197,11 +241,11 @@ const gltfToFlowGraphMapping = {
197
241
  },
198
242
  },
199
243
  },
200
- "math/E": getSimpleInputMapping("FlowGraphEBlock" /* FlowGraphBlockNames.E */),
201
- "math/Pi": getSimpleInputMapping("FlowGraphPIBlock" /* FlowGraphBlockNames.PI */),
202
- "math/Tau": getSimpleInputMapping("FlowGraphTauBlock" /* FlowGraphBlockNames.Tau */),
203
- "math/Inf": getSimpleInputMapping("FlowGraphInfBlock" /* FlowGraphBlockNames.Inf */),
204
- "math/NaN": getSimpleInputMapping("FlowGraphNaNBlock" /* FlowGraphBlockNames.NaN */),
244
+ "math/E": getSimpleInputMapping("FlowGraphEBlock" /* FlowGraphBlockNames.E */, []),
245
+ "math/Pi": getSimpleInputMapping("FlowGraphPIBlock" /* FlowGraphBlockNames.PI */, []),
246
+ "math/Tau": getSimpleInputMapping("FlowGraphTauBlock" /* FlowGraphBlockNames.Tau */, []),
247
+ "math/Inf": getSimpleInputMapping("FlowGraphInfBlock" /* FlowGraphBlockNames.Inf */, []),
248
+ "math/NaN": getSimpleInputMapping("FlowGraphNaNBlock" /* FlowGraphBlockNames.NaN */, []),
205
249
  "math/abs": getSimpleInputMapping("FlowGraphAbsBlock" /* FlowGraphBlockNames.Abs */),
206
250
  "math/sign": getSimpleInputMapping("FlowGraphSignBlock" /* FlowGraphBlockNames.Sign */),
207
251
  "math/trunc": getSimpleInputMapping("FlowGraphTruncBlock" /* FlowGraphBlockNames.Trunc */),
@@ -234,6 +278,17 @@ const gltfToFlowGraphMapping = {
234
278
  "math/sub": getSimpleInputMapping("FlowGraphSubtractBlock" /* FlowGraphBlockNames.Subtract */, ["a", "b"], true),
235
279
  "math/mul": {
236
280
  blocks: ["FlowGraphMultiplyBlock" /* FlowGraphBlockNames.Multiply */],
281
+ inputs: {
282
+ values: {
283
+ a: { name: "a" },
284
+ b: { name: "b" },
285
+ },
286
+ },
287
+ outputs: {
288
+ values: {
289
+ value: { name: "value" },
290
+ },
291
+ },
237
292
  extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
238
293
  var _a;
239
294
  // configure it to work the way glTF specifies
@@ -339,7 +394,7 @@ const gltfToFlowGraphMapping = {
339
394
  },
340
395
  outputs: {
341
396
  values: {
342
- value: { name: "output" },
397
+ value: { name: "output", typeSourceInput: "a" },
343
398
  },
344
399
  },
345
400
  },
@@ -372,7 +427,15 @@ const gltfToFlowGraphMapping = {
372
427
  "math/cbrt": getSimpleInputMapping("FlowGraphCubeRootBlock" /* FlowGraphBlockNames.CubeRoot */),
373
428
  "math/pow": getSimpleInputMapping("FlowGraphPowerBlock" /* FlowGraphBlockNames.Power */, ["a", "b"]),
374
429
  "math/length": getSimpleInputMapping("FlowGraphLengthBlock" /* FlowGraphBlockNames.Length */),
375
- "math/normalize": getSimpleInputMapping("FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */),
430
+ "math/normalize": {
431
+ ...getSimpleInputMapping("FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */),
432
+ outputs: {
433
+ values: {
434
+ value: { name: "value" },
435
+ isValid: { name: "isValid", gltfType: "bool" },
436
+ },
437
+ },
438
+ },
376
439
  "math/dot": getSimpleInputMapping("FlowGraphDotBlock" /* FlowGraphBlockNames.Dot */, ["a", "b"]),
377
440
  "math/cross": getSimpleInputMapping("FlowGraphCrossBlock" /* FlowGraphBlockNames.Cross */, ["a", "b"]),
378
441
  "math/rotate2D": {
@@ -511,7 +574,15 @@ const gltfToFlowGraphMapping = {
511
574
  },
512
575
  "math/transpose": getSimpleInputMapping("FlowGraphTransposeBlock" /* FlowGraphBlockNames.Transpose */),
513
576
  "math/determinant": getSimpleInputMapping("FlowGraphDeterminantBlock" /* FlowGraphBlockNames.Determinant */),
514
- "math/inverse": getSimpleInputMapping("FlowGraphInvertMatrixBlock" /* FlowGraphBlockNames.InvertMatrix */),
577
+ "math/inverse": {
578
+ ...getSimpleInputMapping("FlowGraphInvertMatrixBlock" /* FlowGraphBlockNames.InvertMatrix */),
579
+ outputs: {
580
+ values: {
581
+ value: { name: "value" },
582
+ isValid: { name: "isValid", gltfType: "bool" },
583
+ },
584
+ },
585
+ },
515
586
  "math/matMul": getSimpleInputMapping("FlowGraphMatrixMultiplicationBlock" /* FlowGraphBlockNames.MatrixMultiplication */, ["a", "b"]),
516
587
  "math/matCompose": {
517
588
  blocks: ["FlowGraphMatrixCompose" /* FlowGraphBlockNames.MatrixCompose */],
@@ -524,7 +595,7 @@ const gltfToFlowGraphMapping = {
524
595
  },
525
596
  outputs: {
526
597
  values: {
527
- value: { name: "value" },
598
+ value: { name: "value", gltfType: "float4x4" },
528
599
  },
529
600
  },
530
601
  extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
@@ -552,6 +623,8 @@ const gltfToFlowGraphMapping = {
552
623
  translation: { name: "position" },
553
624
  rotation: { name: "rotationQuaternion" },
554
625
  scale: { name: "scaling" },
626
+ scaling: { name: "scaling", compatibilityOnly: true },
627
+ isValid: { name: "isValid", compatibilityOnly: true },
555
628
  },
556
629
  },
557
630
  extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
@@ -601,7 +674,20 @@ const gltfToFlowGraphMapping = {
601
674
  },
602
675
  },
603
676
  },
604
- "math/quatToAxisAngle": getSimpleInputMapping("FlowGraphAxisAngleFromQuaternionBlock" /* FlowGraphBlockNames.AxisAngleFromQuaternion */, ["a"]),
677
+ "math/quatToAxisAngle": {
678
+ blocks: ["FlowGraphAxisAngleFromQuaternionBlock" /* FlowGraphBlockNames.AxisAngleFromQuaternion */],
679
+ inputs: {
680
+ values: {
681
+ a: { name: "a", gltfType: "float4" },
682
+ },
683
+ },
684
+ outputs: {
685
+ values: {
686
+ axis: { name: "axis", gltfType: "float3" },
687
+ angle: { name: "angle", gltfType: "float" },
688
+ },
689
+ },
690
+ },
605
691
  "math/quatFromDirections": getSimpleInputMapping("FlowGraphQuaternionFromDirectionsBlock" /* FlowGraphBlockNames.QuaternionFromDirections */, ["a", "b"]),
606
692
  "math/quatFromUpForward": {
607
693
  blocks: ["FlowGraphQuaternionFromUpForwardBlock" /* FlowGraphBlockNames.QuaternionFromUpForward */],
@@ -881,6 +967,11 @@ const gltfToFlowGraphMapping = {
881
967
  // flows
882
968
  "flow/sequence": {
883
969
  blocks: ["FlowGraphSequenceBlock" /* FlowGraphBlockNames.Sequence */],
970
+ outputs: {
971
+ flows: {
972
+ "[segment]": { name: "$1" },
973
+ },
974
+ },
884
975
  extraProcessor(gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
885
976
  const serializedObject = serializedObjects[0];
886
977
  serializedObject.config || (serializedObject.config = {});
@@ -893,6 +984,11 @@ const gltfToFlowGraphMapping = {
893
984
  },
894
985
  "flow/branch": {
895
986
  blocks: ["FlowGraphBranchBlock" /* FlowGraphBlockNames.Branch */],
987
+ inputs: {
988
+ values: {
989
+ condition: { name: "condition", gltfType: "boolean" },
990
+ },
991
+ },
896
992
  outputs: {
897
993
  flows: {
898
994
  true: { name: "onTrue" },
@@ -903,7 +999,16 @@ const gltfToFlowGraphMapping = {
903
999
  "flow/switch": {
904
1000
  blocks: ["FlowGraphSwitchBlock" /* FlowGraphBlockNames.Switch */],
905
1001
  configuration: {
906
- cases: { name: "cases", isArray: true, inOptions: true, defaultValue: [] },
1002
+ cases: {
1003
+ name: "cases",
1004
+ isArray: true,
1005
+ inOptions: true,
1006
+ defaultValue: [],
1007
+ configurationType: "int[]",
1008
+ invalidUsesDefault: true,
1009
+ generatesOutputFlowSockets: true,
1010
+ uniqueValues: true,
1011
+ },
907
1012
  },
908
1013
  inputs: {
909
1014
  values: {
@@ -911,13 +1016,16 @@ const gltfToFlowGraphMapping = {
911
1016
  default: { name: "default" },
912
1017
  },
913
1018
  },
1019
+ outputs: {
1020
+ flows: {
1021
+ default: { name: "default" },
1022
+ "[segment]": { name: "$1" },
1023
+ },
1024
+ },
914
1025
  validation(gltfBlock) {
915
1026
  const cases = gltfBlock.configuration?.cases;
916
1027
  if (cases && cases.value) {
917
- const onlyIntegers = cases.value.every((caseValue) => {
918
- // case value should be an integer. Since Number.isInteger(1.0) is true, we need to check if toString has only digits.
919
- return typeof caseValue === "number" && /^-?\d+$/.test(caseValue.toString());
920
- });
1028
+ const onlyIntegers = cases.value.every((caseValue) => typeof caseValue === "number" && Number.isInteger(caseValue) && caseValue >= -2147483648 && caseValue <= 2147483647);
921
1029
  if (!onlyIntegers) {
922
1030
  Logger.Warn("Switch cases should be integers. Using empty array instead.");
923
1031
  cases.value = [];
@@ -945,21 +1053,34 @@ const gltfToFlowGraphMapping = {
945
1053
  },
946
1054
  "flow/while": {
947
1055
  blocks: ["FlowGraphWhileLoopBlock" /* FlowGraphBlockNames.WhileLoop */],
1056
+ inputs: {
1057
+ values: {
1058
+ condition: { name: "condition", gltfType: "boolean" },
1059
+ },
1060
+ },
948
1061
  outputs: {
949
1062
  flows: {
950
1063
  loopBody: { name: "executionFlow" },
1064
+ completed: { name: "completed" },
951
1065
  },
952
1066
  },
953
1067
  },
954
1068
  "flow/for": {
955
1069
  blocks: ["FlowGraphForLoopBlock" /* FlowGraphBlockNames.ForLoop */],
956
1070
  configuration: {
957
- initialIndex: { name: "initialIndex", gltfType: "number", inOptions: true, defaultValue: 0 },
1071
+ initialIndex: {
1072
+ name: "initialIndex",
1073
+ gltfType: "int",
1074
+ inOptions: true,
1075
+ defaultValue: 0,
1076
+ configurationType: "int",
1077
+ invalidUsesDefault: true,
1078
+ },
958
1079
  },
959
1080
  inputs: {
960
1081
  values: {
961
- startIndex: { name: "startIndex", gltfType: "number" },
962
- endIndex: { name: "endIndex", gltfType: "number" },
1082
+ startIndex: { name: "startIndex", gltfType: "int" },
1083
+ endIndex: { name: "endIndex", gltfType: "int" },
963
1084
  },
964
1085
  },
965
1086
  outputs: {
@@ -968,6 +1089,7 @@ const gltfToFlowGraphMapping = {
968
1089
  },
969
1090
  flows: {
970
1091
  loopBody: { name: "executionFlow" },
1092
+ completed: { name: "completed" },
971
1093
  },
972
1094
  },
973
1095
  extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
@@ -987,10 +1109,16 @@ const gltfToFlowGraphMapping = {
987
1109
  configuration: {},
988
1110
  inputs: {
989
1111
  values: {
990
- n: { name: "maxExecutions", gltfType: "number" },
1112
+ n: { name: "maxExecutions", gltfType: "int" },
1113
+ },
1114
+ flows: {
1115
+ reset: { name: "reset" },
991
1116
  },
992
1117
  },
993
1118
  outputs: {
1119
+ flows: {
1120
+ out: { name: "out" },
1121
+ },
994
1122
  values: {
995
1123
  currentCount: { name: "executionCount" },
996
1124
  },
@@ -998,17 +1126,46 @@ const gltfToFlowGraphMapping = {
998
1126
  },
999
1127
  "flow/multiGate": {
1000
1128
  blocks: ["FlowGraphMultiGateBlock" /* FlowGraphBlockNames.MultiGate */],
1129
+ inputs: {
1130
+ flows: {
1131
+ reset: { name: "reset" },
1132
+ },
1133
+ },
1001
1134
  configuration: {
1002
- isRandom: { name: "isRandom", gltfType: "boolean", inOptions: true, defaultValue: false },
1003
- isLoop: { name: "isLoop", gltfType: "boolean", inOptions: true, defaultValue: false },
1135
+ isRandom: {
1136
+ name: "isRandom",
1137
+ gltfType: "boolean",
1138
+ inOptions: true,
1139
+ defaultValue: false,
1140
+ configurationType: "bool",
1141
+ invalidUsesDefault: true,
1142
+ configurationGroup: "multiGate",
1143
+ },
1144
+ isLoop: {
1145
+ name: "isLoop",
1146
+ gltfType: "boolean",
1147
+ inOptions: true,
1148
+ defaultValue: false,
1149
+ configurationType: "bool",
1150
+ invalidUsesDefault: true,
1151
+ configurationGroup: "multiGate",
1152
+ },
1153
+ },
1154
+ outputs: {
1155
+ flows: {
1156
+ "[segment]": { name: "$1" },
1157
+ },
1158
+ values: {
1159
+ lastIndex: { name: "lastIndex", gltfType: "int" },
1160
+ },
1004
1161
  },
1005
1162
  extraProcessor(gltfBlock, declaration, _mapping, _arrays, serializedObjects) {
1006
- if (declaration.op !== "flow/multiGate" || !gltfBlock.flows || Object.keys(gltfBlock.flows).length === 0) {
1007
- throw new Error("MultiGate should have a single configuration object, the number of output flows");
1163
+ if (declaration.op !== "flow/multiGate") {
1164
+ throw new Error("Invalid operation for MultiGate mapping");
1008
1165
  }
1009
1166
  const serializedObject = serializedObjects[0];
1010
1167
  serializedObject.config || (serializedObject.config = {});
1011
- serializedObject.config.outputSignalCount = Object.keys(gltfBlock.flows).length;
1168
+ serializedObject.config.outputSignalCount = Object.keys(gltfBlock.flows ?? {}).length;
1012
1169
  serializedObject.signalOutputs.forEach((output, index) => {
1013
1170
  output.name = "out_" + index;
1014
1171
  });
@@ -1018,7 +1175,17 @@ const gltfToFlowGraphMapping = {
1018
1175
  "flow/waitAll": {
1019
1176
  blocks: ["FlowGraphWaitAllBlock" /* FlowGraphBlockNames.WaitAll */],
1020
1177
  configuration: {
1021
- inputFlows: { name: "inputSignalCount", gltfType: "number", inOptions: true, defaultValue: 0 },
1178
+ inputFlows: {
1179
+ name: "inputSignalCount",
1180
+ gltfType: "number",
1181
+ inOptions: true,
1182
+ defaultValue: [0],
1183
+ configurationType: "int",
1184
+ invalidUsesDefault: true,
1185
+ minimum: 0,
1186
+ maximum: 64,
1187
+ generatesInputFlowSockets: true,
1188
+ },
1022
1189
  },
1023
1190
  inputs: {
1024
1191
  flows: {
@@ -1026,9 +1193,19 @@ const gltfToFlowGraphMapping = {
1026
1193
  "[segment]": { name: "in_$1" },
1027
1194
  },
1028
1195
  },
1196
+ outputs: {
1197
+ flows: {
1198
+ out: { name: "out" },
1199
+ completed: { name: "completed" },
1200
+ },
1201
+ values: {
1202
+ remainingInputs: { name: "remainingInputs", gltfType: "int" },
1203
+ },
1204
+ },
1029
1205
  validation(gltfBlock) {
1030
- // check that the configuration value is an integer
1031
- if (typeof gltfBlock.configuration?.inputFlows?.value?.[0] !== "number") {
1206
+ const inputFlowsConfiguration = gltfBlock.configuration?.inputFlows?.value;
1207
+ const inputFlows = inputFlowsConfiguration?.[0];
1208
+ if (inputFlowsConfiguration?.length !== 1 || typeof inputFlows !== "number" || !Number.isInteger(inputFlows) || inputFlows < 0 || inputFlows > 64) {
1032
1209
  gltfBlock.configuration = gltfBlock.configuration || {
1033
1210
  inputFlows: { value: [0] },
1034
1211
  };
@@ -1039,22 +1216,45 @@ const gltfToFlowGraphMapping = {
1039
1216
  },
1040
1217
  "flow/throttle": {
1041
1218
  blocks: ["FlowGraphThrottleBlock" /* FlowGraphBlockNames.Throttle */],
1219
+ inputs: {
1220
+ values: {
1221
+ duration: { name: "duration", gltfType: "number" },
1222
+ },
1223
+ flows: {
1224
+ reset: { name: "reset" },
1225
+ },
1226
+ },
1042
1227
  outputs: {
1043
1228
  flows: {
1229
+ out: { name: "out" },
1044
1230
  err: { name: "error" },
1045
1231
  },
1232
+ values: {
1233
+ lastRemainingTime: { name: "lastRemainingTime", gltfType: "number" },
1234
+ },
1046
1235
  },
1047
1236
  },
1048
1237
  "flow/setDelay": {
1049
1238
  blocks: ["FlowGraphSetDelayBlock" /* FlowGraphBlockNames.SetDelay */],
1239
+ inputs: {
1240
+ values: {
1241
+ duration: { name: "duration", gltfType: "number" },
1242
+ },
1243
+ flows: {
1244
+ cancel: { name: "cancel" },
1245
+ },
1246
+ },
1050
1247
  outputs: {
1051
1248
  flows: {
1249
+ out: { name: "out" },
1052
1250
  err: { name: "error" },
1251
+ done: { name: "done" },
1053
1252
  },
1054
1253
  values: {
1055
1254
  // New spec renames this output to `lastDelay` (ref). Internally we still produce a
1056
1255
  // FlowGraphInteger; the index is unique per delay so it acts as the opaque handle.
1057
1256
  lastDelay: { name: "lastDelayIndex" },
1257
+ lastDelayIndex: { name: "lastDelayIndex", compatibilityOnly: true },
1058
1258
  },
1059
1259
  },
1060
1260
  },
@@ -1062,9 +1262,12 @@ const gltfToFlowGraphMapping = {
1062
1262
  blocks: ["FlowGraphCancelDelayBlock" /* FlowGraphBlockNames.CancelDelay */],
1063
1263
  inputs: {
1064
1264
  values: {
1065
- // New spec renames this input to `delay` (ref). The underlying block reads an int
1066
- // from `delayIndex`; when a ref-string flows in we coerce it via the path converter.
1067
- delay: { name: "delayIndex" },
1265
+ delay: { name: "delayIndex", gltfType: "ref" },
1266
+ },
1267
+ },
1268
+ outputs: {
1269
+ flows: {
1270
+ out: { name: "out" },
1068
1271
  },
1069
1272
  },
1070
1273
  },
@@ -1081,6 +1284,9 @@ const gltfToFlowGraphMapping = {
1081
1284
  variable: {
1082
1285
  name: "variable",
1083
1286
  gltfType: "number",
1287
+ configurationType: "int",
1288
+ required: true,
1289
+ indexSource: "variables",
1084
1290
  flowGraphType: "string",
1085
1291
  inOptions: true,
1086
1292
  isVariable: true,
@@ -1089,13 +1295,28 @@ const gltfToFlowGraphMapping = {
1089
1295
  },
1090
1296
  },
1091
1297
  },
1298
+ outputs: {
1299
+ values: {
1300
+ value: { name: "value" },
1301
+ },
1302
+ },
1092
1303
  },
1093
1304
  "variable/set": {
1094
1305
  blocks: ["FlowGraphSetVariableBlock" /* FlowGraphBlockNames.SetVariable */],
1306
+ inputs: {
1307
+ values: {
1308
+ "[segment]": { name: "$1" },
1309
+ },
1310
+ },
1095
1311
  configuration: {
1096
1312
  variables: {
1097
1313
  name: "variables",
1098
1314
  gltfType: "number",
1315
+ configurationType: "int[]",
1316
+ required: true,
1317
+ indexSource: "variables",
1318
+ minItems: 1,
1319
+ generatesInputValueSockets: true,
1099
1320
  flowGraphType: "string",
1100
1321
  inOptions: true,
1101
1322
  isArray: true,
@@ -1104,6 +1325,11 @@ const gltfToFlowGraphMapping = {
1104
1325
  },
1105
1326
  },
1106
1327
  },
1328
+ outputs: {
1329
+ flows: {
1330
+ out: { name: "out", compatibilityOnly: true },
1331
+ },
1332
+ },
1107
1333
  extraProcessor(_gltfBlock, _declaration, _mapping, parser, serializedObjects) {
1108
1334
  // variable/get configuration
1109
1335
  const serializedGetVariable = serializedObjects[0];
@@ -1124,6 +1350,9 @@ const gltfToFlowGraphMapping = {
1124
1350
  configuration: {
1125
1351
  variable: {
1126
1352
  name: "propertyName",
1353
+ configurationType: "int",
1354
+ required: true,
1355
+ indexSource: "variables",
1127
1356
  inOptions: true,
1128
1357
  isVariable: true,
1129
1358
  dataTransformer(index, parser) {
@@ -1132,8 +1361,9 @@ const gltfToFlowGraphMapping = {
1132
1361
  },
1133
1362
  useSlerp: {
1134
1363
  name: "animationType",
1364
+ configurationType: "bool",
1365
+ required: true,
1135
1366
  inOptions: true,
1136
- defaultValue: false,
1137
1367
  dataTransformer(value) {
1138
1368
  return value === true ? "Quaternion" /* FlowGraphTypes.Quaternion */ : undefined;
1139
1369
  },
@@ -1213,15 +1443,28 @@ const gltfToFlowGraphMapping = {
1213
1443
  },
1214
1444
  "pointer/get": {
1215
1445
  blocks: ["FlowGraphGetPropertyBlock" /* FlowGraphBlockNames.GetProperty */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */],
1216
- validation: ValidateJsonPointerTemplate,
1446
+ validation: (node) => ValidateJsonPointerTemplate(node),
1217
1447
  configuration: {
1218
- pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1448
+ pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, configurationType: "string", required: true, pointerTemplate: true },
1449
+ type: {
1450
+ name: "type",
1451
+ configurationType: "int",
1452
+ required: true,
1453
+ validationOnly: true,
1454
+ indexSource: "types",
1455
+ },
1219
1456
  },
1220
1457
  inputs: {
1221
1458
  values: {
1222
1459
  "[segment]": { name: "$1", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1223
1460
  },
1224
1461
  },
1462
+ outputs: {
1463
+ values: {
1464
+ value: { name: "value" },
1465
+ isValid: { name: "isValid", gltfType: "bool" },
1466
+ },
1467
+ },
1225
1468
  interBlockConnectors: [
1226
1469
  {
1227
1470
  input: "object",
@@ -1258,9 +1501,16 @@ const gltfToFlowGraphMapping = {
1258
1501
  },
1259
1502
  "pointer/set": {
1260
1503
  blocks: ["FlowGraphSetPropertyBlock" /* FlowGraphBlockNames.SetProperty */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */],
1261
- validation: ValidateJsonPointerTemplate,
1504
+ validation: (node) => ValidateJsonPointerTemplate(node, new Set(["value"])),
1262
1505
  configuration: {
1263
- pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1506
+ pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, configurationType: "string", required: true, pointerTemplate: true },
1507
+ type: {
1508
+ name: "type",
1509
+ configurationType: "int",
1510
+ required: true,
1511
+ validationOnly: true,
1512
+ indexSource: "types",
1513
+ },
1264
1514
  },
1265
1515
  inputs: {
1266
1516
  values: {
@@ -1272,6 +1522,7 @@ const gltfToFlowGraphMapping = {
1272
1522
  outputs: {
1273
1523
  flows: {
1274
1524
  err: { name: "error" },
1525
+ out: { name: "out", compatibilityOnly: true },
1275
1526
  },
1276
1527
  },
1277
1528
  interBlockConnectors: [
@@ -1311,9 +1562,17 @@ const gltfToFlowGraphMapping = {
1311
1562
  "pointer/interpolate": {
1312
1563
  // interpolate, parse the pointer and play the animation generated. 3 blocks!
1313
1564
  blocks: ["FlowGraphInterpolationBlock" /* FlowGraphBlockNames.ValueInterpolation */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */],
1314
- validation: ValidateJsonPointerTemplate,
1565
+ validation: (node) => ValidateJsonPointerTemplate(node, new Set(["value", "duration", "p1", "p2"])),
1315
1566
  configuration: {
1316
- pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1567
+ pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, configurationType: "string", required: true, pointerTemplate: true },
1568
+ type: {
1569
+ name: "type",
1570
+ configurationType: "int",
1571
+ required: true,
1572
+ validationOnly: true,
1573
+ indexSource: "types",
1574
+ allowedSignatures: ["float", "float2", "float3", "float4", "float2x2", "float3x3", "float4x4"],
1575
+ },
1317
1576
  },
1318
1577
  inputs: {
1319
1578
  values: {
@@ -1406,7 +1665,7 @@ const gltfToFlowGraphMapping = {
1406
1665
  blocks: ["FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
1407
1666
  inputs: {
1408
1667
  values: {
1409
- animation: { name: "index", gltfType: "number", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1668
+ animation: { name: "index", gltfType: "ref", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1410
1669
  speed: { name: "speed", gltfType: "number" },
1411
1670
  startTime: {
1412
1671
  name: "from",
@@ -1424,7 +1683,9 @@ const gltfToFlowGraphMapping = {
1424
1683
  },
1425
1684
  outputs: {
1426
1685
  flows: {
1686
+ out: { name: "out" },
1427
1687
  err: { name: "error" },
1688
+ done: { name: "done" },
1428
1689
  },
1429
1690
  },
1430
1691
  interBlockConnectors: [
@@ -1444,6 +1705,14 @@ const gltfToFlowGraphMapping = {
1444
1705
  },
1445
1706
  ],
1446
1707
  extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
1708
+ const playAnimationBlock = serializedObjects.find((block) => block.className === "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */);
1709
+ if (playAnimationBlock) {
1710
+ playAnimationBlock.config.useVirtualTimeline = true;
1711
+ }
1712
+ const arrayIndexBlock = serializedObjects.find((block) => block.className === "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */);
1713
+ if (arrayIndexBlock) {
1714
+ arrayIndexBlock.config.referenceCollection = "animations";
1715
+ }
1447
1716
  // add the glTF to the configuration of the last serialized object
1448
1717
  const serializedObject = serializedObjects[serializedObjects.length - 1];
1449
1718
  serializedObject.config || (serializedObject.config = {});
@@ -1455,11 +1724,12 @@ const gltfToFlowGraphMapping = {
1455
1724
  blocks: ["FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
1456
1725
  inputs: {
1457
1726
  values: {
1458
- animation: { name: "index", gltfType: "number", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1727
+ animation: { name: "index", gltfType: "ref", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1459
1728
  },
1460
1729
  },
1461
1730
  outputs: {
1462
1731
  flows: {
1732
+ out: { name: "out" },
1463
1733
  err: { name: "error" },
1464
1734
  },
1465
1735
  },
@@ -1480,6 +1750,14 @@ const gltfToFlowGraphMapping = {
1480
1750
  },
1481
1751
  ],
1482
1752
  extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
1753
+ const stopAnimationBlock = serializedObjects.find((block) => block.className === "FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */);
1754
+ if (stopAnimationBlock) {
1755
+ stopAnimationBlock.config.skipOnAnimationEnd = true;
1756
+ }
1757
+ const arrayIndexBlock = serializedObjects.find((block) => block.className === "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */);
1758
+ if (arrayIndexBlock) {
1759
+ arrayIndexBlock.config.referenceCollection = "animations";
1760
+ }
1483
1761
  // add the glTF to the configuration of the last serialized object
1484
1762
  const serializedObject = serializedObjects[serializedObjects.length - 1];
1485
1763
  serializedObject.config || (serializedObject.config = {});
@@ -1492,7 +1770,7 @@ const gltfToFlowGraphMapping = {
1492
1770
  configuration: {},
1493
1771
  inputs: {
1494
1772
  values: {
1495
- animation: { name: "index", gltfType: "number", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1773
+ animation: { name: "index", gltfType: "ref", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1496
1774
  stopTime: {
1497
1775
  name: "stopAtFrame",
1498
1776
  gltfType: "number",
@@ -1503,7 +1781,9 @@ const gltfToFlowGraphMapping = {
1503
1781
  },
1504
1782
  outputs: {
1505
1783
  flows: {
1784
+ out: { name: "out" },
1506
1785
  err: { name: "error" },
1786
+ done: { name: "done" },
1507
1787
  },
1508
1788
  },
1509
1789
  interBlockConnectors: [
@@ -1523,6 +1803,15 @@ const gltfToFlowGraphMapping = {
1523
1803
  },
1524
1804
  ],
1525
1805
  extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
1806
+ const stopAnimationBlock = serializedObjects.find((block) => block.className === "FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */);
1807
+ if (stopAnimationBlock) {
1808
+ stopAnimationBlock.config.useVirtualStopAt = true;
1809
+ stopAnimationBlock.config.skipOnAnimationEnd = true;
1810
+ }
1811
+ const arrayIndexBlock = serializedObjects.find((block) => block.className === "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */);
1812
+ if (arrayIndexBlock) {
1813
+ arrayIndexBlock.config.referenceCollection = "animations";
1814
+ }
1526
1815
  // add the glTF to the configuration of the last serialized object
1527
1816
  const serializedObject = serializedObjects[serializedObjects.length - 1];
1528
1817
  serializedObject.config || (serializedObject.config = {});
@@ -1533,11 +1822,27 @@ const gltfToFlowGraphMapping = {
1533
1822
  "math/switch": {
1534
1823
  blocks: ["FlowGraphDataSwitchBlock" /* FlowGraphBlockNames.DataSwitch */],
1535
1824
  configuration: {
1536
- cases: { name: "cases", isArray: true, inOptions: true, defaultValue: [] },
1825
+ cases: {
1826
+ name: "cases",
1827
+ isArray: true,
1828
+ inOptions: true,
1829
+ defaultValue: [],
1830
+ configurationType: "int[]",
1831
+ invalidUsesDefault: true,
1832
+ generatesCaseInputValueSockets: true,
1833
+ uniqueValues: true,
1834
+ },
1537
1835
  },
1538
1836
  inputs: {
1539
1837
  values: {
1540
- selection: { name: "case" },
1838
+ selection: { name: "case", gltfType: "int" },
1839
+ default: { name: "default" },
1840
+ "[case]": { name: "$1" },
1841
+ },
1842
+ },
1843
+ outputs: {
1844
+ values: {
1845
+ value: { name: "value" },
1541
1846
  },
1542
1847
  },
1543
1848
  validation(gltfBlock) {
@@ -1572,8 +1877,37 @@ const gltfToFlowGraphMapping = {
1572
1877
  },
1573
1878
  "debug/log": {
1574
1879
  blocks: ["FlowGraphConsoleLogBlock" /* FlowGraphBlockNames.ConsoleLog */],
1880
+ inputs: {
1881
+ flows: {
1882
+ in: { name: "in" },
1883
+ },
1884
+ values: {
1885
+ "[parameter]": { name: "$1" },
1886
+ },
1887
+ },
1888
+ outputs: {
1889
+ flows: {
1890
+ out: { name: "out" },
1891
+ },
1892
+ },
1575
1893
  configuration: {
1576
- message: { name: "messageTemplate", inOptions: true },
1894
+ severity: {
1895
+ name: "severity",
1896
+ configurationType: "int",
1897
+ defaultValue: 0,
1898
+ invalidUsesDefault: true,
1899
+ validationOnly: true,
1900
+ configurationGroup: "debugLog",
1901
+ },
1902
+ message: {
1903
+ name: "messageTemplate",
1904
+ configurationType: "string",
1905
+ defaultValue: "",
1906
+ invalidUsesDefault: true,
1907
+ inOptions: true,
1908
+ configurationGroup: "debugLog",
1909
+ debugLogTemplate: true,
1910
+ },
1577
1911
  },
1578
1912
  },
1579
1913
  };
@@ -1588,7 +1922,7 @@ function getSimpleInputMapping(type, inputs = ["a"], inferType) {
1588
1922
  },
1589
1923
  outputs: {
1590
1924
  values: {
1591
- value: { name: "value" },
1925
+ value: { name: "value", typeSourceInput: inputs[0] },
1592
1926
  },
1593
1927
  },
1594
1928
  extraProcessor(gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
@@ -1657,15 +1991,69 @@ function HasOddBracketRun(segment) {
1657
1991
  }
1658
1992
  return false;
1659
1993
  }
1994
+ /**
1995
+ * Parses a ratified `debug/log` message template.
1996
+ * Literal braces must be doubled; non-empty text inside a single brace pair defines a socket id.
1997
+ * @param message message template to parse
1998
+ * @returns template validity and its exact dynamic socket ids
1999
+ */
2000
+ export function ParseDebugLogTemplate(message) {
2001
+ let state = 0;
2002
+ let parameterStart = -1;
2003
+ const sockets = [];
2004
+ const seen = new Set();
2005
+ for (let index = 0; index < message.length; index++) {
2006
+ const character = message[index];
2007
+ if (character === "{") {
2008
+ if (state === 0) {
2009
+ state = 1;
2010
+ }
2011
+ else if (state === 1) {
2012
+ state = 0;
2013
+ }
2014
+ else {
2015
+ return { valid: false, sockets: [] };
2016
+ }
2017
+ }
2018
+ else if (character === "}") {
2019
+ if (state === 0) {
2020
+ state = 3;
2021
+ }
2022
+ else if (state === 3) {
2023
+ state = 0;
2024
+ }
2025
+ else if (state === 2) {
2026
+ const socket = message.substring(parameterStart + 1, index);
2027
+ if (!seen.has(socket)) {
2028
+ seen.add(socket);
2029
+ sockets.push(socket);
2030
+ }
2031
+ state = 0;
2032
+ }
2033
+ else {
2034
+ return { valid: false, sockets: [] };
2035
+ }
2036
+ }
2037
+ else if (state === 1) {
2038
+ parameterStart = index - 1;
2039
+ state = 2;
2040
+ }
2041
+ else if (state === 3) {
2042
+ return { valid: false, sockets: [] };
2043
+ }
2044
+ }
2045
+ return { valid: state === 0, sockets: state === 0 ? sockets : [] };
2046
+ }
1660
2047
  /**
1661
2048
  * Validates the `pointer` configuration value of a `pointer/*` operation, following the JSON Pointer Template
1662
2049
  * Parsing steps of the KHR_interactivity specification. A template parameter must span an entire path segment, so
1663
2050
  * a template such as `/materials/{materialRef}pbrMetallicRoughness/...` is a syntax error, and the specification
1664
2051
  * requires the whole behavior graph to be rejected.
1665
2052
  * @param gltfBlock the glTF interactivity node
2053
+ * @param reservedSocketIds input ids owned by the operation rather than template parameters
1666
2054
  * @returns the validation result
1667
2055
  */
1668
- function ValidateJsonPointerTemplate(gltfBlock) {
2056
+ function ValidateJsonPointerTemplate(gltfBlock, reservedSocketIds = new Set()) {
1669
2057
  const pointer = gltfBlock.configuration?.pointer?.value?.[0];
1670
2058
  if (typeof pointer !== "string") {
1671
2059
  return { valid: false, error: "A pointer operation requires a string `pointer` configuration value" };
@@ -1677,6 +2065,9 @@ function ValidateJsonPointerTemplate(gltfBlock) {
1677
2065
  const invalid = (reason) => ({ valid: false, error: `The JSON Pointer Template "${pointer}" is invalid: ${reason}` });
1678
2066
  const socketIds = new Set();
1679
2067
  for (const segment of pointer.split("/")) {
2068
+ if (/~(?:[^01]|$)/.test(segment)) {
2069
+ return invalid(`the path segment "${segment}" contains an invalid RFC 6901 escape`);
2070
+ }
1680
2071
  const isIntegerParameter = segment[0] === "[" && segment[1] !== "[";
1681
2072
  const isReferenceParameter = segment[0] === "{" && segment[1] !== "{";
1682
2073
  if (!isIntegerParameter && !isReferenceParameter) {
@@ -1691,6 +2082,9 @@ function ValidateJsonPointerTemplate(gltfBlock) {
1691
2082
  return invalid(`the template parameter path segment "${segment}" is malformed`);
1692
2083
  }
1693
2084
  const socketId = body.replace(/~1/g, "/").replace(/~0/g, "~");
2085
+ if (reservedSocketIds.has(socketId)) {
2086
+ return invalid(`the template parameter "${socketId}" uses a reserved input socket id`);
2087
+ }
1694
2088
  if (socketIds.has(socketId)) {
1695
2089
  return invalid(`the template parameter "${socketId}" is used more than once`);
1696
2090
  }