@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.
- package/SPLAT/gaussianSplattingStream.d.ts +79 -25
- package/SPLAT/gaussianSplattingStream.js +320 -95
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.js +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.js +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +143 -3
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +622 -99
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.d.ts +47 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js +68 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +2 -2
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js +38 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.d.ts +41 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js +63 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.d.ts +243 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.js +2335 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.d.ts +193 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js +919 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +30 -10
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +485 -54
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.d.ts +2 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js +7 -2
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js +89 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.d.ts +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +59 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +129 -77
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.types.d.ts +18 -1
- package/glTF/2.0/Extensions/KHR_interactivity.types.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +2 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +114 -56
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +2 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +80 -35
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js.map +1 -1
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js +3 -2
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js.map +1 -1
- package/glTF/2.0/Extensions/objectModelMapping.d.ts +4 -2
- package/glTF/2.0/Extensions/objectModelMapping.js +33 -4
- package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
- package/glTF/2.0/glTFLoader.pure.d.ts +3 -2
- package/glTF/2.0/glTFLoader.pure.js +50 -8
- package/glTF/2.0/glTFLoader.pure.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +2 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +9 -0
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/package.json +3 -3
|
@@ -11,40 +11,125 @@ export function getMappingForFullOperationName(fullOperationName) {
|
|
|
11
11
|
const [op, extension] = fullOperationName.split(":");
|
|
12
12
|
return getMappingForDeclaration({ op, extension });
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether a KHR operation accepts the conventional `in` flow socket when the registry
|
|
16
|
+
* does not need a renamed or dynamic input mapping.
|
|
17
|
+
* @param operation full KHR operation name
|
|
18
|
+
* @returns true when the operation accepts the conventional input flow
|
|
19
|
+
*/
|
|
20
|
+
export function HasDefaultInteractivityFlowInput(operation) {
|
|
21
|
+
if (operation === "flow/waitAll") {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return (operation.startsWith("flow/") ||
|
|
25
|
+
operation.startsWith("animation/") ||
|
|
26
|
+
operation === "pointer/set" ||
|
|
27
|
+
operation === "pointer/interpolate" ||
|
|
28
|
+
operation === "variable/set" ||
|
|
29
|
+
operation === "variable/interpolate" ||
|
|
30
|
+
operation === "event/send" ||
|
|
31
|
+
operation === "event/stopPropagation" ||
|
|
32
|
+
operation === "flow/log:BABYLON");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Normalizes serialized or runtime FlowGraph custom-event configuration for inverse comparison.
|
|
36
|
+
* @param value serialized event-data entries or the runtime event-data dictionary
|
|
37
|
+
* @returns stable event-data entries sorted by socket id
|
|
38
|
+
*/
|
|
39
|
+
export function NormalizeInteractivityEventDataConfiguration(value) {
|
|
40
|
+
const normalizeValue = (entry) => {
|
|
41
|
+
if (Array.isArray(entry)) {
|
|
42
|
+
return entry.slice();
|
|
43
|
+
}
|
|
44
|
+
if (entry !== null && typeof entry === "object") {
|
|
45
|
+
if (typeof entry.asArray === "function") {
|
|
46
|
+
return Array.from(entry.asArray());
|
|
30
47
|
}
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(entry, "value")) {
|
|
49
|
+
const nested = entry.value;
|
|
50
|
+
return Array.isArray(nested) ? nested.slice() : [nested];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [entry];
|
|
54
|
+
};
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
return value
|
|
57
|
+
.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.id === "string")
|
|
58
|
+
.map((entry) => ({
|
|
59
|
+
id: entry.id,
|
|
60
|
+
type: entry.type,
|
|
61
|
+
...(entry.value === undefined ? {} : { value: normalizeValue(entry.value) }),
|
|
62
|
+
}))
|
|
63
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
64
|
+
}
|
|
65
|
+
if (value !== null && typeof value === "object") {
|
|
66
|
+
return Object.entries(value)
|
|
67
|
+
.map(([id, entry]) => {
|
|
68
|
+
if (entry === null || typeof entry !== "object") {
|
|
69
|
+
return { id, malformed: true };
|
|
38
70
|
}
|
|
71
|
+
const definition = entry;
|
|
39
72
|
return {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
73
|
+
id,
|
|
74
|
+
type: typeof definition.type === "string" ? definition.type : definition.type?.typeName,
|
|
75
|
+
...(definition.value === undefined ? {} : { value: normalizeValue(definition.value) }),
|
|
43
76
|
};
|
|
77
|
+
})
|
|
78
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
export function getMappingForDeclaration(declaration, returnNoOpIfNotAvailable = true) {
|
|
83
|
+
const extensionMappings = declaration.extension ? _GetOwnRegistryValue(gltfExtensionsToFlowGraphMapping, declaration.extension) : undefined;
|
|
84
|
+
const mapping = declaration.extension ? _GetOwnRegistryValue(extensionMappings, declaration.op) : _GetOwnRegistryValue(gltfToFlowGraphMapping, declaration.op);
|
|
85
|
+
if (!mapping) {
|
|
86
|
+
if (returnNoOpIfNotAvailable) {
|
|
87
|
+
Logger.Warn(`No mapping found for operation ${declaration.op} and extension ${declaration.extension || "KHR_interactivity"}`);
|
|
88
|
+
return getNoOpMappingForDeclaration(declaration);
|
|
44
89
|
}
|
|
45
90
|
}
|
|
46
91
|
return mapping;
|
|
47
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates the typed no-op mapping required for an unsupported extension declaration.
|
|
95
|
+
* @param declaration unsupported extension declaration
|
|
96
|
+
* @returns a mapping that preserves the declared value sockets
|
|
97
|
+
*/
|
|
98
|
+
export function getNoOpMappingForDeclaration(declaration) {
|
|
99
|
+
const inputs = {};
|
|
100
|
+
const outputs = {
|
|
101
|
+
flows: {},
|
|
102
|
+
};
|
|
103
|
+
if (declaration.inputValueSockets) {
|
|
104
|
+
inputs.values = Object.create(null);
|
|
105
|
+
for (const key in declaration.inputValueSockets) {
|
|
106
|
+
if (Object.prototype.hasOwnProperty.call(declaration.inputValueSockets, key)) {
|
|
107
|
+
Object.defineProperty(inputs.values, key, {
|
|
108
|
+
configurable: true,
|
|
109
|
+
enumerable: true,
|
|
110
|
+
value: { name: key },
|
|
111
|
+
writable: true,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (declaration.outputValueSockets) {
|
|
117
|
+
outputs.values = Object.create(null);
|
|
118
|
+
Object.keys(declaration.outputValueSockets).forEach((key) => {
|
|
119
|
+
Object.defineProperty(outputs.values, key, {
|
|
120
|
+
configurable: true,
|
|
121
|
+
enumerable: true,
|
|
122
|
+
value: { name: key },
|
|
123
|
+
writable: true,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
blocks: [],
|
|
129
|
+
inputs,
|
|
130
|
+
outputs,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
48
133
|
/**
|
|
49
134
|
* This function will add new mapping to glTF interactivity.
|
|
50
135
|
* Other extensions can define new types of blocks, this is the way to let interactivity know how to parse them.
|
|
@@ -53,8 +138,47 @@ export function getMappingForDeclaration(declaration, returnNoOpIfNotAvailable =
|
|
|
53
138
|
* @param mapping The mapping object. See documentation or examples below.
|
|
54
139
|
*/
|
|
55
140
|
export function addNewInteractivityFlowGraphMapping(key, extension, mapping) {
|
|
56
|
-
|
|
57
|
-
|
|
141
|
+
let extensionMappings = _GetOwnRegistryValue(gltfExtensionsToFlowGraphMapping, extension);
|
|
142
|
+
if (!extensionMappings) {
|
|
143
|
+
extensionMappings = Object.create(null);
|
|
144
|
+
Object.defineProperty(gltfExtensionsToFlowGraphMapping, extension, {
|
|
145
|
+
configurable: true,
|
|
146
|
+
enumerable: true,
|
|
147
|
+
value: extensionMappings,
|
|
148
|
+
writable: true,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
Object.defineProperty(extensionMappings, key, {
|
|
152
|
+
configurable: true,
|
|
153
|
+
enumerable: true,
|
|
154
|
+
value: mapping,
|
|
155
|
+
writable: true,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function _GetOwnRegistryValue(registry, key) {
|
|
159
|
+
return registry && Object.prototype.hasOwnProperty.call(registry, key) ? registry[key] : undefined;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets a deterministic snapshot of the registered KHR_interactivity operation mappings.
|
|
163
|
+
* Export analysis uses this same registry as import lowering so the two directions cannot
|
|
164
|
+
* independently drift.
|
|
165
|
+
* @returns registered mappings sorted by extension and operation
|
|
166
|
+
*/
|
|
167
|
+
export function GetInteractivityOperationRegistry() {
|
|
168
|
+
const entries = Object.keys(gltfToFlowGraphMapping).map((op) => ({
|
|
169
|
+
op,
|
|
170
|
+
mapping: gltfToFlowGraphMapping[op],
|
|
171
|
+
}));
|
|
172
|
+
for (const extension of Object.keys(gltfExtensionsToFlowGraphMapping).sort()) {
|
|
173
|
+
for (const op of Object.keys(gltfExtensionsToFlowGraphMapping[extension]).sort()) {
|
|
174
|
+
entries.push({
|
|
175
|
+
op,
|
|
176
|
+
extension,
|
|
177
|
+
mapping: gltfExtensionsToFlowGraphMapping[extension][op],
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return entries.sort((left, right) => `${left.extension ?? ""}:${left.op}`.localeCompare(`${right.extension ?? ""}:${right.op}`));
|
|
58
182
|
}
|
|
59
183
|
const gltfExtensionsToFlowGraphMapping = {
|
|
60
184
|
/**
|
|
@@ -74,6 +198,12 @@ const gltfExtensionsToFlowGraphMapping = {
|
|
|
74
198
|
inputs: {
|
|
75
199
|
values: {
|
|
76
200
|
message: { name: "message" },
|
|
201
|
+
"[segment]": { name: "$1", compatibilityOnly: true },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
outputs: {
|
|
205
|
+
flows: {
|
|
206
|
+
out: { name: "out", compatibilityOnly: true },
|
|
77
207
|
},
|
|
78
208
|
},
|
|
79
209
|
},
|
|
@@ -98,6 +228,7 @@ const gltfToFlowGraphMapping = {
|
|
|
98
228
|
inputs: {},
|
|
99
229
|
outputs: {
|
|
100
230
|
values: {
|
|
231
|
+
timeSinceStart: { name: "timeSinceStart", gltfType: "number" },
|
|
101
232
|
timeSinceLastTick: { name: "deltaTime", gltfType: "number" /*, dataTransformer: (time: number) => time / 1000*/ },
|
|
102
233
|
// KHR_interactivity `ref event` output (the event reference).
|
|
103
234
|
event: { name: "event" },
|
|
@@ -109,11 +240,30 @@ const gltfToFlowGraphMapping = {
|
|
|
109
240
|
},
|
|
110
241
|
"event/send": {
|
|
111
242
|
blocks: ["FlowGraphSendCustomEventBlock" /* FlowGraphBlockNames.SendCustomEvent */],
|
|
243
|
+
configuration: {
|
|
244
|
+
event: {
|
|
245
|
+
name: "eventId",
|
|
246
|
+
configurationType: "int",
|
|
247
|
+
required: true,
|
|
248
|
+
indexSource: "events",
|
|
249
|
+
validationOnly: true,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
inputs: {
|
|
253
|
+
values: {
|
|
254
|
+
"[segment]": { name: "$1" },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
outputs: {
|
|
258
|
+
flows: {
|
|
259
|
+
out: { name: "out" },
|
|
260
|
+
},
|
|
261
|
+
},
|
|
112
262
|
extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
|
|
113
263
|
// set eventId and eventData. The configuration object of the glTF should have a single object.
|
|
114
264
|
// validate that we are running it on the right block.
|
|
115
|
-
if (declaration.op !== "event/send" || !gltfBlock.configuration
|
|
116
|
-
throw new Error("
|
|
265
|
+
if (declaration.op !== "event/send" || !gltfBlock.configuration?.event) {
|
|
266
|
+
throw new Error("Send event should have a single configuration object, the event itself");
|
|
117
267
|
}
|
|
118
268
|
const eventConfiguration = gltfBlock.configuration["event"];
|
|
119
269
|
const eventId = eventConfiguration.value?.[0];
|
|
@@ -130,10 +280,20 @@ const gltfToFlowGraphMapping = {
|
|
|
130
280
|
},
|
|
131
281
|
"event/receive": {
|
|
132
282
|
blocks: ["FlowGraphReceiveCustomEventBlock" /* FlowGraphBlockNames.ReceiveCustomEvent */],
|
|
283
|
+
configuration: {
|
|
284
|
+
event: {
|
|
285
|
+
name: "eventId",
|
|
286
|
+
configurationType: "int",
|
|
287
|
+
required: true,
|
|
288
|
+
indexSource: "events",
|
|
289
|
+
validationOnly: true,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
133
292
|
outputs: {
|
|
134
293
|
values: {
|
|
135
294
|
// KHR_interactivity `ref event` output (the event reference).
|
|
136
295
|
event: { name: "event" },
|
|
296
|
+
"[segment]": { name: "$1" },
|
|
137
297
|
},
|
|
138
298
|
flows: {
|
|
139
299
|
out: { name: "done" },
|
|
@@ -164,7 +324,7 @@ const gltfToFlowGraphMapping = {
|
|
|
164
324
|
extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
|
|
165
325
|
// set eventId and eventData. The configuration object of the glTF should have a single object.
|
|
166
326
|
// validate that we are running it on the right block.
|
|
167
|
-
if (declaration.op !== "event/receive" || !gltfBlock.configuration
|
|
327
|
+
if (declaration.op !== "event/receive" || !gltfBlock.configuration?.event) {
|
|
168
328
|
throw new Error("Receive event should have a single configuration object, the event itself");
|
|
169
329
|
}
|
|
170
330
|
const eventConfiguration = gltfBlock.configuration["event"];
|
|
@@ -197,11 +357,11 @@ const gltfToFlowGraphMapping = {
|
|
|
197
357
|
},
|
|
198
358
|
},
|
|
199
359
|
},
|
|
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
|
|
360
|
+
"math/E": getSimpleInputMapping("FlowGraphEBlock" /* FlowGraphBlockNames.E */, []),
|
|
361
|
+
"math/Pi": getSimpleInputMapping("FlowGraphPIBlock" /* FlowGraphBlockNames.PI */, []),
|
|
362
|
+
"math/Tau": getSimpleInputMapping("FlowGraphTauBlock" /* FlowGraphBlockNames.Tau */, []),
|
|
363
|
+
"math/Inf": getSimpleInputMapping("FlowGraphInfBlock" /* FlowGraphBlockNames.Inf */, []),
|
|
364
|
+
"math/NaN": getSimpleInputMapping("FlowGraphNaNBlock" /* FlowGraphBlockNames.NaN */, []),
|
|
205
365
|
"math/abs": getSimpleInputMapping("FlowGraphAbsBlock" /* FlowGraphBlockNames.Abs */),
|
|
206
366
|
"math/sign": getSimpleInputMapping("FlowGraphSignBlock" /* FlowGraphBlockNames.Sign */),
|
|
207
367
|
"math/trunc": getSimpleInputMapping("FlowGraphTruncBlock" /* FlowGraphBlockNames.Trunc */),
|
|
@@ -217,7 +377,7 @@ const gltfToFlowGraphMapping = {
|
|
|
217
377
|
},
|
|
218
378
|
outputs: {
|
|
219
379
|
values: {
|
|
220
|
-
value: { name: "value" },
|
|
380
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
221
381
|
},
|
|
222
382
|
},
|
|
223
383
|
extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
|
|
@@ -234,6 +394,17 @@ const gltfToFlowGraphMapping = {
|
|
|
234
394
|
"math/sub": getSimpleInputMapping("FlowGraphSubtractBlock" /* FlowGraphBlockNames.Subtract */, ["a", "b"], true),
|
|
235
395
|
"math/mul": {
|
|
236
396
|
blocks: ["FlowGraphMultiplyBlock" /* FlowGraphBlockNames.Multiply */],
|
|
397
|
+
inputs: {
|
|
398
|
+
values: {
|
|
399
|
+
a: { name: "a" },
|
|
400
|
+
b: { name: "b" },
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
outputs: {
|
|
404
|
+
values: {
|
|
405
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
406
|
+
},
|
|
407
|
+
},
|
|
237
408
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
|
|
238
409
|
var _a;
|
|
239
410
|
// configure it to work the way glTF specifies
|
|
@@ -339,7 +510,7 @@ const gltfToFlowGraphMapping = {
|
|
|
339
510
|
},
|
|
340
511
|
outputs: {
|
|
341
512
|
values: {
|
|
342
|
-
value: { name: "output" },
|
|
513
|
+
value: { name: "output", typeSourceInput: "a" },
|
|
343
514
|
},
|
|
344
515
|
},
|
|
345
516
|
},
|
|
@@ -347,7 +518,7 @@ const gltfToFlowGraphMapping = {
|
|
|
347
518
|
blocks: ["FlowGraphRandomBlock" /* FlowGraphBlockNames.Random */],
|
|
348
519
|
outputs: {
|
|
349
520
|
values: {
|
|
350
|
-
value: { name: "value" },
|
|
521
|
+
value: { name: "value", gltfType: "float" },
|
|
351
522
|
},
|
|
352
523
|
},
|
|
353
524
|
},
|
|
@@ -372,7 +543,15 @@ const gltfToFlowGraphMapping = {
|
|
|
372
543
|
"math/cbrt": getSimpleInputMapping("FlowGraphCubeRootBlock" /* FlowGraphBlockNames.CubeRoot */),
|
|
373
544
|
"math/pow": getSimpleInputMapping("FlowGraphPowerBlock" /* FlowGraphBlockNames.Power */, ["a", "b"]),
|
|
374
545
|
"math/length": getSimpleInputMapping("FlowGraphLengthBlock" /* FlowGraphBlockNames.Length */),
|
|
375
|
-
"math/normalize":
|
|
546
|
+
"math/normalize": {
|
|
547
|
+
...getSimpleInputMapping("FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */),
|
|
548
|
+
outputs: {
|
|
549
|
+
values: {
|
|
550
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
551
|
+
isValid: { name: "isValid", gltfType: "bool" },
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
},
|
|
376
555
|
"math/dot": getSimpleInputMapping("FlowGraphDotBlock" /* FlowGraphBlockNames.Dot */, ["a", "b"]),
|
|
377
556
|
"math/cross": getSimpleInputMapping("FlowGraphCrossBlock" /* FlowGraphBlockNames.Cross */, ["a", "b"]),
|
|
378
557
|
"math/rotate2D": {
|
|
@@ -385,7 +564,7 @@ const gltfToFlowGraphMapping = {
|
|
|
385
564
|
},
|
|
386
565
|
outputs: {
|
|
387
566
|
values: {
|
|
388
|
-
value: { name: "value" },
|
|
567
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
389
568
|
},
|
|
390
569
|
},
|
|
391
570
|
},
|
|
@@ -399,7 +578,7 @@ const gltfToFlowGraphMapping = {
|
|
|
399
578
|
},
|
|
400
579
|
outputs: {
|
|
401
580
|
values: {
|
|
402
|
-
value: { name: "value" },
|
|
581
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
403
582
|
},
|
|
404
583
|
},
|
|
405
584
|
},
|
|
@@ -414,7 +593,7 @@ const gltfToFlowGraphMapping = {
|
|
|
414
593
|
},
|
|
415
594
|
outputs: {
|
|
416
595
|
values: {
|
|
417
|
-
value: { name: "value" },
|
|
596
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
418
597
|
},
|
|
419
598
|
},
|
|
420
599
|
},
|
|
@@ -428,7 +607,7 @@ const gltfToFlowGraphMapping = {
|
|
|
428
607
|
},
|
|
429
608
|
outputs: {
|
|
430
609
|
values: {
|
|
431
|
-
value: { name: "value" },
|
|
610
|
+
value: { name: "value", gltfType: "float2" },
|
|
432
611
|
},
|
|
433
612
|
},
|
|
434
613
|
},
|
|
@@ -443,7 +622,7 @@ const gltfToFlowGraphMapping = {
|
|
|
443
622
|
},
|
|
444
623
|
outputs: {
|
|
445
624
|
values: {
|
|
446
|
-
value: { name: "value" },
|
|
625
|
+
value: { name: "value", gltfType: "float3" },
|
|
447
626
|
},
|
|
448
627
|
},
|
|
449
628
|
},
|
|
@@ -459,7 +638,7 @@ const gltfToFlowGraphMapping = {
|
|
|
459
638
|
},
|
|
460
639
|
outputs: {
|
|
461
640
|
values: {
|
|
462
|
-
value: { name: "value" },
|
|
641
|
+
value: { name: "value", gltfType: "float4" },
|
|
463
642
|
},
|
|
464
643
|
},
|
|
465
644
|
},
|
|
@@ -511,7 +690,15 @@ const gltfToFlowGraphMapping = {
|
|
|
511
690
|
},
|
|
512
691
|
"math/transpose": getSimpleInputMapping("FlowGraphTransposeBlock" /* FlowGraphBlockNames.Transpose */),
|
|
513
692
|
"math/determinant": getSimpleInputMapping("FlowGraphDeterminantBlock" /* FlowGraphBlockNames.Determinant */),
|
|
514
|
-
"math/inverse":
|
|
693
|
+
"math/inverse": {
|
|
694
|
+
...getSimpleInputMapping("FlowGraphInvertMatrixBlock" /* FlowGraphBlockNames.InvertMatrix */),
|
|
695
|
+
outputs: {
|
|
696
|
+
values: {
|
|
697
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
698
|
+
isValid: { name: "isValid", gltfType: "bool" },
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
},
|
|
515
702
|
"math/matMul": getSimpleInputMapping("FlowGraphMatrixMultiplicationBlock" /* FlowGraphBlockNames.MatrixMultiplication */, ["a", "b"]),
|
|
516
703
|
"math/matCompose": {
|
|
517
704
|
blocks: ["FlowGraphMatrixCompose" /* FlowGraphBlockNames.MatrixCompose */],
|
|
@@ -524,7 +711,7 @@ const gltfToFlowGraphMapping = {
|
|
|
524
711
|
},
|
|
525
712
|
outputs: {
|
|
526
713
|
values: {
|
|
527
|
-
value: { name: "value" },
|
|
714
|
+
value: { name: "value", gltfType: "float4x4" },
|
|
528
715
|
},
|
|
529
716
|
},
|
|
530
717
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
|
|
@@ -552,6 +739,8 @@ const gltfToFlowGraphMapping = {
|
|
|
552
739
|
translation: { name: "position" },
|
|
553
740
|
rotation: { name: "rotationQuaternion" },
|
|
554
741
|
scale: { name: "scaling" },
|
|
742
|
+
scaling: { name: "scaling", compatibilityOnly: true },
|
|
743
|
+
isValid: { name: "isValid", compatibilityOnly: true },
|
|
555
744
|
},
|
|
556
745
|
},
|
|
557
746
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
|
|
@@ -570,13 +759,13 @@ const gltfToFlowGraphMapping = {
|
|
|
570
759
|
blocks: ["FlowGraphMultiplyBlock" /* FlowGraphBlockNames.Multiply */],
|
|
571
760
|
inputs: {
|
|
572
761
|
values: {
|
|
573
|
-
a: { name: "a", gltfType: "
|
|
574
|
-
b: { name: "b", gltfType: "
|
|
762
|
+
a: { name: "a", gltfType: "float4" },
|
|
763
|
+
b: { name: "b", gltfType: "float4" },
|
|
575
764
|
},
|
|
576
765
|
},
|
|
577
766
|
outputs: {
|
|
578
767
|
values: {
|
|
579
|
-
value: { name: "value" },
|
|
768
|
+
value: { name: "value", gltfType: "float4" },
|
|
580
769
|
},
|
|
581
770
|
},
|
|
582
771
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
|
|
@@ -597,12 +786,32 @@ const gltfToFlowGraphMapping = {
|
|
|
597
786
|
},
|
|
598
787
|
outputs: {
|
|
599
788
|
values: {
|
|
600
|
-
value: { name: "value" },
|
|
789
|
+
value: { name: "value", gltfType: "float4" },
|
|
790
|
+
},
|
|
791
|
+
},
|
|
792
|
+
},
|
|
793
|
+
"math/quatToAxisAngle": {
|
|
794
|
+
blocks: ["FlowGraphAxisAngleFromQuaternionBlock" /* FlowGraphBlockNames.AxisAngleFromQuaternion */],
|
|
795
|
+
inputs: {
|
|
796
|
+
values: {
|
|
797
|
+
a: { name: "a", gltfType: "float4" },
|
|
798
|
+
},
|
|
799
|
+
},
|
|
800
|
+
outputs: {
|
|
801
|
+
values: {
|
|
802
|
+
axis: { name: "axis", gltfType: "float3" },
|
|
803
|
+
angle: { name: "angle", gltfType: "float" },
|
|
804
|
+
},
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
"math/quatFromDirections": {
|
|
808
|
+
...getSimpleInputMapping("FlowGraphQuaternionFromDirectionsBlock" /* FlowGraphBlockNames.QuaternionFromDirections */, ["a", "b"]),
|
|
809
|
+
outputs: {
|
|
810
|
+
values: {
|
|
811
|
+
value: { name: "value", gltfType: "float4" },
|
|
601
812
|
},
|
|
602
813
|
},
|
|
603
814
|
},
|
|
604
|
-
"math/quatToAxisAngle": getSimpleInputMapping("FlowGraphAxisAngleFromQuaternionBlock" /* FlowGraphBlockNames.AxisAngleFromQuaternion */, ["a"]),
|
|
605
|
-
"math/quatFromDirections": getSimpleInputMapping("FlowGraphQuaternionFromDirectionsBlock" /* FlowGraphBlockNames.QuaternionFromDirections */, ["a", "b"]),
|
|
606
815
|
"math/quatFromUpForward": {
|
|
607
816
|
blocks: ["FlowGraphQuaternionFromUpForwardBlock" /* FlowGraphBlockNames.QuaternionFromUpForward */],
|
|
608
817
|
inputs: {
|
|
@@ -613,7 +822,7 @@ const gltfToFlowGraphMapping = {
|
|
|
613
822
|
},
|
|
614
823
|
outputs: {
|
|
615
824
|
values: {
|
|
616
|
-
value: { name: "value" },
|
|
825
|
+
value: { name: "value", gltfType: "float4" },
|
|
617
826
|
},
|
|
618
827
|
},
|
|
619
828
|
},
|
|
@@ -622,7 +831,13 @@ const gltfToFlowGraphMapping = {
|
|
|
622
831
|
"math/quatFromAngles": {
|
|
623
832
|
blocks: ["FlowGraphQuaternionFromAnglesBlock" /* FlowGraphBlockNames.QuaternionFromAngles */],
|
|
624
833
|
configuration: {
|
|
625
|
-
order: {
|
|
834
|
+
order: {
|
|
835
|
+
name: "order",
|
|
836
|
+
defaultValue: ["yxz"],
|
|
837
|
+
configurationType: "string",
|
|
838
|
+
invalidUsesDefault: true,
|
|
839
|
+
allowedValues: ["xyz", "xzy", "yxz", "yzx", "zxy", "zyx"],
|
|
840
|
+
},
|
|
626
841
|
},
|
|
627
842
|
inputs: {
|
|
628
843
|
values: {
|
|
@@ -633,7 +848,7 @@ const gltfToFlowGraphMapping = {
|
|
|
633
848
|
},
|
|
634
849
|
outputs: {
|
|
635
850
|
values: {
|
|
636
|
-
value: { name: "value" },
|
|
851
|
+
value: { name: "value", gltfType: "float4" },
|
|
637
852
|
},
|
|
638
853
|
},
|
|
639
854
|
},
|
|
@@ -649,7 +864,7 @@ const gltfToFlowGraphMapping = {
|
|
|
649
864
|
},
|
|
650
865
|
outputs: {
|
|
651
866
|
values: {
|
|
652
|
-
value: { name: "value" },
|
|
867
|
+
value: { name: "value", gltfType: "float2x2" },
|
|
653
868
|
},
|
|
654
869
|
},
|
|
655
870
|
},
|
|
@@ -686,7 +901,7 @@ const gltfToFlowGraphMapping = {
|
|
|
686
901
|
},
|
|
687
902
|
outputs: {
|
|
688
903
|
values: {
|
|
689
|
-
value: { name: "value" },
|
|
904
|
+
value: { name: "value", gltfType: "float3x3" },
|
|
690
905
|
},
|
|
691
906
|
},
|
|
692
907
|
},
|
|
@@ -735,7 +950,7 @@ const gltfToFlowGraphMapping = {
|
|
|
735
950
|
},
|
|
736
951
|
outputs: {
|
|
737
952
|
values: {
|
|
738
|
-
value: { name: "value" },
|
|
953
|
+
value: { name: "value", gltfType: "float4x4" },
|
|
739
954
|
},
|
|
740
955
|
},
|
|
741
956
|
},
|
|
@@ -777,7 +992,7 @@ const gltfToFlowGraphMapping = {
|
|
|
777
992
|
},
|
|
778
993
|
outputs: {
|
|
779
994
|
values: {
|
|
780
|
-
value: { name: "value" },
|
|
995
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
781
996
|
},
|
|
782
997
|
},
|
|
783
998
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
|
|
@@ -800,7 +1015,7 @@ const gltfToFlowGraphMapping = {
|
|
|
800
1015
|
},
|
|
801
1016
|
outputs: {
|
|
802
1017
|
values: {
|
|
803
|
-
value: { name: "value" },
|
|
1018
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
804
1019
|
},
|
|
805
1020
|
},
|
|
806
1021
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
|
|
@@ -825,7 +1040,7 @@ const gltfToFlowGraphMapping = {
|
|
|
825
1040
|
},
|
|
826
1041
|
outputs: {
|
|
827
1042
|
values: {
|
|
828
|
-
value: { name: "value" },
|
|
1043
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
829
1044
|
},
|
|
830
1045
|
},
|
|
831
1046
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
|
|
@@ -850,7 +1065,7 @@ const gltfToFlowGraphMapping = {
|
|
|
850
1065
|
},
|
|
851
1066
|
outputs: {
|
|
852
1067
|
values: {
|
|
853
|
-
value: { name: "value" },
|
|
1068
|
+
value: { name: "value", typeSourceInput: "a" },
|
|
854
1069
|
},
|
|
855
1070
|
},
|
|
856
1071
|
extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
|
|
@@ -881,6 +1096,11 @@ const gltfToFlowGraphMapping = {
|
|
|
881
1096
|
// flows
|
|
882
1097
|
"flow/sequence": {
|
|
883
1098
|
blocks: ["FlowGraphSequenceBlock" /* FlowGraphBlockNames.Sequence */],
|
|
1099
|
+
outputs: {
|
|
1100
|
+
flows: {
|
|
1101
|
+
"[segment]": { name: "$1" },
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
884
1104
|
extraProcessor(gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
|
|
885
1105
|
const serializedObject = serializedObjects[0];
|
|
886
1106
|
serializedObject.config || (serializedObject.config = {});
|
|
@@ -893,6 +1113,11 @@ const gltfToFlowGraphMapping = {
|
|
|
893
1113
|
},
|
|
894
1114
|
"flow/branch": {
|
|
895
1115
|
blocks: ["FlowGraphBranchBlock" /* FlowGraphBlockNames.Branch */],
|
|
1116
|
+
inputs: {
|
|
1117
|
+
values: {
|
|
1118
|
+
condition: { name: "condition", gltfType: "boolean" },
|
|
1119
|
+
},
|
|
1120
|
+
},
|
|
896
1121
|
outputs: {
|
|
897
1122
|
flows: {
|
|
898
1123
|
true: { name: "onTrue" },
|
|
@@ -903,7 +1128,16 @@ const gltfToFlowGraphMapping = {
|
|
|
903
1128
|
"flow/switch": {
|
|
904
1129
|
blocks: ["FlowGraphSwitchBlock" /* FlowGraphBlockNames.Switch */],
|
|
905
1130
|
configuration: {
|
|
906
|
-
cases: {
|
|
1131
|
+
cases: {
|
|
1132
|
+
name: "cases",
|
|
1133
|
+
isArray: true,
|
|
1134
|
+
inOptions: true,
|
|
1135
|
+
defaultValue: [],
|
|
1136
|
+
configurationType: "int[]",
|
|
1137
|
+
invalidUsesDefault: true,
|
|
1138
|
+
generatesOutputFlowSockets: true,
|
|
1139
|
+
uniqueValues: true,
|
|
1140
|
+
},
|
|
907
1141
|
},
|
|
908
1142
|
inputs: {
|
|
909
1143
|
values: {
|
|
@@ -911,13 +1145,16 @@ const gltfToFlowGraphMapping = {
|
|
|
911
1145
|
default: { name: "default" },
|
|
912
1146
|
},
|
|
913
1147
|
},
|
|
1148
|
+
outputs: {
|
|
1149
|
+
flows: {
|
|
1150
|
+
default: { name: "default" },
|
|
1151
|
+
"[segment]": { name: "$1" },
|
|
1152
|
+
},
|
|
1153
|
+
},
|
|
914
1154
|
validation(gltfBlock) {
|
|
915
1155
|
const cases = gltfBlock.configuration?.cases;
|
|
916
1156
|
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
|
-
});
|
|
1157
|
+
const onlyIntegers = cases.value.every((caseValue) => typeof caseValue === "number" && Number.isInteger(caseValue) && caseValue >= -2147483648 && caseValue <= 2147483647);
|
|
921
1158
|
if (!onlyIntegers) {
|
|
922
1159
|
Logger.Warn("Switch cases should be integers. Using empty array instead.");
|
|
923
1160
|
cases.value = [];
|
|
@@ -945,21 +1182,34 @@ const gltfToFlowGraphMapping = {
|
|
|
945
1182
|
},
|
|
946
1183
|
"flow/while": {
|
|
947
1184
|
blocks: ["FlowGraphWhileLoopBlock" /* FlowGraphBlockNames.WhileLoop */],
|
|
1185
|
+
inputs: {
|
|
1186
|
+
values: {
|
|
1187
|
+
condition: { name: "condition", gltfType: "boolean" },
|
|
1188
|
+
},
|
|
1189
|
+
},
|
|
948
1190
|
outputs: {
|
|
949
1191
|
flows: {
|
|
950
1192
|
loopBody: { name: "executionFlow" },
|
|
1193
|
+
completed: { name: "completed" },
|
|
951
1194
|
},
|
|
952
1195
|
},
|
|
953
1196
|
},
|
|
954
1197
|
"flow/for": {
|
|
955
1198
|
blocks: ["FlowGraphForLoopBlock" /* FlowGraphBlockNames.ForLoop */],
|
|
956
1199
|
configuration: {
|
|
957
|
-
initialIndex: {
|
|
1200
|
+
initialIndex: {
|
|
1201
|
+
name: "initialIndex",
|
|
1202
|
+
gltfType: "int",
|
|
1203
|
+
inOptions: true,
|
|
1204
|
+
defaultValue: 0,
|
|
1205
|
+
configurationType: "int",
|
|
1206
|
+
invalidUsesDefault: true,
|
|
1207
|
+
},
|
|
958
1208
|
},
|
|
959
1209
|
inputs: {
|
|
960
1210
|
values: {
|
|
961
|
-
startIndex: { name: "startIndex", gltfType: "
|
|
962
|
-
endIndex: { name: "endIndex", gltfType: "
|
|
1211
|
+
startIndex: { name: "startIndex", gltfType: "int" },
|
|
1212
|
+
endIndex: { name: "endIndex", gltfType: "int" },
|
|
963
1213
|
},
|
|
964
1214
|
},
|
|
965
1215
|
outputs: {
|
|
@@ -968,6 +1218,7 @@ const gltfToFlowGraphMapping = {
|
|
|
968
1218
|
},
|
|
969
1219
|
flows: {
|
|
970
1220
|
loopBody: { name: "executionFlow" },
|
|
1221
|
+
completed: { name: "completed" },
|
|
971
1222
|
},
|
|
972
1223
|
},
|
|
973
1224
|
extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
|
|
@@ -987,10 +1238,16 @@ const gltfToFlowGraphMapping = {
|
|
|
987
1238
|
configuration: {},
|
|
988
1239
|
inputs: {
|
|
989
1240
|
values: {
|
|
990
|
-
n: { name: "maxExecutions", gltfType: "
|
|
1241
|
+
n: { name: "maxExecutions", gltfType: "int" },
|
|
1242
|
+
},
|
|
1243
|
+
flows: {
|
|
1244
|
+
reset: { name: "reset" },
|
|
991
1245
|
},
|
|
992
1246
|
},
|
|
993
1247
|
outputs: {
|
|
1248
|
+
flows: {
|
|
1249
|
+
out: { name: "out" },
|
|
1250
|
+
},
|
|
994
1251
|
values: {
|
|
995
1252
|
currentCount: { name: "executionCount" },
|
|
996
1253
|
},
|
|
@@ -998,17 +1255,46 @@ const gltfToFlowGraphMapping = {
|
|
|
998
1255
|
},
|
|
999
1256
|
"flow/multiGate": {
|
|
1000
1257
|
blocks: ["FlowGraphMultiGateBlock" /* FlowGraphBlockNames.MultiGate */],
|
|
1258
|
+
inputs: {
|
|
1259
|
+
flows: {
|
|
1260
|
+
reset: { name: "reset" },
|
|
1261
|
+
},
|
|
1262
|
+
},
|
|
1001
1263
|
configuration: {
|
|
1002
|
-
isRandom: {
|
|
1003
|
-
|
|
1264
|
+
isRandom: {
|
|
1265
|
+
name: "isRandom",
|
|
1266
|
+
gltfType: "boolean",
|
|
1267
|
+
inOptions: true,
|
|
1268
|
+
defaultValue: false,
|
|
1269
|
+
configurationType: "bool",
|
|
1270
|
+
invalidUsesDefault: true,
|
|
1271
|
+
configurationGroup: "multiGate",
|
|
1272
|
+
},
|
|
1273
|
+
isLoop: {
|
|
1274
|
+
name: "isLoop",
|
|
1275
|
+
gltfType: "boolean",
|
|
1276
|
+
inOptions: true,
|
|
1277
|
+
defaultValue: false,
|
|
1278
|
+
configurationType: "bool",
|
|
1279
|
+
invalidUsesDefault: true,
|
|
1280
|
+
configurationGroup: "multiGate",
|
|
1281
|
+
},
|
|
1282
|
+
},
|
|
1283
|
+
outputs: {
|
|
1284
|
+
flows: {
|
|
1285
|
+
"[segment]": { name: "$1" },
|
|
1286
|
+
},
|
|
1287
|
+
values: {
|
|
1288
|
+
lastIndex: { name: "lastIndex", gltfType: "int" },
|
|
1289
|
+
},
|
|
1004
1290
|
},
|
|
1005
1291
|
extraProcessor(gltfBlock, declaration, _mapping, _arrays, serializedObjects) {
|
|
1006
|
-
if (declaration.op !== "flow/multiGate"
|
|
1007
|
-
throw new Error("
|
|
1292
|
+
if (declaration.op !== "flow/multiGate") {
|
|
1293
|
+
throw new Error("Invalid operation for MultiGate mapping");
|
|
1008
1294
|
}
|
|
1009
1295
|
const serializedObject = serializedObjects[0];
|
|
1010
1296
|
serializedObject.config || (serializedObject.config = {});
|
|
1011
|
-
serializedObject.config.outputSignalCount = Object.keys(gltfBlock.flows).length;
|
|
1297
|
+
serializedObject.config.outputSignalCount = Object.keys(gltfBlock.flows ?? {}).length;
|
|
1012
1298
|
serializedObject.signalOutputs.forEach((output, index) => {
|
|
1013
1299
|
output.name = "out_" + index;
|
|
1014
1300
|
});
|
|
@@ -1018,7 +1304,17 @@ const gltfToFlowGraphMapping = {
|
|
|
1018
1304
|
"flow/waitAll": {
|
|
1019
1305
|
blocks: ["FlowGraphWaitAllBlock" /* FlowGraphBlockNames.WaitAll */],
|
|
1020
1306
|
configuration: {
|
|
1021
|
-
inputFlows: {
|
|
1307
|
+
inputFlows: {
|
|
1308
|
+
name: "inputSignalCount",
|
|
1309
|
+
gltfType: "number",
|
|
1310
|
+
inOptions: true,
|
|
1311
|
+
defaultValue: [0],
|
|
1312
|
+
configurationType: "int",
|
|
1313
|
+
invalidUsesDefault: true,
|
|
1314
|
+
minimum: 0,
|
|
1315
|
+
maximum: 64,
|
|
1316
|
+
generatesInputFlowSockets: true,
|
|
1317
|
+
},
|
|
1022
1318
|
},
|
|
1023
1319
|
inputs: {
|
|
1024
1320
|
flows: {
|
|
@@ -1026,9 +1322,19 @@ const gltfToFlowGraphMapping = {
|
|
|
1026
1322
|
"[segment]": { name: "in_$1" },
|
|
1027
1323
|
},
|
|
1028
1324
|
},
|
|
1325
|
+
outputs: {
|
|
1326
|
+
flows: {
|
|
1327
|
+
out: { name: "out" },
|
|
1328
|
+
completed: { name: "completed" },
|
|
1329
|
+
},
|
|
1330
|
+
values: {
|
|
1331
|
+
remainingInputs: { name: "remainingInputs", gltfType: "int" },
|
|
1332
|
+
},
|
|
1333
|
+
},
|
|
1029
1334
|
validation(gltfBlock) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1335
|
+
const inputFlowsConfiguration = gltfBlock.configuration?.inputFlows?.value;
|
|
1336
|
+
const inputFlows = inputFlowsConfiguration?.[0];
|
|
1337
|
+
if (inputFlowsConfiguration?.length !== 1 || typeof inputFlows !== "number" || !Number.isInteger(inputFlows) || inputFlows < 0 || inputFlows > 64) {
|
|
1032
1338
|
gltfBlock.configuration = gltfBlock.configuration || {
|
|
1033
1339
|
inputFlows: { value: [0] },
|
|
1034
1340
|
};
|
|
@@ -1039,22 +1345,45 @@ const gltfToFlowGraphMapping = {
|
|
|
1039
1345
|
},
|
|
1040
1346
|
"flow/throttle": {
|
|
1041
1347
|
blocks: ["FlowGraphThrottleBlock" /* FlowGraphBlockNames.Throttle */],
|
|
1348
|
+
inputs: {
|
|
1349
|
+
values: {
|
|
1350
|
+
duration: { name: "duration", gltfType: "number" },
|
|
1351
|
+
},
|
|
1352
|
+
flows: {
|
|
1353
|
+
reset: { name: "reset" },
|
|
1354
|
+
},
|
|
1355
|
+
},
|
|
1042
1356
|
outputs: {
|
|
1043
1357
|
flows: {
|
|
1358
|
+
out: { name: "out" },
|
|
1044
1359
|
err: { name: "error" },
|
|
1045
1360
|
},
|
|
1361
|
+
values: {
|
|
1362
|
+
lastRemainingTime: { name: "lastRemainingTime", gltfType: "number" },
|
|
1363
|
+
},
|
|
1046
1364
|
},
|
|
1047
1365
|
},
|
|
1048
1366
|
"flow/setDelay": {
|
|
1049
1367
|
blocks: ["FlowGraphSetDelayBlock" /* FlowGraphBlockNames.SetDelay */],
|
|
1368
|
+
inputs: {
|
|
1369
|
+
values: {
|
|
1370
|
+
duration: { name: "duration", gltfType: "number" },
|
|
1371
|
+
},
|
|
1372
|
+
flows: {
|
|
1373
|
+
cancel: { name: "cancel" },
|
|
1374
|
+
},
|
|
1375
|
+
},
|
|
1050
1376
|
outputs: {
|
|
1051
1377
|
flows: {
|
|
1378
|
+
out: { name: "out" },
|
|
1052
1379
|
err: { name: "error" },
|
|
1380
|
+
done: { name: "done" },
|
|
1053
1381
|
},
|
|
1054
1382
|
values: {
|
|
1055
1383
|
// New spec renames this output to `lastDelay` (ref). Internally we still produce a
|
|
1056
1384
|
// FlowGraphInteger; the index is unique per delay so it acts as the opaque handle.
|
|
1057
1385
|
lastDelay: { name: "lastDelayIndex" },
|
|
1386
|
+
lastDelayIndex: { name: "lastDelayIndex", compatibilityOnly: true },
|
|
1058
1387
|
},
|
|
1059
1388
|
},
|
|
1060
1389
|
},
|
|
@@ -1062,9 +1391,12 @@ const gltfToFlowGraphMapping = {
|
|
|
1062
1391
|
blocks: ["FlowGraphCancelDelayBlock" /* FlowGraphBlockNames.CancelDelay */],
|
|
1063
1392
|
inputs: {
|
|
1064
1393
|
values: {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1394
|
+
delay: { name: "delayIndex", gltfType: "ref" },
|
|
1395
|
+
},
|
|
1396
|
+
},
|
|
1397
|
+
outputs: {
|
|
1398
|
+
flows: {
|
|
1399
|
+
out: { name: "out" },
|
|
1068
1400
|
},
|
|
1069
1401
|
},
|
|
1070
1402
|
},
|
|
@@ -1081,6 +1413,9 @@ const gltfToFlowGraphMapping = {
|
|
|
1081
1413
|
variable: {
|
|
1082
1414
|
name: "variable",
|
|
1083
1415
|
gltfType: "number",
|
|
1416
|
+
configurationType: "int",
|
|
1417
|
+
required: true,
|
|
1418
|
+
indexSource: "variables",
|
|
1084
1419
|
flowGraphType: "string",
|
|
1085
1420
|
inOptions: true,
|
|
1086
1421
|
isVariable: true,
|
|
@@ -1089,13 +1424,28 @@ const gltfToFlowGraphMapping = {
|
|
|
1089
1424
|
},
|
|
1090
1425
|
},
|
|
1091
1426
|
},
|
|
1427
|
+
outputs: {
|
|
1428
|
+
values: {
|
|
1429
|
+
value: { name: "value" },
|
|
1430
|
+
},
|
|
1431
|
+
},
|
|
1092
1432
|
},
|
|
1093
1433
|
"variable/set": {
|
|
1094
1434
|
blocks: ["FlowGraphSetVariableBlock" /* FlowGraphBlockNames.SetVariable */],
|
|
1435
|
+
inputs: {
|
|
1436
|
+
values: {
|
|
1437
|
+
"[segment]": { name: "$1" },
|
|
1438
|
+
},
|
|
1439
|
+
},
|
|
1095
1440
|
configuration: {
|
|
1096
1441
|
variables: {
|
|
1097
1442
|
name: "variables",
|
|
1098
1443
|
gltfType: "number",
|
|
1444
|
+
configurationType: "int[]",
|
|
1445
|
+
required: true,
|
|
1446
|
+
indexSource: "variables",
|
|
1447
|
+
minItems: 1,
|
|
1448
|
+
generatesInputValueSockets: true,
|
|
1099
1449
|
flowGraphType: "string",
|
|
1100
1450
|
inOptions: true,
|
|
1101
1451
|
isArray: true,
|
|
@@ -1104,6 +1454,11 @@ const gltfToFlowGraphMapping = {
|
|
|
1104
1454
|
},
|
|
1105
1455
|
},
|
|
1106
1456
|
},
|
|
1457
|
+
outputs: {
|
|
1458
|
+
flows: {
|
|
1459
|
+
out: { name: "out", compatibilityOnly: true },
|
|
1460
|
+
},
|
|
1461
|
+
},
|
|
1107
1462
|
extraProcessor(_gltfBlock, _declaration, _mapping, parser, serializedObjects) {
|
|
1108
1463
|
// variable/get configuration
|
|
1109
1464
|
const serializedGetVariable = serializedObjects[0];
|
|
@@ -1124,6 +1479,9 @@ const gltfToFlowGraphMapping = {
|
|
|
1124
1479
|
configuration: {
|
|
1125
1480
|
variable: {
|
|
1126
1481
|
name: "propertyName",
|
|
1482
|
+
configurationType: "int",
|
|
1483
|
+
required: true,
|
|
1484
|
+
indexSource: "variables",
|
|
1127
1485
|
inOptions: true,
|
|
1128
1486
|
isVariable: true,
|
|
1129
1487
|
dataTransformer(index, parser) {
|
|
@@ -1132,8 +1490,9 @@ const gltfToFlowGraphMapping = {
|
|
|
1132
1490
|
},
|
|
1133
1491
|
useSlerp: {
|
|
1134
1492
|
name: "animationType",
|
|
1493
|
+
configurationType: "bool",
|
|
1494
|
+
required: true,
|
|
1135
1495
|
inOptions: true,
|
|
1136
|
-
defaultValue: false,
|
|
1137
1496
|
dataTransformer(value) {
|
|
1138
1497
|
return value === true ? "Quaternion" /* FlowGraphTypes.Quaternion */ : undefined;
|
|
1139
1498
|
},
|
|
@@ -1213,15 +1572,28 @@ const gltfToFlowGraphMapping = {
|
|
|
1213
1572
|
},
|
|
1214
1573
|
"pointer/get": {
|
|
1215
1574
|
blocks: ["FlowGraphGetPropertyBlock" /* FlowGraphBlockNames.GetProperty */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */],
|
|
1216
|
-
validation: ValidateJsonPointerTemplate,
|
|
1575
|
+
validation: (node) => ValidateJsonPointerTemplate(node),
|
|
1217
1576
|
configuration: {
|
|
1218
|
-
pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser
|
|
1577
|
+
pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, configurationType: "string", required: true, pointerTemplate: true },
|
|
1578
|
+
type: {
|
|
1579
|
+
name: "type",
|
|
1580
|
+
configurationType: "int",
|
|
1581
|
+
required: true,
|
|
1582
|
+
validationOnly: true,
|
|
1583
|
+
indexSource: "types",
|
|
1584
|
+
},
|
|
1219
1585
|
},
|
|
1220
1586
|
inputs: {
|
|
1221
1587
|
values: {
|
|
1222
1588
|
"[segment]": { name: "$1", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
|
|
1223
1589
|
},
|
|
1224
1590
|
},
|
|
1591
|
+
outputs: {
|
|
1592
|
+
values: {
|
|
1593
|
+
value: { name: "value" },
|
|
1594
|
+
isValid: { name: "isValid", gltfType: "bool" },
|
|
1595
|
+
},
|
|
1596
|
+
},
|
|
1225
1597
|
interBlockConnectors: [
|
|
1226
1598
|
{
|
|
1227
1599
|
input: "object",
|
|
@@ -1258,9 +1630,16 @@ const gltfToFlowGraphMapping = {
|
|
|
1258
1630
|
},
|
|
1259
1631
|
"pointer/set": {
|
|
1260
1632
|
blocks: ["FlowGraphSetPropertyBlock" /* FlowGraphBlockNames.SetProperty */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */],
|
|
1261
|
-
validation: ValidateJsonPointerTemplate,
|
|
1633
|
+
validation: (node) => ValidateJsonPointerTemplate(node, new Set(["value"])),
|
|
1262
1634
|
configuration: {
|
|
1263
|
-
pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser
|
|
1635
|
+
pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, configurationType: "string", required: true, pointerTemplate: true },
|
|
1636
|
+
type: {
|
|
1637
|
+
name: "type",
|
|
1638
|
+
configurationType: "int",
|
|
1639
|
+
required: true,
|
|
1640
|
+
validationOnly: true,
|
|
1641
|
+
indexSource: "types",
|
|
1642
|
+
},
|
|
1264
1643
|
},
|
|
1265
1644
|
inputs: {
|
|
1266
1645
|
values: {
|
|
@@ -1272,6 +1651,7 @@ const gltfToFlowGraphMapping = {
|
|
|
1272
1651
|
outputs: {
|
|
1273
1652
|
flows: {
|
|
1274
1653
|
err: { name: "error" },
|
|
1654
|
+
out: { name: "out", compatibilityOnly: true },
|
|
1275
1655
|
},
|
|
1276
1656
|
},
|
|
1277
1657
|
interBlockConnectors: [
|
|
@@ -1311,9 +1691,17 @@ const gltfToFlowGraphMapping = {
|
|
|
1311
1691
|
"pointer/interpolate": {
|
|
1312
1692
|
// interpolate, parse the pointer and play the animation generated. 3 blocks!
|
|
1313
1693
|
blocks: ["FlowGraphInterpolationBlock" /* FlowGraphBlockNames.ValueInterpolation */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */],
|
|
1314
|
-
validation: ValidateJsonPointerTemplate,
|
|
1694
|
+
validation: (node) => ValidateJsonPointerTemplate(node, new Set(["value", "duration", "p1", "p2"])),
|
|
1315
1695
|
configuration: {
|
|
1316
|
-
pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser
|
|
1696
|
+
pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, configurationType: "string", required: true, pointerTemplate: true },
|
|
1697
|
+
type: {
|
|
1698
|
+
name: "type",
|
|
1699
|
+
configurationType: "int",
|
|
1700
|
+
required: true,
|
|
1701
|
+
validationOnly: true,
|
|
1702
|
+
indexSource: "types",
|
|
1703
|
+
allowedSignatures: ["float", "float2", "float3", "float4", "float2x2", "float3x3", "float4x4"],
|
|
1704
|
+
},
|
|
1317
1705
|
},
|
|
1318
1706
|
inputs: {
|
|
1319
1707
|
values: {
|
|
@@ -1406,7 +1794,7 @@ const gltfToFlowGraphMapping = {
|
|
|
1406
1794
|
blocks: ["FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
|
|
1407
1795
|
inputs: {
|
|
1408
1796
|
values: {
|
|
1409
|
-
animation: { name: "index", gltfType: "
|
|
1797
|
+
animation: { name: "index", gltfType: "ref", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
|
|
1410
1798
|
speed: { name: "speed", gltfType: "number" },
|
|
1411
1799
|
startTime: {
|
|
1412
1800
|
name: "from",
|
|
@@ -1424,7 +1812,9 @@ const gltfToFlowGraphMapping = {
|
|
|
1424
1812
|
},
|
|
1425
1813
|
outputs: {
|
|
1426
1814
|
flows: {
|
|
1815
|
+
out: { name: "out" },
|
|
1427
1816
|
err: { name: "error" },
|
|
1817
|
+
done: { name: "done" },
|
|
1428
1818
|
},
|
|
1429
1819
|
},
|
|
1430
1820
|
interBlockConnectors: [
|
|
@@ -1444,6 +1834,14 @@ const gltfToFlowGraphMapping = {
|
|
|
1444
1834
|
},
|
|
1445
1835
|
],
|
|
1446
1836
|
extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
|
|
1837
|
+
const playAnimationBlock = serializedObjects.find((block) => block.className === "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */);
|
|
1838
|
+
if (playAnimationBlock) {
|
|
1839
|
+
playAnimationBlock.config.useVirtualTimeline = true;
|
|
1840
|
+
}
|
|
1841
|
+
const arrayIndexBlock = serializedObjects.find((block) => block.className === "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */);
|
|
1842
|
+
if (arrayIndexBlock) {
|
|
1843
|
+
arrayIndexBlock.config.referenceCollection = "animations";
|
|
1844
|
+
}
|
|
1447
1845
|
// add the glTF to the configuration of the last serialized object
|
|
1448
1846
|
const serializedObject = serializedObjects[serializedObjects.length - 1];
|
|
1449
1847
|
serializedObject.config || (serializedObject.config = {});
|
|
@@ -1455,11 +1853,12 @@ const gltfToFlowGraphMapping = {
|
|
|
1455
1853
|
blocks: ["FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
|
|
1456
1854
|
inputs: {
|
|
1457
1855
|
values: {
|
|
1458
|
-
animation: { name: "index", gltfType: "
|
|
1856
|
+
animation: { name: "index", gltfType: "ref", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
|
|
1459
1857
|
},
|
|
1460
1858
|
},
|
|
1461
1859
|
outputs: {
|
|
1462
1860
|
flows: {
|
|
1861
|
+
out: { name: "out" },
|
|
1463
1862
|
err: { name: "error" },
|
|
1464
1863
|
},
|
|
1465
1864
|
},
|
|
@@ -1480,6 +1879,14 @@ const gltfToFlowGraphMapping = {
|
|
|
1480
1879
|
},
|
|
1481
1880
|
],
|
|
1482
1881
|
extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
|
|
1882
|
+
const stopAnimationBlock = serializedObjects.find((block) => block.className === "FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */);
|
|
1883
|
+
if (stopAnimationBlock) {
|
|
1884
|
+
stopAnimationBlock.config.skipOnAnimationEnd = true;
|
|
1885
|
+
}
|
|
1886
|
+
const arrayIndexBlock = serializedObjects.find((block) => block.className === "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */);
|
|
1887
|
+
if (arrayIndexBlock) {
|
|
1888
|
+
arrayIndexBlock.config.referenceCollection = "animations";
|
|
1889
|
+
}
|
|
1483
1890
|
// add the glTF to the configuration of the last serialized object
|
|
1484
1891
|
const serializedObject = serializedObjects[serializedObjects.length - 1];
|
|
1485
1892
|
serializedObject.config || (serializedObject.config = {});
|
|
@@ -1492,7 +1899,7 @@ const gltfToFlowGraphMapping = {
|
|
|
1492
1899
|
configuration: {},
|
|
1493
1900
|
inputs: {
|
|
1494
1901
|
values: {
|
|
1495
|
-
animation: { name: "index", gltfType: "
|
|
1902
|
+
animation: { name: "index", gltfType: "ref", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
|
|
1496
1903
|
stopTime: {
|
|
1497
1904
|
name: "stopAtFrame",
|
|
1498
1905
|
gltfType: "number",
|
|
@@ -1503,7 +1910,9 @@ const gltfToFlowGraphMapping = {
|
|
|
1503
1910
|
},
|
|
1504
1911
|
outputs: {
|
|
1505
1912
|
flows: {
|
|
1913
|
+
out: { name: "out" },
|
|
1506
1914
|
err: { name: "error" },
|
|
1915
|
+
done: { name: "done" },
|
|
1507
1916
|
},
|
|
1508
1917
|
},
|
|
1509
1918
|
interBlockConnectors: [
|
|
@@ -1523,6 +1932,15 @@ const gltfToFlowGraphMapping = {
|
|
|
1523
1932
|
},
|
|
1524
1933
|
],
|
|
1525
1934
|
extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
|
|
1935
|
+
const stopAnimationBlock = serializedObjects.find((block) => block.className === "FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */);
|
|
1936
|
+
if (stopAnimationBlock) {
|
|
1937
|
+
stopAnimationBlock.config.useVirtualStopAt = true;
|
|
1938
|
+
stopAnimationBlock.config.skipOnAnimationEnd = true;
|
|
1939
|
+
}
|
|
1940
|
+
const arrayIndexBlock = serializedObjects.find((block) => block.className === "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */);
|
|
1941
|
+
if (arrayIndexBlock) {
|
|
1942
|
+
arrayIndexBlock.config.referenceCollection = "animations";
|
|
1943
|
+
}
|
|
1526
1944
|
// add the glTF to the configuration of the last serialized object
|
|
1527
1945
|
const serializedObject = serializedObjects[serializedObjects.length - 1];
|
|
1528
1946
|
serializedObject.config || (serializedObject.config = {});
|
|
@@ -1533,11 +1951,27 @@ const gltfToFlowGraphMapping = {
|
|
|
1533
1951
|
"math/switch": {
|
|
1534
1952
|
blocks: ["FlowGraphDataSwitchBlock" /* FlowGraphBlockNames.DataSwitch */],
|
|
1535
1953
|
configuration: {
|
|
1536
|
-
cases: {
|
|
1954
|
+
cases: {
|
|
1955
|
+
name: "cases",
|
|
1956
|
+
isArray: true,
|
|
1957
|
+
inOptions: true,
|
|
1958
|
+
defaultValue: [],
|
|
1959
|
+
configurationType: "int[]",
|
|
1960
|
+
invalidUsesDefault: true,
|
|
1961
|
+
generatesCaseInputValueSockets: true,
|
|
1962
|
+
uniqueValues: true,
|
|
1963
|
+
},
|
|
1537
1964
|
},
|
|
1538
1965
|
inputs: {
|
|
1539
1966
|
values: {
|
|
1540
|
-
selection: { name: "case" },
|
|
1967
|
+
selection: { name: "case", gltfType: "int" },
|
|
1968
|
+
default: { name: "default" },
|
|
1969
|
+
"[case]": { name: "$1" },
|
|
1970
|
+
},
|
|
1971
|
+
},
|
|
1972
|
+
outputs: {
|
|
1973
|
+
values: {
|
|
1974
|
+
value: { name: "value" },
|
|
1541
1975
|
},
|
|
1542
1976
|
},
|
|
1543
1977
|
validation(gltfBlock) {
|
|
@@ -1572,8 +2006,37 @@ const gltfToFlowGraphMapping = {
|
|
|
1572
2006
|
},
|
|
1573
2007
|
"debug/log": {
|
|
1574
2008
|
blocks: ["FlowGraphConsoleLogBlock" /* FlowGraphBlockNames.ConsoleLog */],
|
|
2009
|
+
inputs: {
|
|
2010
|
+
flows: {
|
|
2011
|
+
in: { name: "in" },
|
|
2012
|
+
},
|
|
2013
|
+
values: {
|
|
2014
|
+
"[parameter]": { name: "$1" },
|
|
2015
|
+
},
|
|
2016
|
+
},
|
|
2017
|
+
outputs: {
|
|
2018
|
+
flows: {
|
|
2019
|
+
out: { name: "out" },
|
|
2020
|
+
},
|
|
2021
|
+
},
|
|
1575
2022
|
configuration: {
|
|
1576
|
-
|
|
2023
|
+
severity: {
|
|
2024
|
+
name: "severity",
|
|
2025
|
+
configurationType: "int",
|
|
2026
|
+
defaultValue: 0,
|
|
2027
|
+
invalidUsesDefault: true,
|
|
2028
|
+
validationOnly: true,
|
|
2029
|
+
configurationGroup: "debugLog",
|
|
2030
|
+
},
|
|
2031
|
+
message: {
|
|
2032
|
+
name: "messageTemplate",
|
|
2033
|
+
configurationType: "string",
|
|
2034
|
+
defaultValue: "",
|
|
2035
|
+
invalidUsesDefault: true,
|
|
2036
|
+
inOptions: true,
|
|
2037
|
+
configurationGroup: "debugLog",
|
|
2038
|
+
debugLogTemplate: true,
|
|
2039
|
+
},
|
|
1577
2040
|
},
|
|
1578
2041
|
},
|
|
1579
2042
|
};
|
|
@@ -1588,7 +2051,7 @@ function getSimpleInputMapping(type, inputs = ["a"], inferType) {
|
|
|
1588
2051
|
},
|
|
1589
2052
|
outputs: {
|
|
1590
2053
|
values: {
|
|
1591
|
-
value: { name: "value" },
|
|
2054
|
+
value: { name: "value", typeSourceInput: inputs[0] },
|
|
1592
2055
|
},
|
|
1593
2056
|
},
|
|
1594
2057
|
extraProcessor(gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
|
|
@@ -1657,15 +2120,69 @@ function HasOddBracketRun(segment) {
|
|
|
1657
2120
|
}
|
|
1658
2121
|
return false;
|
|
1659
2122
|
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Parses a ratified `debug/log` message template.
|
|
2125
|
+
* Literal braces must be doubled; non-empty text inside a single brace pair defines a socket id.
|
|
2126
|
+
* @param message message template to parse
|
|
2127
|
+
* @returns template validity and its exact dynamic socket ids
|
|
2128
|
+
*/
|
|
2129
|
+
export function ParseDebugLogTemplate(message) {
|
|
2130
|
+
let state = 0;
|
|
2131
|
+
let parameterStart = -1;
|
|
2132
|
+
const sockets = [];
|
|
2133
|
+
const seen = new Set();
|
|
2134
|
+
for (let index = 0; index < message.length; index++) {
|
|
2135
|
+
const character = message[index];
|
|
2136
|
+
if (character === "{") {
|
|
2137
|
+
if (state === 0) {
|
|
2138
|
+
state = 1;
|
|
2139
|
+
}
|
|
2140
|
+
else if (state === 1) {
|
|
2141
|
+
state = 0;
|
|
2142
|
+
}
|
|
2143
|
+
else {
|
|
2144
|
+
return { valid: false, sockets: [] };
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
else if (character === "}") {
|
|
2148
|
+
if (state === 0) {
|
|
2149
|
+
state = 3;
|
|
2150
|
+
}
|
|
2151
|
+
else if (state === 3) {
|
|
2152
|
+
state = 0;
|
|
2153
|
+
}
|
|
2154
|
+
else if (state === 2) {
|
|
2155
|
+
const socket = message.substring(parameterStart + 1, index);
|
|
2156
|
+
if (!seen.has(socket)) {
|
|
2157
|
+
seen.add(socket);
|
|
2158
|
+
sockets.push(socket);
|
|
2159
|
+
}
|
|
2160
|
+
state = 0;
|
|
2161
|
+
}
|
|
2162
|
+
else {
|
|
2163
|
+
return { valid: false, sockets: [] };
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
else if (state === 1) {
|
|
2167
|
+
parameterStart = index - 1;
|
|
2168
|
+
state = 2;
|
|
2169
|
+
}
|
|
2170
|
+
else if (state === 3) {
|
|
2171
|
+
return { valid: false, sockets: [] };
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
return { valid: state === 0, sockets: state === 0 ? sockets : [] };
|
|
2175
|
+
}
|
|
1660
2176
|
/**
|
|
1661
2177
|
* Validates the `pointer` configuration value of a `pointer/*` operation, following the JSON Pointer Template
|
|
1662
2178
|
* Parsing steps of the KHR_interactivity specification. A template parameter must span an entire path segment, so
|
|
1663
2179
|
* a template such as `/materials/{materialRef}pbrMetallicRoughness/...` is a syntax error, and the specification
|
|
1664
2180
|
* requires the whole behavior graph to be rejected.
|
|
1665
2181
|
* @param gltfBlock the glTF interactivity node
|
|
2182
|
+
* @param reservedSocketIds input ids owned by the operation rather than template parameters
|
|
1666
2183
|
* @returns the validation result
|
|
1667
2184
|
*/
|
|
1668
|
-
function ValidateJsonPointerTemplate(gltfBlock) {
|
|
2185
|
+
function ValidateJsonPointerTemplate(gltfBlock, reservedSocketIds = new Set()) {
|
|
1669
2186
|
const pointer = gltfBlock.configuration?.pointer?.value?.[0];
|
|
1670
2187
|
if (typeof pointer !== "string") {
|
|
1671
2188
|
return { valid: false, error: "A pointer operation requires a string `pointer` configuration value" };
|
|
@@ -1677,6 +2194,9 @@ function ValidateJsonPointerTemplate(gltfBlock) {
|
|
|
1677
2194
|
const invalid = (reason) => ({ valid: false, error: `The JSON Pointer Template "${pointer}" is invalid: ${reason}` });
|
|
1678
2195
|
const socketIds = new Set();
|
|
1679
2196
|
for (const segment of pointer.split("/")) {
|
|
2197
|
+
if (/~(?:[^01]|$)/.test(segment)) {
|
|
2198
|
+
return invalid(`the path segment "${segment}" contains an invalid RFC 6901 escape`);
|
|
2199
|
+
}
|
|
1680
2200
|
const isIntegerParameter = segment[0] === "[" && segment[1] !== "[";
|
|
1681
2201
|
const isReferenceParameter = segment[0] === "{" && segment[1] !== "{";
|
|
1682
2202
|
if (!isIntegerParameter && !isReferenceParameter) {
|
|
@@ -1691,6 +2211,9 @@ function ValidateJsonPointerTemplate(gltfBlock) {
|
|
|
1691
2211
|
return invalid(`the template parameter path segment "${segment}" is malformed`);
|
|
1692
2212
|
}
|
|
1693
2213
|
const socketId = body.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
2214
|
+
if (reservedSocketIds.has(socketId)) {
|
|
2215
|
+
return invalid(`the template parameter "${socketId}" uses a reserved input socket id`);
|
|
2216
|
+
}
|
|
1694
2217
|
if (socketIds.has(socketId)) {
|
|
1695
2218
|
return invalid(`the template parameter "${socketId}" is used more than once`);
|
|
1696
2219
|
}
|