@esengine/blueprint 4.3.0 → 4.5.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/dist/index.d.ts +443 -130
- package/dist/index.js +2895 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -98,6 +98,784 @@ function validateBlueprintAsset(asset) {
|
|
|
98
98
|
}
|
|
99
99
|
__name(validateBlueprintAsset, "validateBlueprintAsset");
|
|
100
100
|
|
|
101
|
+
// src/types/schema.ts
|
|
102
|
+
var _SchemaRegistry = class _SchemaRegistry {
|
|
103
|
+
/**
|
|
104
|
+
* @zh 注册 Schema
|
|
105
|
+
* @en Register a schema
|
|
106
|
+
*/
|
|
107
|
+
static register(id, schema) {
|
|
108
|
+
this.schemas.set(id, schema);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @zh 获取 Schema
|
|
112
|
+
* @en Get a schema
|
|
113
|
+
*/
|
|
114
|
+
static get(id) {
|
|
115
|
+
return this.schemas.get(id);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @zh 解析引用,返回实际 Schema
|
|
119
|
+
* @en Resolve reference, return actual schema
|
|
120
|
+
*/
|
|
121
|
+
static resolve(schema) {
|
|
122
|
+
if (schema.type === "ref") {
|
|
123
|
+
const resolved = this.schemas.get(schema.ref);
|
|
124
|
+
if (!resolved) {
|
|
125
|
+
console.warn(`[SchemaRegistry] Schema not found: ${schema.ref}`);
|
|
126
|
+
return {
|
|
127
|
+
type: "primitive",
|
|
128
|
+
primitive: "any"
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return this.resolve(resolved);
|
|
132
|
+
}
|
|
133
|
+
return schema;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @zh 检查 Schema 是否已注册
|
|
137
|
+
* @en Check if schema is registered
|
|
138
|
+
*/
|
|
139
|
+
static has(id) {
|
|
140
|
+
return this.schemas.has(id);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @zh 获取所有已注册的 Schema ID
|
|
144
|
+
* @en Get all registered schema IDs
|
|
145
|
+
*/
|
|
146
|
+
static keys() {
|
|
147
|
+
return Array.from(this.schemas.keys());
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @zh 清空注册表
|
|
151
|
+
* @en Clear registry
|
|
152
|
+
*/
|
|
153
|
+
static clear() {
|
|
154
|
+
this.schemas.clear();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
__name(_SchemaRegistry, "SchemaRegistry");
|
|
158
|
+
__publicField(_SchemaRegistry, "schemas", /* @__PURE__ */ new Map());
|
|
159
|
+
var SchemaRegistry = _SchemaRegistry;
|
|
160
|
+
function getSchemaDefaultValue(schema) {
|
|
161
|
+
const resolved = SchemaRegistry.resolve(schema);
|
|
162
|
+
switch (resolved.type) {
|
|
163
|
+
case "primitive":
|
|
164
|
+
if (resolved.defaultValue !== void 0) return resolved.defaultValue;
|
|
165
|
+
return getPrimitiveDefaultValue(resolved.primitive);
|
|
166
|
+
case "array":
|
|
167
|
+
if (resolved.defaultValue !== void 0) return [
|
|
168
|
+
...resolved.defaultValue
|
|
169
|
+
];
|
|
170
|
+
return [];
|
|
171
|
+
case "object": {
|
|
172
|
+
const obj = {};
|
|
173
|
+
for (const [key, propSchema] of Object.entries(resolved.properties)) {
|
|
174
|
+
obj[key] = getSchemaDefaultValue(propSchema);
|
|
175
|
+
}
|
|
176
|
+
return obj;
|
|
177
|
+
}
|
|
178
|
+
case "enum":
|
|
179
|
+
if (resolved.defaultValue !== void 0) return resolved.defaultValue;
|
|
180
|
+
return resolved.options[0]?.value;
|
|
181
|
+
default:
|
|
182
|
+
return void 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
__name(getSchemaDefaultValue, "getSchemaDefaultValue");
|
|
186
|
+
function getPrimitiveDefaultValue(primitive) {
|
|
187
|
+
switch (primitive) {
|
|
188
|
+
case "bool":
|
|
189
|
+
return false;
|
|
190
|
+
case "int":
|
|
191
|
+
return 0;
|
|
192
|
+
case "float":
|
|
193
|
+
return 0;
|
|
194
|
+
case "string":
|
|
195
|
+
return "";
|
|
196
|
+
case "vector2":
|
|
197
|
+
return {
|
|
198
|
+
x: 0,
|
|
199
|
+
y: 0
|
|
200
|
+
};
|
|
201
|
+
case "vector3":
|
|
202
|
+
return {
|
|
203
|
+
x: 0,
|
|
204
|
+
y: 0,
|
|
205
|
+
z: 0
|
|
206
|
+
};
|
|
207
|
+
case "color":
|
|
208
|
+
return {
|
|
209
|
+
r: 255,
|
|
210
|
+
g: 255,
|
|
211
|
+
b: 255,
|
|
212
|
+
a: 255
|
|
213
|
+
};
|
|
214
|
+
case "entity":
|
|
215
|
+
return null;
|
|
216
|
+
case "component":
|
|
217
|
+
return null;
|
|
218
|
+
case "object":
|
|
219
|
+
return null;
|
|
220
|
+
case "array":
|
|
221
|
+
return [];
|
|
222
|
+
case "any":
|
|
223
|
+
return null;
|
|
224
|
+
case "exec":
|
|
225
|
+
return void 0;
|
|
226
|
+
default:
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
__name(getPrimitiveDefaultValue, "getPrimitiveDefaultValue");
|
|
231
|
+
function schemaToPinType(schema) {
|
|
232
|
+
const resolved = SchemaRegistry.resolve(schema);
|
|
233
|
+
switch (resolved.type) {
|
|
234
|
+
case "primitive":
|
|
235
|
+
return resolved.primitive;
|
|
236
|
+
case "array":
|
|
237
|
+
return "array";
|
|
238
|
+
case "object":
|
|
239
|
+
return "object";
|
|
240
|
+
case "enum":
|
|
241
|
+
return typeof resolved.options[0]?.value === "number" ? "int" : "string";
|
|
242
|
+
default:
|
|
243
|
+
return "any";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
__name(schemaToPinType, "schemaToPinType");
|
|
247
|
+
function validateSchema(schema, data, path = "") {
|
|
248
|
+
const resolved = SchemaRegistry.resolve(schema);
|
|
249
|
+
const errors = [];
|
|
250
|
+
switch (resolved.type) {
|
|
251
|
+
case "primitive":
|
|
252
|
+
validatePrimitive(resolved, data, path, errors);
|
|
253
|
+
break;
|
|
254
|
+
case "array":
|
|
255
|
+
validateArray(resolved, data, path, errors);
|
|
256
|
+
break;
|
|
257
|
+
case "object":
|
|
258
|
+
validateObject(resolved, data, path, errors);
|
|
259
|
+
break;
|
|
260
|
+
case "enum":
|
|
261
|
+
validateEnum(resolved, data, path, errors);
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
valid: errors.length === 0,
|
|
266
|
+
errors
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
__name(validateSchema, "validateSchema");
|
|
270
|
+
function validatePrimitive(schema, data, path, errors) {
|
|
271
|
+
if (data === null || data === void 0) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const expectedType = getPrimitiveJsType(schema.primitive);
|
|
275
|
+
const actualType = typeof data;
|
|
276
|
+
if (expectedType === "object") {
|
|
277
|
+
if (typeof data !== "object") {
|
|
278
|
+
errors.push({
|
|
279
|
+
path,
|
|
280
|
+
message: `Expected ${schema.primitive}, got ${actualType}`,
|
|
281
|
+
expected: schema.primitive,
|
|
282
|
+
received: actualType
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
} else if (expectedType !== "any" && actualType !== expectedType) {
|
|
286
|
+
errors.push({
|
|
287
|
+
path,
|
|
288
|
+
message: `Expected ${expectedType}, got ${actualType}`,
|
|
289
|
+
expected: expectedType,
|
|
290
|
+
received: actualType
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
if ((schema.primitive === "int" || schema.primitive === "float") && typeof data === "number") {
|
|
294
|
+
if (schema.min !== void 0 && data < schema.min) {
|
|
295
|
+
errors.push({
|
|
296
|
+
path,
|
|
297
|
+
message: `Value ${data} is less than minimum ${schema.min}`
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (schema.max !== void 0 && data > schema.max) {
|
|
301
|
+
errors.push({
|
|
302
|
+
path,
|
|
303
|
+
message: `Value ${data} is greater than maximum ${schema.max}`
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
__name(validatePrimitive, "validatePrimitive");
|
|
309
|
+
function validateArray(schema, data, path, errors) {
|
|
310
|
+
if (!Array.isArray(data)) {
|
|
311
|
+
errors.push({
|
|
312
|
+
path,
|
|
313
|
+
message: `Expected array, got ${typeof data}`,
|
|
314
|
+
expected: "array",
|
|
315
|
+
received: typeof data
|
|
316
|
+
});
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
320
|
+
errors.push({
|
|
321
|
+
path,
|
|
322
|
+
message: `Array has ${data.length} items, minimum is ${schema.minItems}`
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
326
|
+
errors.push({
|
|
327
|
+
path,
|
|
328
|
+
message: `Array has ${data.length} items, maximum is ${schema.maxItems}`
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
for (let i = 0; i < data.length; i++) {
|
|
332
|
+
const itemResult = validateSchema(schema.items, data[i], `${path}[${i}]`);
|
|
333
|
+
errors.push(...itemResult.errors);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
__name(validateArray, "validateArray");
|
|
337
|
+
function validateObject(schema, data, path, errors) {
|
|
338
|
+
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
339
|
+
errors.push({
|
|
340
|
+
path,
|
|
341
|
+
message: `Expected object, got ${Array.isArray(data) ? "array" : typeof data}`,
|
|
342
|
+
expected: "object",
|
|
343
|
+
received: Array.isArray(data) ? "array" : typeof data
|
|
344
|
+
});
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const obj = data;
|
|
348
|
+
if (schema.required) {
|
|
349
|
+
for (const key of schema.required) {
|
|
350
|
+
if (!(key in obj)) {
|
|
351
|
+
errors.push({
|
|
352
|
+
path: path ? `${path}.${key}` : key,
|
|
353
|
+
message: `Missing required field: ${key}`
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
for (const [key, propSchema] of Object.entries(schema.properties)) {
|
|
359
|
+
if (key in obj) {
|
|
360
|
+
const propPath = path ? `${path}.${key}` : key;
|
|
361
|
+
const propResult = validateSchema(propSchema, obj[key], propPath);
|
|
362
|
+
errors.push(...propResult.errors);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
__name(validateObject, "validateObject");
|
|
367
|
+
function validateEnum(schema, data, path, errors) {
|
|
368
|
+
if (data === null || data === void 0) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const validValues = schema.options.map((o) => o.value);
|
|
372
|
+
if (!validValues.includes(data)) {
|
|
373
|
+
errors.push({
|
|
374
|
+
path,
|
|
375
|
+
message: `Invalid enum value: ${data}`,
|
|
376
|
+
expected: validValues.join(" | "),
|
|
377
|
+
received: String(data)
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
__name(validateEnum, "validateEnum");
|
|
382
|
+
function getPrimitiveJsType(primitive) {
|
|
383
|
+
switch (primitive) {
|
|
384
|
+
case "bool":
|
|
385
|
+
return "boolean";
|
|
386
|
+
case "int":
|
|
387
|
+
case "float":
|
|
388
|
+
return "number";
|
|
389
|
+
case "string":
|
|
390
|
+
return "string";
|
|
391
|
+
case "vector2":
|
|
392
|
+
case "vector3":
|
|
393
|
+
case "color":
|
|
394
|
+
case "entity":
|
|
395
|
+
case "component":
|
|
396
|
+
case "object":
|
|
397
|
+
case "array":
|
|
398
|
+
return "object";
|
|
399
|
+
case "any":
|
|
400
|
+
return "any";
|
|
401
|
+
case "exec":
|
|
402
|
+
return "undefined";
|
|
403
|
+
default:
|
|
404
|
+
return "any";
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
__name(getPrimitiveJsType, "getPrimitiveJsType");
|
|
408
|
+
function cloneSchema(schema) {
|
|
409
|
+
return JSON.parse(JSON.stringify(schema));
|
|
410
|
+
}
|
|
411
|
+
__name(cloneSchema, "cloneSchema");
|
|
412
|
+
function mergeObjectSchemas(base, override) {
|
|
413
|
+
return {
|
|
414
|
+
...base,
|
|
415
|
+
...override,
|
|
416
|
+
properties: {
|
|
417
|
+
...base.properties,
|
|
418
|
+
...override.properties || {}
|
|
419
|
+
},
|
|
420
|
+
required: [
|
|
421
|
+
...base.required || [],
|
|
422
|
+
...override.required || []
|
|
423
|
+
]
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
__name(mergeObjectSchemas, "mergeObjectSchemas");
|
|
427
|
+
var Schema = {
|
|
428
|
+
// Primitives
|
|
429
|
+
bool(options) {
|
|
430
|
+
return {
|
|
431
|
+
type: "primitive",
|
|
432
|
+
primitive: "bool",
|
|
433
|
+
...options
|
|
434
|
+
};
|
|
435
|
+
},
|
|
436
|
+
int(options) {
|
|
437
|
+
return {
|
|
438
|
+
type: "primitive",
|
|
439
|
+
primitive: "int",
|
|
440
|
+
...options
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
float(options) {
|
|
444
|
+
return {
|
|
445
|
+
type: "primitive",
|
|
446
|
+
primitive: "float",
|
|
447
|
+
...options
|
|
448
|
+
};
|
|
449
|
+
},
|
|
450
|
+
string(options) {
|
|
451
|
+
return {
|
|
452
|
+
type: "primitive",
|
|
453
|
+
primitive: "string",
|
|
454
|
+
...options
|
|
455
|
+
};
|
|
456
|
+
},
|
|
457
|
+
vector2(options) {
|
|
458
|
+
return {
|
|
459
|
+
type: "primitive",
|
|
460
|
+
primitive: "vector2",
|
|
461
|
+
...options
|
|
462
|
+
};
|
|
463
|
+
},
|
|
464
|
+
vector3(options) {
|
|
465
|
+
return {
|
|
466
|
+
type: "primitive",
|
|
467
|
+
primitive: "vector3",
|
|
468
|
+
...options
|
|
469
|
+
};
|
|
470
|
+
},
|
|
471
|
+
color(options) {
|
|
472
|
+
return {
|
|
473
|
+
type: "primitive",
|
|
474
|
+
primitive: "color",
|
|
475
|
+
...options
|
|
476
|
+
};
|
|
477
|
+
},
|
|
478
|
+
entity(options) {
|
|
479
|
+
return {
|
|
480
|
+
type: "primitive",
|
|
481
|
+
primitive: "entity",
|
|
482
|
+
...options
|
|
483
|
+
};
|
|
484
|
+
},
|
|
485
|
+
component(options) {
|
|
486
|
+
return {
|
|
487
|
+
type: "primitive",
|
|
488
|
+
primitive: "component",
|
|
489
|
+
...options
|
|
490
|
+
};
|
|
491
|
+
},
|
|
492
|
+
object_ref(options) {
|
|
493
|
+
return {
|
|
494
|
+
type: "primitive",
|
|
495
|
+
primitive: "object",
|
|
496
|
+
...options
|
|
497
|
+
};
|
|
498
|
+
},
|
|
499
|
+
any(options) {
|
|
500
|
+
return {
|
|
501
|
+
type: "primitive",
|
|
502
|
+
primitive: "any",
|
|
503
|
+
...options
|
|
504
|
+
};
|
|
505
|
+
},
|
|
506
|
+
// Complex types
|
|
507
|
+
array(items, options) {
|
|
508
|
+
return {
|
|
509
|
+
type: "array",
|
|
510
|
+
items,
|
|
511
|
+
...options
|
|
512
|
+
};
|
|
513
|
+
},
|
|
514
|
+
object(properties, options) {
|
|
515
|
+
return {
|
|
516
|
+
type: "object",
|
|
517
|
+
properties,
|
|
518
|
+
...options
|
|
519
|
+
};
|
|
520
|
+
},
|
|
521
|
+
enum(options, extra) {
|
|
522
|
+
return {
|
|
523
|
+
type: "enum",
|
|
524
|
+
options,
|
|
525
|
+
...extra
|
|
526
|
+
};
|
|
527
|
+
},
|
|
528
|
+
ref(id) {
|
|
529
|
+
return {
|
|
530
|
+
type: "ref",
|
|
531
|
+
ref: id
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// src/types/path-utils.ts
|
|
537
|
+
function parsePath(path) {
|
|
538
|
+
const parts = [];
|
|
539
|
+
const regex = /([^.\[\]]+)|\[(\*|\d+)\]/g;
|
|
540
|
+
let match;
|
|
541
|
+
while ((match = regex.exec(path)) !== null) {
|
|
542
|
+
if (match[1]) {
|
|
543
|
+
parts.push({
|
|
544
|
+
type: "property",
|
|
545
|
+
name: match[1]
|
|
546
|
+
});
|
|
547
|
+
} else if (match[2] === "*") {
|
|
548
|
+
parts.push({
|
|
549
|
+
type: "wildcard"
|
|
550
|
+
});
|
|
551
|
+
} else {
|
|
552
|
+
parts.push({
|
|
553
|
+
type: "index",
|
|
554
|
+
index: parseInt(match[2], 10)
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return parts;
|
|
559
|
+
}
|
|
560
|
+
__name(parsePath, "parsePath");
|
|
561
|
+
function parsePortPath(path) {
|
|
562
|
+
const result = {
|
|
563
|
+
baseName: "",
|
|
564
|
+
indices: [],
|
|
565
|
+
subPath: [],
|
|
566
|
+
original: path
|
|
567
|
+
};
|
|
568
|
+
const parts = parsePath(path);
|
|
569
|
+
let foundFirstIndex = false;
|
|
570
|
+
let afterIndices = false;
|
|
571
|
+
for (const part of parts) {
|
|
572
|
+
if (part.type === "property") {
|
|
573
|
+
if (!foundFirstIndex) {
|
|
574
|
+
if (result.baseName) {
|
|
575
|
+
result.baseName += "." + part.name;
|
|
576
|
+
} else {
|
|
577
|
+
result.baseName = part.name;
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
afterIndices = true;
|
|
581
|
+
result.subPath.push(part.name);
|
|
582
|
+
}
|
|
583
|
+
} else if (part.type === "index") {
|
|
584
|
+
foundFirstIndex = true;
|
|
585
|
+
if (!afterIndices) {
|
|
586
|
+
result.indices.push(part.index);
|
|
587
|
+
} else {
|
|
588
|
+
result.subPath.push(`[${part.index}]`);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return result;
|
|
593
|
+
}
|
|
594
|
+
__name(parsePortPath, "parsePortPath");
|
|
595
|
+
function buildPath(parts) {
|
|
596
|
+
let path = "";
|
|
597
|
+
for (const part of parts) {
|
|
598
|
+
switch (part.type) {
|
|
599
|
+
case "property":
|
|
600
|
+
if (path && !path.endsWith("[")) {
|
|
601
|
+
path += ".";
|
|
602
|
+
}
|
|
603
|
+
path += part.name;
|
|
604
|
+
break;
|
|
605
|
+
case "index":
|
|
606
|
+
path += `[${part.index}]`;
|
|
607
|
+
break;
|
|
608
|
+
case "wildcard":
|
|
609
|
+
path += "[*]";
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return path;
|
|
614
|
+
}
|
|
615
|
+
__name(buildPath, "buildPath");
|
|
616
|
+
function buildPortPath(address) {
|
|
617
|
+
let path = address.baseName;
|
|
618
|
+
for (const index of address.indices) {
|
|
619
|
+
path += `[${index}]`;
|
|
620
|
+
}
|
|
621
|
+
if (address.subPath.length > 0) {
|
|
622
|
+
for (const sub of address.subPath) {
|
|
623
|
+
if (sub.startsWith("[")) {
|
|
624
|
+
path += sub;
|
|
625
|
+
} else {
|
|
626
|
+
path += "." + sub;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return path;
|
|
631
|
+
}
|
|
632
|
+
__name(buildPortPath, "buildPortPath");
|
|
633
|
+
function getByPath(data, path) {
|
|
634
|
+
if (!path) return data;
|
|
635
|
+
const parts = parsePath(path);
|
|
636
|
+
let current = data;
|
|
637
|
+
for (const part of parts) {
|
|
638
|
+
if (current === null || current === void 0) {
|
|
639
|
+
return void 0;
|
|
640
|
+
}
|
|
641
|
+
switch (part.type) {
|
|
642
|
+
case "property":
|
|
643
|
+
if (typeof current === "object" && current !== null) {
|
|
644
|
+
current = current[part.name];
|
|
645
|
+
} else {
|
|
646
|
+
return void 0;
|
|
647
|
+
}
|
|
648
|
+
break;
|
|
649
|
+
case "index":
|
|
650
|
+
if (Array.isArray(current)) {
|
|
651
|
+
current = current[part.index];
|
|
652
|
+
} else {
|
|
653
|
+
return void 0;
|
|
654
|
+
}
|
|
655
|
+
break;
|
|
656
|
+
case "wildcard":
|
|
657
|
+
if (Array.isArray(current)) {
|
|
658
|
+
return current;
|
|
659
|
+
}
|
|
660
|
+
return void 0;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return current;
|
|
664
|
+
}
|
|
665
|
+
__name(getByPath, "getByPath");
|
|
666
|
+
function setByPath(data, path, value) {
|
|
667
|
+
if (!path) return false;
|
|
668
|
+
const parts = parsePath(path);
|
|
669
|
+
let current = data;
|
|
670
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
671
|
+
const part = parts[i];
|
|
672
|
+
if (current === null || current === void 0) {
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
switch (part.type) {
|
|
676
|
+
case "property":
|
|
677
|
+
if (typeof current === "object" && current !== null) {
|
|
678
|
+
current = current[part.name];
|
|
679
|
+
} else {
|
|
680
|
+
return false;
|
|
681
|
+
}
|
|
682
|
+
break;
|
|
683
|
+
case "index":
|
|
684
|
+
if (Array.isArray(current)) {
|
|
685
|
+
current = current[part.index];
|
|
686
|
+
} else {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
break;
|
|
690
|
+
case "wildcard":
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
const lastPart = parts[parts.length - 1];
|
|
695
|
+
if (current === null || current === void 0) {
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
switch (lastPart.type) {
|
|
699
|
+
case "property":
|
|
700
|
+
if (typeof current === "object" && current !== null) {
|
|
701
|
+
current[lastPart.name] = value;
|
|
702
|
+
return true;
|
|
703
|
+
}
|
|
704
|
+
break;
|
|
705
|
+
case "index":
|
|
706
|
+
if (Array.isArray(current)) {
|
|
707
|
+
current[lastPart.index] = value;
|
|
708
|
+
return true;
|
|
709
|
+
}
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
__name(setByPath, "setByPath");
|
|
715
|
+
function hasPath(data, path) {
|
|
716
|
+
return getByPath(data, path) !== void 0;
|
|
717
|
+
}
|
|
718
|
+
__name(hasPath, "hasPath");
|
|
719
|
+
function deleteByPath(data, path) {
|
|
720
|
+
if (!path) return false;
|
|
721
|
+
const parts = parsePath(path);
|
|
722
|
+
let current = data;
|
|
723
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
724
|
+
const part = parts[i];
|
|
725
|
+
if (current === null || current === void 0) {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
switch (part.type) {
|
|
729
|
+
case "property":
|
|
730
|
+
if (typeof current === "object" && current !== null) {
|
|
731
|
+
current = current[part.name];
|
|
732
|
+
} else {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
break;
|
|
736
|
+
case "index":
|
|
737
|
+
if (Array.isArray(current)) {
|
|
738
|
+
current = current[part.index];
|
|
739
|
+
} else {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
break;
|
|
743
|
+
default:
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
const lastPart = parts[parts.length - 1];
|
|
748
|
+
if (current === null || current === void 0) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
switch (lastPart.type) {
|
|
752
|
+
case "property":
|
|
753
|
+
if (typeof current === "object" && current !== null) {
|
|
754
|
+
delete current[lastPart.name];
|
|
755
|
+
return true;
|
|
756
|
+
}
|
|
757
|
+
break;
|
|
758
|
+
case "index":
|
|
759
|
+
if (Array.isArray(current)) {
|
|
760
|
+
current.splice(lastPart.index, 1);
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
__name(deleteByPath, "deleteByPath");
|
|
768
|
+
function updatePathOnArrayChange(path, arrayPath, operation, index, toIndex) {
|
|
769
|
+
if (!path.startsWith(arrayPath + "[")) {
|
|
770
|
+
return path;
|
|
771
|
+
}
|
|
772
|
+
const address = parsePortPath(path);
|
|
773
|
+
if (address.indices.length === 0) {
|
|
774
|
+
return path;
|
|
775
|
+
}
|
|
776
|
+
const currentIndex = address.indices[0];
|
|
777
|
+
switch (operation) {
|
|
778
|
+
case "insert":
|
|
779
|
+
if (currentIndex >= index) {
|
|
780
|
+
address.indices[0]++;
|
|
781
|
+
}
|
|
782
|
+
break;
|
|
783
|
+
case "remove":
|
|
784
|
+
if (currentIndex === index) {
|
|
785
|
+
return "";
|
|
786
|
+
}
|
|
787
|
+
if (currentIndex > index) {
|
|
788
|
+
address.indices[0]--;
|
|
789
|
+
}
|
|
790
|
+
break;
|
|
791
|
+
case "move":
|
|
792
|
+
if (toIndex !== void 0) {
|
|
793
|
+
if (currentIndex === index) {
|
|
794
|
+
address.indices[0] = toIndex;
|
|
795
|
+
} else if (index < toIndex) {
|
|
796
|
+
if (currentIndex > index && currentIndex <= toIndex) {
|
|
797
|
+
address.indices[0]--;
|
|
798
|
+
}
|
|
799
|
+
} else {
|
|
800
|
+
if (currentIndex >= toIndex && currentIndex < index) {
|
|
801
|
+
address.indices[0]++;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
return buildPortPath(address);
|
|
808
|
+
}
|
|
809
|
+
__name(updatePathOnArrayChange, "updatePathOnArrayChange");
|
|
810
|
+
function expandWildcardPath(path, data) {
|
|
811
|
+
const parts = parsePath(path);
|
|
812
|
+
const results = [];
|
|
813
|
+
function expand(currentParts, currentData, index) {
|
|
814
|
+
if (index >= parts.length) {
|
|
815
|
+
results.push(buildPath(currentParts));
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
const part = parts[index];
|
|
819
|
+
if (part.type === "wildcard") {
|
|
820
|
+
if (Array.isArray(currentData)) {
|
|
821
|
+
for (let i = 0; i < currentData.length; i++) {
|
|
822
|
+
const newParts = [
|
|
823
|
+
...currentParts,
|
|
824
|
+
{
|
|
825
|
+
type: "index",
|
|
826
|
+
index: i
|
|
827
|
+
}
|
|
828
|
+
];
|
|
829
|
+
expand(newParts, currentData[i], index + 1);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
} else {
|
|
833
|
+
const newParts = [
|
|
834
|
+
...currentParts,
|
|
835
|
+
part
|
|
836
|
+
];
|
|
837
|
+
let nextData;
|
|
838
|
+
if (part.type === "property" && typeof currentData === "object" && currentData !== null) {
|
|
839
|
+
nextData = currentData[part.name];
|
|
840
|
+
} else if (part.type === "index" && Array.isArray(currentData)) {
|
|
841
|
+
nextData = currentData[part.index];
|
|
842
|
+
}
|
|
843
|
+
expand(newParts, nextData, index + 1);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
__name(expand, "expand");
|
|
847
|
+
expand([], data, 0);
|
|
848
|
+
return results;
|
|
849
|
+
}
|
|
850
|
+
__name(expandWildcardPath, "expandWildcardPath");
|
|
851
|
+
function hasWildcard(path) {
|
|
852
|
+
return path.includes("[*]");
|
|
853
|
+
}
|
|
854
|
+
__name(hasWildcard, "hasWildcard");
|
|
855
|
+
function getParentPath(path) {
|
|
856
|
+
const parts = parsePath(path);
|
|
857
|
+
if (parts.length <= 1) {
|
|
858
|
+
return "";
|
|
859
|
+
}
|
|
860
|
+
return buildPath(parts.slice(0, -1));
|
|
861
|
+
}
|
|
862
|
+
__name(getParentPath, "getParentPath");
|
|
863
|
+
function getPathLastName(path) {
|
|
864
|
+
const parts = parsePath(path);
|
|
865
|
+
if (parts.length === 0) {
|
|
866
|
+
return "";
|
|
867
|
+
}
|
|
868
|
+
const last = parts[parts.length - 1];
|
|
869
|
+
if (last.type === "property") {
|
|
870
|
+
return last.name;
|
|
871
|
+
} else if (last.type === "index") {
|
|
872
|
+
return `[${last.index}]`;
|
|
873
|
+
} else {
|
|
874
|
+
return "[*]";
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
__name(getPathLastName, "getPathLastName");
|
|
878
|
+
|
|
101
879
|
// src/registry/BlueprintDecorators.ts
|
|
102
880
|
var registeredComponents = /* @__PURE__ */ new Map();
|
|
103
881
|
function getRegisteredBlueprintComponents() {
|
|
@@ -155,6 +933,67 @@ function BlueprintProperty(options = {}) {
|
|
|
155
933
|
};
|
|
156
934
|
}
|
|
157
935
|
__name(BlueprintProperty, "BlueprintProperty");
|
|
936
|
+
function BlueprintArray(options) {
|
|
937
|
+
return function(target, propertyKey) {
|
|
938
|
+
const key = String(propertyKey);
|
|
939
|
+
const metadata = getOrCreateMetadata(target.constructor);
|
|
940
|
+
const arraySchema = {
|
|
941
|
+
type: "array",
|
|
942
|
+
items: options.itemSchema,
|
|
943
|
+
defaultValue: options.defaultValue,
|
|
944
|
+
minItems: options.minItems,
|
|
945
|
+
maxItems: options.maxItems,
|
|
946
|
+
reorderable: options.reorderable,
|
|
947
|
+
collapsible: options.collapsible,
|
|
948
|
+
itemLabel: options.itemLabel
|
|
949
|
+
};
|
|
950
|
+
const propMeta = {
|
|
951
|
+
propertyKey: key,
|
|
952
|
+
displayName: options.displayName ?? key,
|
|
953
|
+
description: options.description,
|
|
954
|
+
pinType: "array",
|
|
955
|
+
readonly: false,
|
|
956
|
+
defaultValue: options.defaultValue,
|
|
957
|
+
schema: arraySchema,
|
|
958
|
+
isDynamicArray: true,
|
|
959
|
+
exposeElementPorts: options.exposeElementPorts,
|
|
960
|
+
portNameTemplate: options.portNameTemplate
|
|
961
|
+
};
|
|
962
|
+
const existingIndex = metadata.properties.findIndex((p) => p.propertyKey === key);
|
|
963
|
+
if (existingIndex >= 0) {
|
|
964
|
+
metadata.properties[existingIndex] = propMeta;
|
|
965
|
+
} else {
|
|
966
|
+
metadata.properties.push(propMeta);
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
__name(BlueprintArray, "BlueprintArray");
|
|
971
|
+
function BlueprintObject(options) {
|
|
972
|
+
return function(target, propertyKey) {
|
|
973
|
+
const key = String(propertyKey);
|
|
974
|
+
const metadata = getOrCreateMetadata(target.constructor);
|
|
975
|
+
const objectSchema = {
|
|
976
|
+
type: "object",
|
|
977
|
+
properties: options.properties,
|
|
978
|
+
collapsible: options.collapsible
|
|
979
|
+
};
|
|
980
|
+
const propMeta = {
|
|
981
|
+
propertyKey: key,
|
|
982
|
+
displayName: options.displayName ?? key,
|
|
983
|
+
description: options.description,
|
|
984
|
+
pinType: "object",
|
|
985
|
+
readonly: false,
|
|
986
|
+
schema: objectSchema
|
|
987
|
+
};
|
|
988
|
+
const existingIndex = metadata.properties.findIndex((p) => p.propertyKey === key);
|
|
989
|
+
if (existingIndex >= 0) {
|
|
990
|
+
metadata.properties[existingIndex] = propMeta;
|
|
991
|
+
} else {
|
|
992
|
+
metadata.properties.push(propMeta);
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
__name(BlueprintObject, "BlueprintObject");
|
|
158
997
|
function BlueprintMethod(options = {}) {
|
|
159
998
|
return function(target, propertyKey, descriptor) {
|
|
160
999
|
const key = String(propertyKey);
|
|
@@ -5407,15 +6246,2033 @@ var DivideExecutor = _DivideExecutor;
|
|
|
5407
6246
|
DivideExecutor = _ts_decorate10([
|
|
5408
6247
|
RegisterNode(DivideTemplate)
|
|
5409
6248
|
], DivideExecutor);
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
6249
|
+
var ModuloTemplate = {
|
|
6250
|
+
type: "Modulo",
|
|
6251
|
+
title: "Modulo",
|
|
6252
|
+
category: "math",
|
|
6253
|
+
color: "#4CAF50",
|
|
6254
|
+
description: "Returns the remainder of A divided by B (\u8FD4\u56DE A \u9664\u4EE5 B \u7684\u4F59\u6570)",
|
|
6255
|
+
keywords: [
|
|
6256
|
+
"modulo",
|
|
6257
|
+
"mod",
|
|
6258
|
+
"remainder",
|
|
6259
|
+
"%",
|
|
6260
|
+
"math"
|
|
6261
|
+
],
|
|
6262
|
+
isPure: true,
|
|
6263
|
+
inputs: [
|
|
6264
|
+
{
|
|
6265
|
+
name: "a",
|
|
6266
|
+
type: "float",
|
|
6267
|
+
displayName: "A",
|
|
6268
|
+
defaultValue: 0
|
|
6269
|
+
},
|
|
6270
|
+
{
|
|
6271
|
+
name: "b",
|
|
6272
|
+
type: "float",
|
|
6273
|
+
displayName: "B",
|
|
6274
|
+
defaultValue: 1
|
|
6275
|
+
}
|
|
6276
|
+
],
|
|
6277
|
+
outputs: [
|
|
6278
|
+
{
|
|
6279
|
+
name: "result",
|
|
6280
|
+
type: "float",
|
|
6281
|
+
displayName: "Result"
|
|
6282
|
+
}
|
|
6283
|
+
]
|
|
6284
|
+
};
|
|
6285
|
+
var _ModuloExecutor = class _ModuloExecutor {
|
|
6286
|
+
execute(node, context) {
|
|
6287
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
6288
|
+
const b = Number(context.evaluateInput(node.id, "b", 1));
|
|
6289
|
+
if (b === 0) return {
|
|
6290
|
+
outputs: {
|
|
6291
|
+
result: 0
|
|
6292
|
+
}
|
|
6293
|
+
};
|
|
6294
|
+
return {
|
|
6295
|
+
outputs: {
|
|
6296
|
+
result: a % b
|
|
6297
|
+
}
|
|
6298
|
+
};
|
|
6299
|
+
}
|
|
6300
|
+
};
|
|
6301
|
+
__name(_ModuloExecutor, "ModuloExecutor");
|
|
6302
|
+
var ModuloExecutor = _ModuloExecutor;
|
|
6303
|
+
ModuloExecutor = _ts_decorate10([
|
|
6304
|
+
RegisterNode(ModuloTemplate)
|
|
6305
|
+
], ModuloExecutor);
|
|
6306
|
+
var AbsTemplate = {
|
|
6307
|
+
type: "Abs",
|
|
6308
|
+
title: "Absolute",
|
|
6309
|
+
category: "math",
|
|
6310
|
+
color: "#4CAF50",
|
|
6311
|
+
description: "Returns the absolute value (\u8FD4\u56DE\u7EDD\u5BF9\u503C)",
|
|
6312
|
+
keywords: [
|
|
6313
|
+
"abs",
|
|
6314
|
+
"absolute",
|
|
6315
|
+
"math"
|
|
6316
|
+
],
|
|
6317
|
+
isPure: true,
|
|
6318
|
+
inputs: [
|
|
6319
|
+
{
|
|
6320
|
+
name: "value",
|
|
6321
|
+
type: "float",
|
|
6322
|
+
displayName: "Value",
|
|
6323
|
+
defaultValue: 0
|
|
6324
|
+
}
|
|
6325
|
+
],
|
|
6326
|
+
outputs: [
|
|
6327
|
+
{
|
|
6328
|
+
name: "result",
|
|
6329
|
+
type: "float",
|
|
6330
|
+
displayName: "Result"
|
|
6331
|
+
}
|
|
6332
|
+
]
|
|
6333
|
+
};
|
|
6334
|
+
var _AbsExecutor = class _AbsExecutor {
|
|
6335
|
+
execute(node, context) {
|
|
6336
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6337
|
+
return {
|
|
6338
|
+
outputs: {
|
|
6339
|
+
result: Math.abs(value)
|
|
6340
|
+
}
|
|
6341
|
+
};
|
|
6342
|
+
}
|
|
6343
|
+
};
|
|
6344
|
+
__name(_AbsExecutor, "AbsExecutor");
|
|
6345
|
+
var AbsExecutor = _AbsExecutor;
|
|
6346
|
+
AbsExecutor = _ts_decorate10([
|
|
6347
|
+
RegisterNode(AbsTemplate)
|
|
6348
|
+
], AbsExecutor);
|
|
6349
|
+
var MinTemplate = {
|
|
6350
|
+
type: "Min",
|
|
6351
|
+
title: "Min",
|
|
6352
|
+
category: "math",
|
|
6353
|
+
color: "#4CAF50",
|
|
6354
|
+
description: "Returns the smaller of two values (\u8FD4\u56DE\u4E24\u4E2A\u503C\u4E2D\u8F83\u5C0F\u7684\u4E00\u4E2A)",
|
|
6355
|
+
keywords: [
|
|
6356
|
+
"min",
|
|
6357
|
+
"minimum",
|
|
6358
|
+
"smaller",
|
|
6359
|
+
"math"
|
|
6360
|
+
],
|
|
6361
|
+
isPure: true,
|
|
6362
|
+
inputs: [
|
|
6363
|
+
{
|
|
6364
|
+
name: "a",
|
|
6365
|
+
type: "float",
|
|
6366
|
+
displayName: "A",
|
|
6367
|
+
defaultValue: 0
|
|
6368
|
+
},
|
|
6369
|
+
{
|
|
6370
|
+
name: "b",
|
|
6371
|
+
type: "float",
|
|
6372
|
+
displayName: "B",
|
|
6373
|
+
defaultValue: 0
|
|
6374
|
+
}
|
|
6375
|
+
],
|
|
6376
|
+
outputs: [
|
|
6377
|
+
{
|
|
6378
|
+
name: "result",
|
|
6379
|
+
type: "float",
|
|
6380
|
+
displayName: "Result"
|
|
6381
|
+
}
|
|
6382
|
+
]
|
|
6383
|
+
};
|
|
6384
|
+
var _MinExecutor = class _MinExecutor {
|
|
6385
|
+
execute(node, context) {
|
|
6386
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
6387
|
+
const b = Number(context.evaluateInput(node.id, "b", 0));
|
|
6388
|
+
return {
|
|
6389
|
+
outputs: {
|
|
6390
|
+
result: Math.min(a, b)
|
|
6391
|
+
}
|
|
6392
|
+
};
|
|
6393
|
+
}
|
|
6394
|
+
};
|
|
6395
|
+
__name(_MinExecutor, "MinExecutor");
|
|
6396
|
+
var MinExecutor = _MinExecutor;
|
|
6397
|
+
MinExecutor = _ts_decorate10([
|
|
6398
|
+
RegisterNode(MinTemplate)
|
|
6399
|
+
], MinExecutor);
|
|
6400
|
+
var MaxTemplate = {
|
|
6401
|
+
type: "Max",
|
|
6402
|
+
title: "Max",
|
|
6403
|
+
category: "math",
|
|
6404
|
+
color: "#4CAF50",
|
|
6405
|
+
description: "Returns the larger of two values (\u8FD4\u56DE\u4E24\u4E2A\u503C\u4E2D\u8F83\u5927\u7684\u4E00\u4E2A)",
|
|
6406
|
+
keywords: [
|
|
6407
|
+
"max",
|
|
6408
|
+
"maximum",
|
|
6409
|
+
"larger",
|
|
6410
|
+
"math"
|
|
6411
|
+
],
|
|
6412
|
+
isPure: true,
|
|
6413
|
+
inputs: [
|
|
6414
|
+
{
|
|
6415
|
+
name: "a",
|
|
6416
|
+
type: "float",
|
|
6417
|
+
displayName: "A",
|
|
6418
|
+
defaultValue: 0
|
|
6419
|
+
},
|
|
6420
|
+
{
|
|
6421
|
+
name: "b",
|
|
6422
|
+
type: "float",
|
|
6423
|
+
displayName: "B",
|
|
6424
|
+
defaultValue: 0
|
|
6425
|
+
}
|
|
6426
|
+
],
|
|
6427
|
+
outputs: [
|
|
6428
|
+
{
|
|
6429
|
+
name: "result",
|
|
6430
|
+
type: "float",
|
|
6431
|
+
displayName: "Result"
|
|
6432
|
+
}
|
|
6433
|
+
]
|
|
6434
|
+
};
|
|
6435
|
+
var _MaxExecutor = class _MaxExecutor {
|
|
6436
|
+
execute(node, context) {
|
|
6437
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
6438
|
+
const b = Number(context.evaluateInput(node.id, "b", 0));
|
|
6439
|
+
return {
|
|
6440
|
+
outputs: {
|
|
6441
|
+
result: Math.max(a, b)
|
|
6442
|
+
}
|
|
6443
|
+
};
|
|
6444
|
+
}
|
|
6445
|
+
};
|
|
6446
|
+
__name(_MaxExecutor, "MaxExecutor");
|
|
6447
|
+
var MaxExecutor = _MaxExecutor;
|
|
6448
|
+
MaxExecutor = _ts_decorate10([
|
|
6449
|
+
RegisterNode(MaxTemplate)
|
|
6450
|
+
], MaxExecutor);
|
|
6451
|
+
var ClampTemplate = {
|
|
6452
|
+
type: "Clamp",
|
|
6453
|
+
title: "Clamp",
|
|
6454
|
+
category: "math",
|
|
6455
|
+
color: "#4CAF50",
|
|
6456
|
+
description: "Clamps a value between min and max (\u5C06\u503C\u9650\u5236\u5728\u6700\u5C0F\u548C\u6700\u5927\u4E4B\u95F4)",
|
|
6457
|
+
keywords: [
|
|
6458
|
+
"clamp",
|
|
6459
|
+
"limit",
|
|
6460
|
+
"range",
|
|
6461
|
+
"bound",
|
|
6462
|
+
"math"
|
|
6463
|
+
],
|
|
6464
|
+
isPure: true,
|
|
6465
|
+
inputs: [
|
|
6466
|
+
{
|
|
6467
|
+
name: "value",
|
|
6468
|
+
type: "float",
|
|
6469
|
+
displayName: "Value",
|
|
6470
|
+
defaultValue: 0
|
|
6471
|
+
},
|
|
6472
|
+
{
|
|
6473
|
+
name: "min",
|
|
6474
|
+
type: "float",
|
|
6475
|
+
displayName: "Min",
|
|
6476
|
+
defaultValue: 0
|
|
6477
|
+
},
|
|
6478
|
+
{
|
|
6479
|
+
name: "max",
|
|
6480
|
+
type: "float",
|
|
6481
|
+
displayName: "Max",
|
|
6482
|
+
defaultValue: 1
|
|
6483
|
+
}
|
|
6484
|
+
],
|
|
6485
|
+
outputs: [
|
|
6486
|
+
{
|
|
6487
|
+
name: "result",
|
|
6488
|
+
type: "float",
|
|
6489
|
+
displayName: "Result"
|
|
6490
|
+
}
|
|
6491
|
+
]
|
|
6492
|
+
};
|
|
6493
|
+
var _ClampExecutor = class _ClampExecutor {
|
|
6494
|
+
execute(node, context) {
|
|
6495
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6496
|
+
const min = Number(context.evaluateInput(node.id, "min", 0));
|
|
6497
|
+
const max = Number(context.evaluateInput(node.id, "max", 1));
|
|
6498
|
+
return {
|
|
6499
|
+
outputs: {
|
|
6500
|
+
result: Math.max(min, Math.min(max, value))
|
|
6501
|
+
}
|
|
6502
|
+
};
|
|
6503
|
+
}
|
|
6504
|
+
};
|
|
6505
|
+
__name(_ClampExecutor, "ClampExecutor");
|
|
6506
|
+
var ClampExecutor = _ClampExecutor;
|
|
6507
|
+
ClampExecutor = _ts_decorate10([
|
|
6508
|
+
RegisterNode(ClampTemplate)
|
|
6509
|
+
], ClampExecutor);
|
|
6510
|
+
var LerpTemplate = {
|
|
6511
|
+
type: "Lerp",
|
|
6512
|
+
title: "Lerp",
|
|
6513
|
+
category: "math",
|
|
6514
|
+
color: "#4CAF50",
|
|
6515
|
+
description: "Linear interpolation between A and B (A \u548C B \u4E4B\u95F4\u7684\u7EBF\u6027\u63D2\u503C)",
|
|
6516
|
+
keywords: [
|
|
6517
|
+
"lerp",
|
|
6518
|
+
"interpolate",
|
|
6519
|
+
"blend",
|
|
6520
|
+
"mix",
|
|
6521
|
+
"math"
|
|
6522
|
+
],
|
|
6523
|
+
isPure: true,
|
|
6524
|
+
inputs: [
|
|
6525
|
+
{
|
|
6526
|
+
name: "a",
|
|
6527
|
+
type: "float",
|
|
6528
|
+
displayName: "A",
|
|
6529
|
+
defaultValue: 0
|
|
6530
|
+
},
|
|
6531
|
+
{
|
|
6532
|
+
name: "b",
|
|
6533
|
+
type: "float",
|
|
6534
|
+
displayName: "B",
|
|
6535
|
+
defaultValue: 1
|
|
6536
|
+
},
|
|
6537
|
+
{
|
|
6538
|
+
name: "t",
|
|
6539
|
+
type: "float",
|
|
6540
|
+
displayName: "Alpha",
|
|
6541
|
+
defaultValue: 0.5
|
|
6542
|
+
}
|
|
6543
|
+
],
|
|
6544
|
+
outputs: [
|
|
6545
|
+
{
|
|
6546
|
+
name: "result",
|
|
6547
|
+
type: "float",
|
|
6548
|
+
displayName: "Result"
|
|
6549
|
+
}
|
|
6550
|
+
]
|
|
6551
|
+
};
|
|
6552
|
+
var _LerpExecutor = class _LerpExecutor {
|
|
6553
|
+
execute(node, context) {
|
|
6554
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
6555
|
+
const b = Number(context.evaluateInput(node.id, "b", 1));
|
|
6556
|
+
const t = Number(context.evaluateInput(node.id, "t", 0.5));
|
|
6557
|
+
return {
|
|
6558
|
+
outputs: {
|
|
6559
|
+
result: a + (b - a) * t
|
|
6560
|
+
}
|
|
6561
|
+
};
|
|
6562
|
+
}
|
|
6563
|
+
};
|
|
6564
|
+
__name(_LerpExecutor, "LerpExecutor");
|
|
6565
|
+
var LerpExecutor = _LerpExecutor;
|
|
6566
|
+
LerpExecutor = _ts_decorate10([
|
|
6567
|
+
RegisterNode(LerpTemplate)
|
|
6568
|
+
], LerpExecutor);
|
|
6569
|
+
var RandomRangeTemplate = {
|
|
6570
|
+
type: "RandomRange",
|
|
6571
|
+
title: "Random Range",
|
|
6572
|
+
category: "math",
|
|
6573
|
+
color: "#4CAF50",
|
|
6574
|
+
description: "Returns a random number between min and max (\u8FD4\u56DE min \u548C max \u4E4B\u95F4\u7684\u968F\u673A\u6570)",
|
|
6575
|
+
keywords: [
|
|
6576
|
+
"random",
|
|
6577
|
+
"range",
|
|
6578
|
+
"rand",
|
|
6579
|
+
"math"
|
|
6580
|
+
],
|
|
6581
|
+
isPure: true,
|
|
6582
|
+
inputs: [
|
|
6583
|
+
{
|
|
6584
|
+
name: "min",
|
|
6585
|
+
type: "float",
|
|
6586
|
+
displayName: "Min",
|
|
6587
|
+
defaultValue: 0
|
|
6588
|
+
},
|
|
6589
|
+
{
|
|
6590
|
+
name: "max",
|
|
6591
|
+
type: "float",
|
|
6592
|
+
displayName: "Max",
|
|
6593
|
+
defaultValue: 1
|
|
6594
|
+
}
|
|
6595
|
+
],
|
|
6596
|
+
outputs: [
|
|
6597
|
+
{
|
|
6598
|
+
name: "result",
|
|
6599
|
+
type: "float",
|
|
6600
|
+
displayName: "Result"
|
|
6601
|
+
}
|
|
6602
|
+
]
|
|
6603
|
+
};
|
|
6604
|
+
var _RandomRangeExecutor = class _RandomRangeExecutor {
|
|
6605
|
+
execute(node, context) {
|
|
6606
|
+
const min = Number(context.evaluateInput(node.id, "min", 0));
|
|
6607
|
+
const max = Number(context.evaluateInput(node.id, "max", 1));
|
|
6608
|
+
return {
|
|
6609
|
+
outputs: {
|
|
6610
|
+
result: min + Math.random() * (max - min)
|
|
6611
|
+
}
|
|
6612
|
+
};
|
|
6613
|
+
}
|
|
6614
|
+
};
|
|
6615
|
+
__name(_RandomRangeExecutor, "RandomRangeExecutor");
|
|
6616
|
+
var RandomRangeExecutor = _RandomRangeExecutor;
|
|
6617
|
+
RandomRangeExecutor = _ts_decorate10([
|
|
6618
|
+
RegisterNode(RandomRangeTemplate)
|
|
6619
|
+
], RandomRangeExecutor);
|
|
6620
|
+
var RandomIntTemplate = {
|
|
6621
|
+
type: "RandomInt",
|
|
6622
|
+
title: "Random Integer",
|
|
6623
|
+
category: "math",
|
|
6624
|
+
color: "#4CAF50",
|
|
6625
|
+
description: "Returns a random integer between min and max inclusive (\u8FD4\u56DE min \u548C max \u4E4B\u95F4\u7684\u968F\u673A\u6574\u6570\uFF0C\u5305\u542B\u8FB9\u754C)",
|
|
6626
|
+
keywords: [
|
|
6627
|
+
"random",
|
|
6628
|
+
"int",
|
|
6629
|
+
"integer",
|
|
6630
|
+
"rand",
|
|
6631
|
+
"math"
|
|
6632
|
+
],
|
|
6633
|
+
isPure: true,
|
|
6634
|
+
inputs: [
|
|
6635
|
+
{
|
|
6636
|
+
name: "min",
|
|
6637
|
+
type: "int",
|
|
6638
|
+
displayName: "Min",
|
|
6639
|
+
defaultValue: 0
|
|
6640
|
+
},
|
|
6641
|
+
{
|
|
6642
|
+
name: "max",
|
|
6643
|
+
type: "int",
|
|
6644
|
+
displayName: "Max",
|
|
6645
|
+
defaultValue: 10
|
|
6646
|
+
}
|
|
6647
|
+
],
|
|
6648
|
+
outputs: [
|
|
6649
|
+
{
|
|
6650
|
+
name: "result",
|
|
6651
|
+
type: "int",
|
|
6652
|
+
displayName: "Result"
|
|
6653
|
+
}
|
|
6654
|
+
]
|
|
6655
|
+
};
|
|
6656
|
+
var _RandomIntExecutor = class _RandomIntExecutor {
|
|
6657
|
+
execute(node, context) {
|
|
6658
|
+
const min = Math.floor(Number(context.evaluateInput(node.id, "min", 0)));
|
|
6659
|
+
const max = Math.floor(Number(context.evaluateInput(node.id, "max", 10)));
|
|
6660
|
+
return {
|
|
6661
|
+
outputs: {
|
|
6662
|
+
result: Math.floor(min + Math.random() * (max - min + 1))
|
|
6663
|
+
}
|
|
6664
|
+
};
|
|
6665
|
+
}
|
|
6666
|
+
};
|
|
6667
|
+
__name(_RandomIntExecutor, "RandomIntExecutor");
|
|
6668
|
+
var RandomIntExecutor = _RandomIntExecutor;
|
|
6669
|
+
RandomIntExecutor = _ts_decorate10([
|
|
6670
|
+
RegisterNode(RandomIntTemplate)
|
|
6671
|
+
], RandomIntExecutor);
|
|
6672
|
+
var PowerTemplate = {
|
|
6673
|
+
type: "Power",
|
|
6674
|
+
title: "Power",
|
|
6675
|
+
category: "math",
|
|
6676
|
+
color: "#4CAF50",
|
|
6677
|
+
description: "Returns base raised to the power of exponent (\u8FD4\u56DE\u5E95\u6570\u7684\u6307\u6570\u6B21\u5E42)",
|
|
6678
|
+
keywords: [
|
|
6679
|
+
"power",
|
|
6680
|
+
"pow",
|
|
6681
|
+
"exponent",
|
|
6682
|
+
"^",
|
|
6683
|
+
"math"
|
|
6684
|
+
],
|
|
6685
|
+
isPure: true,
|
|
6686
|
+
inputs: [
|
|
6687
|
+
{
|
|
6688
|
+
name: "base",
|
|
6689
|
+
type: "float",
|
|
6690
|
+
displayName: "Base",
|
|
6691
|
+
defaultValue: 2
|
|
6692
|
+
},
|
|
6693
|
+
{
|
|
6694
|
+
name: "exponent",
|
|
6695
|
+
type: "float",
|
|
6696
|
+
displayName: "Exponent",
|
|
6697
|
+
defaultValue: 2
|
|
6698
|
+
}
|
|
6699
|
+
],
|
|
6700
|
+
outputs: [
|
|
6701
|
+
{
|
|
6702
|
+
name: "result",
|
|
6703
|
+
type: "float",
|
|
6704
|
+
displayName: "Result"
|
|
6705
|
+
}
|
|
6706
|
+
]
|
|
6707
|
+
};
|
|
6708
|
+
var _PowerExecutor = class _PowerExecutor {
|
|
6709
|
+
execute(node, context) {
|
|
6710
|
+
const base = Number(context.evaluateInput(node.id, "base", 2));
|
|
6711
|
+
const exponent = Number(context.evaluateInput(node.id, "exponent", 2));
|
|
6712
|
+
return {
|
|
6713
|
+
outputs: {
|
|
6714
|
+
result: Math.pow(base, exponent)
|
|
6715
|
+
}
|
|
6716
|
+
};
|
|
6717
|
+
}
|
|
6718
|
+
};
|
|
6719
|
+
__name(_PowerExecutor, "PowerExecutor");
|
|
6720
|
+
var PowerExecutor = _PowerExecutor;
|
|
6721
|
+
PowerExecutor = _ts_decorate10([
|
|
6722
|
+
RegisterNode(PowerTemplate)
|
|
6723
|
+
], PowerExecutor);
|
|
6724
|
+
var SqrtTemplate = {
|
|
6725
|
+
type: "Sqrt",
|
|
6726
|
+
title: "Square Root",
|
|
6727
|
+
category: "math",
|
|
6728
|
+
color: "#4CAF50",
|
|
6729
|
+
description: "Returns the square root (\u8FD4\u56DE\u5E73\u65B9\u6839)",
|
|
6730
|
+
keywords: [
|
|
6731
|
+
"sqrt",
|
|
6732
|
+
"square",
|
|
6733
|
+
"root",
|
|
6734
|
+
"math"
|
|
6735
|
+
],
|
|
6736
|
+
isPure: true,
|
|
6737
|
+
inputs: [
|
|
6738
|
+
{
|
|
6739
|
+
name: "value",
|
|
6740
|
+
type: "float",
|
|
6741
|
+
displayName: "Value",
|
|
6742
|
+
defaultValue: 4
|
|
6743
|
+
}
|
|
6744
|
+
],
|
|
6745
|
+
outputs: [
|
|
6746
|
+
{
|
|
6747
|
+
name: "result",
|
|
6748
|
+
type: "float",
|
|
6749
|
+
displayName: "Result"
|
|
6750
|
+
}
|
|
6751
|
+
]
|
|
6752
|
+
};
|
|
6753
|
+
var _SqrtExecutor = class _SqrtExecutor {
|
|
6754
|
+
execute(node, context) {
|
|
6755
|
+
const value = Number(context.evaluateInput(node.id, "value", 4));
|
|
6756
|
+
return {
|
|
6757
|
+
outputs: {
|
|
6758
|
+
result: Math.sqrt(Math.abs(value))
|
|
6759
|
+
}
|
|
6760
|
+
};
|
|
6761
|
+
}
|
|
6762
|
+
};
|
|
6763
|
+
__name(_SqrtExecutor, "SqrtExecutor");
|
|
6764
|
+
var SqrtExecutor = _SqrtExecutor;
|
|
6765
|
+
SqrtExecutor = _ts_decorate10([
|
|
6766
|
+
RegisterNode(SqrtTemplate)
|
|
6767
|
+
], SqrtExecutor);
|
|
6768
|
+
var FloorTemplate = {
|
|
6769
|
+
type: "Floor",
|
|
6770
|
+
title: "Floor",
|
|
6771
|
+
category: "math",
|
|
6772
|
+
color: "#4CAF50",
|
|
6773
|
+
description: "Rounds down to the nearest integer (\u5411\u4E0B\u53D6\u6574)",
|
|
6774
|
+
keywords: [
|
|
6775
|
+
"floor",
|
|
6776
|
+
"round",
|
|
6777
|
+
"down",
|
|
6778
|
+
"int",
|
|
6779
|
+
"math"
|
|
6780
|
+
],
|
|
6781
|
+
isPure: true,
|
|
6782
|
+
inputs: [
|
|
6783
|
+
{
|
|
6784
|
+
name: "value",
|
|
6785
|
+
type: "float",
|
|
6786
|
+
displayName: "Value",
|
|
6787
|
+
defaultValue: 0
|
|
6788
|
+
}
|
|
6789
|
+
],
|
|
6790
|
+
outputs: [
|
|
6791
|
+
{
|
|
6792
|
+
name: "result",
|
|
6793
|
+
type: "int",
|
|
6794
|
+
displayName: "Result"
|
|
6795
|
+
}
|
|
6796
|
+
]
|
|
6797
|
+
};
|
|
6798
|
+
var _FloorExecutor = class _FloorExecutor {
|
|
6799
|
+
execute(node, context) {
|
|
6800
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6801
|
+
return {
|
|
6802
|
+
outputs: {
|
|
6803
|
+
result: Math.floor(value)
|
|
6804
|
+
}
|
|
6805
|
+
};
|
|
6806
|
+
}
|
|
6807
|
+
};
|
|
6808
|
+
__name(_FloorExecutor, "FloorExecutor");
|
|
6809
|
+
var FloorExecutor = _FloorExecutor;
|
|
6810
|
+
FloorExecutor = _ts_decorate10([
|
|
6811
|
+
RegisterNode(FloorTemplate)
|
|
6812
|
+
], FloorExecutor);
|
|
6813
|
+
var CeilTemplate = {
|
|
6814
|
+
type: "Ceil",
|
|
6815
|
+
title: "Ceil",
|
|
6816
|
+
category: "math",
|
|
6817
|
+
color: "#4CAF50",
|
|
6818
|
+
description: "Rounds up to the nearest integer (\u5411\u4E0A\u53D6\u6574)",
|
|
6819
|
+
keywords: [
|
|
6820
|
+
"ceil",
|
|
6821
|
+
"ceiling",
|
|
6822
|
+
"round",
|
|
6823
|
+
"up",
|
|
6824
|
+
"int",
|
|
6825
|
+
"math"
|
|
6826
|
+
],
|
|
6827
|
+
isPure: true,
|
|
6828
|
+
inputs: [
|
|
6829
|
+
{
|
|
6830
|
+
name: "value",
|
|
6831
|
+
type: "float",
|
|
6832
|
+
displayName: "Value",
|
|
6833
|
+
defaultValue: 0
|
|
6834
|
+
}
|
|
6835
|
+
],
|
|
6836
|
+
outputs: [
|
|
6837
|
+
{
|
|
6838
|
+
name: "result",
|
|
6839
|
+
type: "int",
|
|
6840
|
+
displayName: "Result"
|
|
6841
|
+
}
|
|
6842
|
+
]
|
|
6843
|
+
};
|
|
6844
|
+
var _CeilExecutor = class _CeilExecutor {
|
|
6845
|
+
execute(node, context) {
|
|
6846
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6847
|
+
return {
|
|
6848
|
+
outputs: {
|
|
6849
|
+
result: Math.ceil(value)
|
|
6850
|
+
}
|
|
6851
|
+
};
|
|
6852
|
+
}
|
|
6853
|
+
};
|
|
6854
|
+
__name(_CeilExecutor, "CeilExecutor");
|
|
6855
|
+
var CeilExecutor = _CeilExecutor;
|
|
6856
|
+
CeilExecutor = _ts_decorate10([
|
|
6857
|
+
RegisterNode(CeilTemplate)
|
|
6858
|
+
], CeilExecutor);
|
|
6859
|
+
var RoundTemplate = {
|
|
6860
|
+
type: "Round",
|
|
6861
|
+
title: "Round",
|
|
6862
|
+
category: "math",
|
|
6863
|
+
color: "#4CAF50",
|
|
6864
|
+
description: "Rounds to the nearest integer (\u56DB\u820D\u4E94\u5165\u5230\u6700\u8FD1\u7684\u6574\u6570)",
|
|
6865
|
+
keywords: [
|
|
6866
|
+
"round",
|
|
6867
|
+
"int",
|
|
6868
|
+
"math"
|
|
6869
|
+
],
|
|
6870
|
+
isPure: true,
|
|
6871
|
+
inputs: [
|
|
6872
|
+
{
|
|
6873
|
+
name: "value",
|
|
6874
|
+
type: "float",
|
|
6875
|
+
displayName: "Value",
|
|
6876
|
+
defaultValue: 0
|
|
6877
|
+
}
|
|
6878
|
+
],
|
|
6879
|
+
outputs: [
|
|
6880
|
+
{
|
|
6881
|
+
name: "result",
|
|
6882
|
+
type: "int",
|
|
6883
|
+
displayName: "Result"
|
|
6884
|
+
}
|
|
6885
|
+
]
|
|
6886
|
+
};
|
|
6887
|
+
var _RoundExecutor = class _RoundExecutor {
|
|
6888
|
+
execute(node, context) {
|
|
6889
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6890
|
+
return {
|
|
6891
|
+
outputs: {
|
|
6892
|
+
result: Math.round(value)
|
|
6893
|
+
}
|
|
6894
|
+
};
|
|
6895
|
+
}
|
|
6896
|
+
};
|
|
6897
|
+
__name(_RoundExecutor, "RoundExecutor");
|
|
6898
|
+
var RoundExecutor = _RoundExecutor;
|
|
6899
|
+
RoundExecutor = _ts_decorate10([
|
|
6900
|
+
RegisterNode(RoundTemplate)
|
|
6901
|
+
], RoundExecutor);
|
|
6902
|
+
var NegateTemplate = {
|
|
6903
|
+
type: "Negate",
|
|
6904
|
+
title: "Negate",
|
|
6905
|
+
category: "math",
|
|
6906
|
+
color: "#4CAF50",
|
|
6907
|
+
description: "Returns the negative of a value (\u8FD4\u56DE\u503C\u7684\u8D1F\u6570)",
|
|
6908
|
+
keywords: [
|
|
6909
|
+
"negate",
|
|
6910
|
+
"negative",
|
|
6911
|
+
"minus",
|
|
6912
|
+
"-",
|
|
6913
|
+
"math"
|
|
6914
|
+
],
|
|
6915
|
+
isPure: true,
|
|
6916
|
+
inputs: [
|
|
6917
|
+
{
|
|
6918
|
+
name: "value",
|
|
6919
|
+
type: "float",
|
|
6920
|
+
displayName: "Value",
|
|
6921
|
+
defaultValue: 0
|
|
6922
|
+
}
|
|
6923
|
+
],
|
|
6924
|
+
outputs: [
|
|
6925
|
+
{
|
|
6926
|
+
name: "result",
|
|
6927
|
+
type: "float",
|
|
6928
|
+
displayName: "Result"
|
|
6929
|
+
}
|
|
6930
|
+
]
|
|
6931
|
+
};
|
|
6932
|
+
var _NegateExecutor = class _NegateExecutor {
|
|
6933
|
+
execute(node, context) {
|
|
6934
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6935
|
+
return {
|
|
6936
|
+
outputs: {
|
|
6937
|
+
result: -value
|
|
6938
|
+
}
|
|
6939
|
+
};
|
|
6940
|
+
}
|
|
6941
|
+
};
|
|
6942
|
+
__name(_NegateExecutor, "NegateExecutor");
|
|
6943
|
+
var NegateExecutor = _NegateExecutor;
|
|
6944
|
+
NegateExecutor = _ts_decorate10([
|
|
6945
|
+
RegisterNode(NegateTemplate)
|
|
6946
|
+
], NegateExecutor);
|
|
6947
|
+
var SignTemplate = {
|
|
6948
|
+
type: "Sign",
|
|
6949
|
+
title: "Sign",
|
|
6950
|
+
category: "math",
|
|
6951
|
+
color: "#4CAF50",
|
|
6952
|
+
description: "Returns -1, 0, or 1 based on the sign of the value (\u6839\u636E\u503C\u7684\u7B26\u53F7\u8FD4\u56DE -1\u30010 \u6216 1)",
|
|
6953
|
+
keywords: [
|
|
6954
|
+
"sign",
|
|
6955
|
+
"positive",
|
|
6956
|
+
"negative",
|
|
6957
|
+
"math"
|
|
6958
|
+
],
|
|
6959
|
+
isPure: true,
|
|
6960
|
+
inputs: [
|
|
6961
|
+
{
|
|
6962
|
+
name: "value",
|
|
6963
|
+
type: "float",
|
|
6964
|
+
displayName: "Value",
|
|
6965
|
+
defaultValue: 0
|
|
6966
|
+
}
|
|
6967
|
+
],
|
|
6968
|
+
outputs: [
|
|
6969
|
+
{
|
|
6970
|
+
name: "result",
|
|
6971
|
+
type: "int",
|
|
6972
|
+
displayName: "Result"
|
|
6973
|
+
}
|
|
6974
|
+
]
|
|
6975
|
+
};
|
|
6976
|
+
var _SignExecutor = class _SignExecutor {
|
|
6977
|
+
execute(node, context) {
|
|
6978
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
6979
|
+
return {
|
|
6980
|
+
outputs: {
|
|
6981
|
+
result: Math.sign(value)
|
|
6982
|
+
}
|
|
6983
|
+
};
|
|
6984
|
+
}
|
|
6985
|
+
};
|
|
6986
|
+
__name(_SignExecutor, "SignExecutor");
|
|
6987
|
+
var SignExecutor = _SignExecutor;
|
|
6988
|
+
SignExecutor = _ts_decorate10([
|
|
6989
|
+
RegisterNode(SignTemplate)
|
|
6990
|
+
], SignExecutor);
|
|
6991
|
+
var WrapTemplate = {
|
|
6992
|
+
type: "Wrap",
|
|
6993
|
+
title: "Wrap",
|
|
6994
|
+
category: "math",
|
|
6995
|
+
color: "#4CAF50",
|
|
6996
|
+
description: "Wraps value to stay within min and max range (\u5C06\u503C\u5FAA\u73AF\u9650\u5236\u5728\u8303\u56F4\u5185)",
|
|
6997
|
+
keywords: [
|
|
6998
|
+
"wrap",
|
|
6999
|
+
"loop",
|
|
7000
|
+
"cycle",
|
|
7001
|
+
"range",
|
|
7002
|
+
"math"
|
|
7003
|
+
],
|
|
7004
|
+
isPure: true,
|
|
7005
|
+
inputs: [
|
|
7006
|
+
{
|
|
7007
|
+
name: "value",
|
|
7008
|
+
type: "float",
|
|
7009
|
+
displayName: "Value",
|
|
7010
|
+
defaultValue: 0
|
|
7011
|
+
},
|
|
7012
|
+
{
|
|
7013
|
+
name: "min",
|
|
7014
|
+
type: "float",
|
|
7015
|
+
displayName: "Min",
|
|
7016
|
+
defaultValue: 0
|
|
7017
|
+
},
|
|
7018
|
+
{
|
|
7019
|
+
name: "max",
|
|
7020
|
+
type: "float",
|
|
7021
|
+
displayName: "Max",
|
|
7022
|
+
defaultValue: 1
|
|
7023
|
+
}
|
|
7024
|
+
],
|
|
7025
|
+
outputs: [
|
|
7026
|
+
{
|
|
7027
|
+
name: "result",
|
|
7028
|
+
type: "float",
|
|
7029
|
+
displayName: "Result"
|
|
7030
|
+
}
|
|
7031
|
+
]
|
|
7032
|
+
};
|
|
7033
|
+
var _WrapExecutor = class _WrapExecutor {
|
|
7034
|
+
execute(node, context) {
|
|
7035
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
7036
|
+
const min = Number(context.evaluateInput(node.id, "min", 0));
|
|
7037
|
+
const max = Number(context.evaluateInput(node.id, "max", 1));
|
|
7038
|
+
const range = max - min;
|
|
7039
|
+
if (range <= 0) return {
|
|
7040
|
+
outputs: {
|
|
7041
|
+
result: min
|
|
7042
|
+
}
|
|
7043
|
+
};
|
|
7044
|
+
const wrapped = ((value - min) % range + range) % range + min;
|
|
7045
|
+
return {
|
|
7046
|
+
outputs: {
|
|
7047
|
+
result: wrapped
|
|
7048
|
+
}
|
|
7049
|
+
};
|
|
7050
|
+
}
|
|
7051
|
+
};
|
|
7052
|
+
__name(_WrapExecutor, "WrapExecutor");
|
|
7053
|
+
var WrapExecutor = _WrapExecutor;
|
|
7054
|
+
WrapExecutor = _ts_decorate10([
|
|
7055
|
+
RegisterNode(WrapTemplate)
|
|
7056
|
+
], WrapExecutor);
|
|
7057
|
+
var SinTemplate = {
|
|
7058
|
+
type: "Sin",
|
|
7059
|
+
title: "Sin",
|
|
7060
|
+
category: "math",
|
|
7061
|
+
color: "#4CAF50",
|
|
7062
|
+
description: "Returns the sine of angle in radians (\u8FD4\u56DE\u5F27\u5EA6\u89D2\u7684\u6B63\u5F26\u503C)",
|
|
7063
|
+
keywords: [
|
|
7064
|
+
"sin",
|
|
7065
|
+
"sine",
|
|
7066
|
+
"trig",
|
|
7067
|
+
"math"
|
|
7068
|
+
],
|
|
7069
|
+
isPure: true,
|
|
7070
|
+
inputs: [
|
|
7071
|
+
{
|
|
7072
|
+
name: "radians",
|
|
7073
|
+
type: "float",
|
|
7074
|
+
displayName: "Radians",
|
|
7075
|
+
defaultValue: 0
|
|
7076
|
+
}
|
|
7077
|
+
],
|
|
7078
|
+
outputs: [
|
|
7079
|
+
{
|
|
7080
|
+
name: "result",
|
|
7081
|
+
type: "float",
|
|
7082
|
+
displayName: "Result"
|
|
7083
|
+
}
|
|
7084
|
+
]
|
|
7085
|
+
};
|
|
7086
|
+
var _SinExecutor = class _SinExecutor {
|
|
7087
|
+
execute(node, context) {
|
|
7088
|
+
const radians = Number(context.evaluateInput(node.id, "radians", 0));
|
|
7089
|
+
return {
|
|
7090
|
+
outputs: {
|
|
7091
|
+
result: Math.sin(radians)
|
|
7092
|
+
}
|
|
7093
|
+
};
|
|
7094
|
+
}
|
|
7095
|
+
};
|
|
7096
|
+
__name(_SinExecutor, "SinExecutor");
|
|
7097
|
+
var SinExecutor = _SinExecutor;
|
|
7098
|
+
SinExecutor = _ts_decorate10([
|
|
7099
|
+
RegisterNode(SinTemplate)
|
|
7100
|
+
], SinExecutor);
|
|
7101
|
+
var CosTemplate = {
|
|
7102
|
+
type: "Cos",
|
|
7103
|
+
title: "Cos",
|
|
7104
|
+
category: "math",
|
|
7105
|
+
color: "#4CAF50",
|
|
7106
|
+
description: "Returns the cosine of angle in radians (\u8FD4\u56DE\u5F27\u5EA6\u89D2\u7684\u4F59\u5F26\u503C)",
|
|
7107
|
+
keywords: [
|
|
7108
|
+
"cos",
|
|
7109
|
+
"cosine",
|
|
7110
|
+
"trig",
|
|
7111
|
+
"math"
|
|
7112
|
+
],
|
|
7113
|
+
isPure: true,
|
|
7114
|
+
inputs: [
|
|
7115
|
+
{
|
|
7116
|
+
name: "radians",
|
|
7117
|
+
type: "float",
|
|
7118
|
+
displayName: "Radians",
|
|
7119
|
+
defaultValue: 0
|
|
7120
|
+
}
|
|
7121
|
+
],
|
|
7122
|
+
outputs: [
|
|
7123
|
+
{
|
|
7124
|
+
name: "result",
|
|
7125
|
+
type: "float",
|
|
7126
|
+
displayName: "Result"
|
|
7127
|
+
}
|
|
7128
|
+
]
|
|
7129
|
+
};
|
|
7130
|
+
var _CosExecutor = class _CosExecutor {
|
|
7131
|
+
execute(node, context) {
|
|
7132
|
+
const radians = Number(context.evaluateInput(node.id, "radians", 0));
|
|
7133
|
+
return {
|
|
7134
|
+
outputs: {
|
|
7135
|
+
result: Math.cos(radians)
|
|
7136
|
+
}
|
|
7137
|
+
};
|
|
7138
|
+
}
|
|
7139
|
+
};
|
|
7140
|
+
__name(_CosExecutor, "CosExecutor");
|
|
7141
|
+
var CosExecutor = _CosExecutor;
|
|
7142
|
+
CosExecutor = _ts_decorate10([
|
|
7143
|
+
RegisterNode(CosTemplate)
|
|
7144
|
+
], CosExecutor);
|
|
7145
|
+
var TanTemplate = {
|
|
7146
|
+
type: "Tan",
|
|
7147
|
+
title: "Tan",
|
|
7148
|
+
category: "math",
|
|
7149
|
+
color: "#4CAF50",
|
|
7150
|
+
description: "Returns the tangent of angle in radians (\u8FD4\u56DE\u5F27\u5EA6\u89D2\u7684\u6B63\u5207\u503C)",
|
|
7151
|
+
keywords: [
|
|
7152
|
+
"tan",
|
|
7153
|
+
"tangent",
|
|
7154
|
+
"trig",
|
|
7155
|
+
"math"
|
|
7156
|
+
],
|
|
7157
|
+
isPure: true,
|
|
7158
|
+
inputs: [
|
|
7159
|
+
{
|
|
7160
|
+
name: "radians",
|
|
7161
|
+
type: "float",
|
|
7162
|
+
displayName: "Radians",
|
|
7163
|
+
defaultValue: 0
|
|
7164
|
+
}
|
|
7165
|
+
],
|
|
7166
|
+
outputs: [
|
|
7167
|
+
{
|
|
7168
|
+
name: "result",
|
|
7169
|
+
type: "float",
|
|
7170
|
+
displayName: "Result"
|
|
7171
|
+
}
|
|
7172
|
+
]
|
|
7173
|
+
};
|
|
7174
|
+
var _TanExecutor = class _TanExecutor {
|
|
7175
|
+
execute(node, context) {
|
|
7176
|
+
const radians = Number(context.evaluateInput(node.id, "radians", 0));
|
|
7177
|
+
return {
|
|
7178
|
+
outputs: {
|
|
7179
|
+
result: Math.tan(radians)
|
|
7180
|
+
}
|
|
7181
|
+
};
|
|
7182
|
+
}
|
|
7183
|
+
};
|
|
7184
|
+
__name(_TanExecutor, "TanExecutor");
|
|
7185
|
+
var TanExecutor = _TanExecutor;
|
|
7186
|
+
TanExecutor = _ts_decorate10([
|
|
7187
|
+
RegisterNode(TanTemplate)
|
|
7188
|
+
], TanExecutor);
|
|
7189
|
+
var AsinTemplate = {
|
|
7190
|
+
type: "Asin",
|
|
7191
|
+
title: "Asin",
|
|
7192
|
+
category: "math",
|
|
7193
|
+
color: "#4CAF50",
|
|
7194
|
+
description: "Returns the arc sine in radians (\u8FD4\u56DE\u53CD\u6B63\u5F26\u503C\uFF0C\u5355\u4F4D\u4E3A\u5F27\u5EA6)",
|
|
7195
|
+
keywords: [
|
|
7196
|
+
"asin",
|
|
7197
|
+
"arc",
|
|
7198
|
+
"sine",
|
|
7199
|
+
"inverse",
|
|
7200
|
+
"trig",
|
|
7201
|
+
"math"
|
|
7202
|
+
],
|
|
7203
|
+
isPure: true,
|
|
7204
|
+
inputs: [
|
|
7205
|
+
{
|
|
7206
|
+
name: "value",
|
|
7207
|
+
type: "float",
|
|
7208
|
+
displayName: "Value",
|
|
7209
|
+
defaultValue: 0
|
|
7210
|
+
}
|
|
7211
|
+
],
|
|
7212
|
+
outputs: [
|
|
7213
|
+
{
|
|
7214
|
+
name: "result",
|
|
7215
|
+
type: "float",
|
|
7216
|
+
displayName: "Radians"
|
|
7217
|
+
}
|
|
7218
|
+
]
|
|
7219
|
+
};
|
|
7220
|
+
var _AsinExecutor = class _AsinExecutor {
|
|
7221
|
+
execute(node, context) {
|
|
7222
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
7223
|
+
return {
|
|
7224
|
+
outputs: {
|
|
7225
|
+
result: Math.asin(Math.max(-1, Math.min(1, value)))
|
|
7226
|
+
}
|
|
7227
|
+
};
|
|
7228
|
+
}
|
|
7229
|
+
};
|
|
7230
|
+
__name(_AsinExecutor, "AsinExecutor");
|
|
7231
|
+
var AsinExecutor = _AsinExecutor;
|
|
7232
|
+
AsinExecutor = _ts_decorate10([
|
|
7233
|
+
RegisterNode(AsinTemplate)
|
|
7234
|
+
], AsinExecutor);
|
|
7235
|
+
var AcosTemplate = {
|
|
7236
|
+
type: "Acos",
|
|
7237
|
+
title: "Acos",
|
|
7238
|
+
category: "math",
|
|
7239
|
+
color: "#4CAF50",
|
|
7240
|
+
description: "Returns the arc cosine in radians (\u8FD4\u56DE\u53CD\u4F59\u5F26\u503C\uFF0C\u5355\u4F4D\u4E3A\u5F27\u5EA6)",
|
|
7241
|
+
keywords: [
|
|
7242
|
+
"acos",
|
|
7243
|
+
"arc",
|
|
7244
|
+
"cosine",
|
|
7245
|
+
"inverse",
|
|
7246
|
+
"trig",
|
|
7247
|
+
"math"
|
|
7248
|
+
],
|
|
7249
|
+
isPure: true,
|
|
7250
|
+
inputs: [
|
|
7251
|
+
{
|
|
7252
|
+
name: "value",
|
|
7253
|
+
type: "float",
|
|
7254
|
+
displayName: "Value",
|
|
7255
|
+
defaultValue: 0
|
|
7256
|
+
}
|
|
7257
|
+
],
|
|
7258
|
+
outputs: [
|
|
7259
|
+
{
|
|
7260
|
+
name: "result",
|
|
7261
|
+
type: "float",
|
|
7262
|
+
displayName: "Radians"
|
|
7263
|
+
}
|
|
7264
|
+
]
|
|
7265
|
+
};
|
|
7266
|
+
var _AcosExecutor = class _AcosExecutor {
|
|
7267
|
+
execute(node, context) {
|
|
7268
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
7269
|
+
return {
|
|
7270
|
+
outputs: {
|
|
7271
|
+
result: Math.acos(Math.max(-1, Math.min(1, value)))
|
|
7272
|
+
}
|
|
7273
|
+
};
|
|
7274
|
+
}
|
|
7275
|
+
};
|
|
7276
|
+
__name(_AcosExecutor, "AcosExecutor");
|
|
7277
|
+
var AcosExecutor = _AcosExecutor;
|
|
7278
|
+
AcosExecutor = _ts_decorate10([
|
|
7279
|
+
RegisterNode(AcosTemplate)
|
|
7280
|
+
], AcosExecutor);
|
|
7281
|
+
var AtanTemplate = {
|
|
7282
|
+
type: "Atan",
|
|
7283
|
+
title: "Atan",
|
|
7284
|
+
category: "math",
|
|
7285
|
+
color: "#4CAF50",
|
|
7286
|
+
description: "Returns the arc tangent in radians (\u8FD4\u56DE\u53CD\u6B63\u5207\u503C\uFF0C\u5355\u4F4D\u4E3A\u5F27\u5EA6)",
|
|
7287
|
+
keywords: [
|
|
7288
|
+
"atan",
|
|
7289
|
+
"arc",
|
|
7290
|
+
"tangent",
|
|
7291
|
+
"inverse",
|
|
7292
|
+
"trig",
|
|
7293
|
+
"math"
|
|
7294
|
+
],
|
|
7295
|
+
isPure: true,
|
|
7296
|
+
inputs: [
|
|
7297
|
+
{
|
|
7298
|
+
name: "value",
|
|
7299
|
+
type: "float",
|
|
7300
|
+
displayName: "Value",
|
|
7301
|
+
defaultValue: 0
|
|
7302
|
+
}
|
|
7303
|
+
],
|
|
7304
|
+
outputs: [
|
|
7305
|
+
{
|
|
7306
|
+
name: "result",
|
|
7307
|
+
type: "float",
|
|
7308
|
+
displayName: "Radians"
|
|
7309
|
+
}
|
|
7310
|
+
]
|
|
7311
|
+
};
|
|
7312
|
+
var _AtanExecutor = class _AtanExecutor {
|
|
7313
|
+
execute(node, context) {
|
|
7314
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
7315
|
+
return {
|
|
7316
|
+
outputs: {
|
|
7317
|
+
result: Math.atan(value)
|
|
7318
|
+
}
|
|
7319
|
+
};
|
|
7320
|
+
}
|
|
7321
|
+
};
|
|
7322
|
+
__name(_AtanExecutor, "AtanExecutor");
|
|
7323
|
+
var AtanExecutor = _AtanExecutor;
|
|
7324
|
+
AtanExecutor = _ts_decorate10([
|
|
7325
|
+
RegisterNode(AtanTemplate)
|
|
7326
|
+
], AtanExecutor);
|
|
7327
|
+
var Atan2Template = {
|
|
7328
|
+
type: "Atan2",
|
|
7329
|
+
title: "Atan2",
|
|
7330
|
+
category: "math",
|
|
7331
|
+
color: "#4CAF50",
|
|
7332
|
+
description: "Returns the angle in radians between the positive X axis and the point (x, y) (\u8FD4\u56DE\u70B9(x,y)\u4E0E\u6B63X\u8F74\u4E4B\u95F4\u7684\u5F27\u5EA6\u89D2)",
|
|
7333
|
+
keywords: [
|
|
7334
|
+
"atan2",
|
|
7335
|
+
"angle",
|
|
7336
|
+
"direction",
|
|
7337
|
+
"trig",
|
|
7338
|
+
"math"
|
|
7339
|
+
],
|
|
7340
|
+
isPure: true,
|
|
7341
|
+
inputs: [
|
|
7342
|
+
{
|
|
7343
|
+
name: "y",
|
|
7344
|
+
type: "float",
|
|
7345
|
+
displayName: "Y",
|
|
7346
|
+
defaultValue: 0
|
|
7347
|
+
},
|
|
7348
|
+
{
|
|
7349
|
+
name: "x",
|
|
7350
|
+
type: "float",
|
|
7351
|
+
displayName: "X",
|
|
7352
|
+
defaultValue: 1
|
|
7353
|
+
}
|
|
7354
|
+
],
|
|
7355
|
+
outputs: [
|
|
7356
|
+
{
|
|
7357
|
+
name: "result",
|
|
7358
|
+
type: "float",
|
|
7359
|
+
displayName: "Radians"
|
|
7360
|
+
}
|
|
7361
|
+
]
|
|
7362
|
+
};
|
|
7363
|
+
var _Atan2Executor = class _Atan2Executor {
|
|
7364
|
+
execute(node, context) {
|
|
7365
|
+
const y = Number(context.evaluateInput(node.id, "y", 0));
|
|
7366
|
+
const x = Number(context.evaluateInput(node.id, "x", 1));
|
|
7367
|
+
return {
|
|
7368
|
+
outputs: {
|
|
7369
|
+
result: Math.atan2(y, x)
|
|
7370
|
+
}
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
};
|
|
7374
|
+
__name(_Atan2Executor, "Atan2Executor");
|
|
7375
|
+
var Atan2Executor = _Atan2Executor;
|
|
7376
|
+
Atan2Executor = _ts_decorate10([
|
|
7377
|
+
RegisterNode(Atan2Template)
|
|
7378
|
+
], Atan2Executor);
|
|
7379
|
+
var DegToRadTemplate = {
|
|
7380
|
+
type: "DegToRad",
|
|
7381
|
+
title: "Degrees to Radians",
|
|
7382
|
+
category: "math",
|
|
7383
|
+
color: "#4CAF50",
|
|
7384
|
+
description: "Converts degrees to radians (\u5C06\u89D2\u5EA6\u8F6C\u6362\u4E3A\u5F27\u5EA6)",
|
|
7385
|
+
keywords: [
|
|
7386
|
+
"degrees",
|
|
7387
|
+
"radians",
|
|
7388
|
+
"convert",
|
|
7389
|
+
"angle",
|
|
7390
|
+
"math"
|
|
7391
|
+
],
|
|
7392
|
+
isPure: true,
|
|
7393
|
+
inputs: [
|
|
7394
|
+
{
|
|
7395
|
+
name: "degrees",
|
|
7396
|
+
type: "float",
|
|
7397
|
+
displayName: "Degrees",
|
|
7398
|
+
defaultValue: 0
|
|
7399
|
+
}
|
|
7400
|
+
],
|
|
7401
|
+
outputs: [
|
|
7402
|
+
{
|
|
7403
|
+
name: "result",
|
|
7404
|
+
type: "float",
|
|
7405
|
+
displayName: "Radians"
|
|
7406
|
+
}
|
|
7407
|
+
]
|
|
7408
|
+
};
|
|
7409
|
+
var _DegToRadExecutor = class _DegToRadExecutor {
|
|
7410
|
+
execute(node, context) {
|
|
7411
|
+
const degrees = Number(context.evaluateInput(node.id, "degrees", 0));
|
|
7412
|
+
return {
|
|
7413
|
+
outputs: {
|
|
7414
|
+
result: degrees * (Math.PI / 180)
|
|
7415
|
+
}
|
|
7416
|
+
};
|
|
7417
|
+
}
|
|
7418
|
+
};
|
|
7419
|
+
__name(_DegToRadExecutor, "DegToRadExecutor");
|
|
7420
|
+
var DegToRadExecutor = _DegToRadExecutor;
|
|
7421
|
+
DegToRadExecutor = _ts_decorate10([
|
|
7422
|
+
RegisterNode(DegToRadTemplate)
|
|
7423
|
+
], DegToRadExecutor);
|
|
7424
|
+
var RadToDegTemplate = {
|
|
7425
|
+
type: "RadToDeg",
|
|
7426
|
+
title: "Radians to Degrees",
|
|
7427
|
+
category: "math",
|
|
7428
|
+
color: "#4CAF50",
|
|
7429
|
+
description: "Converts radians to degrees (\u5C06\u5F27\u5EA6\u8F6C\u6362\u4E3A\u89D2\u5EA6)",
|
|
7430
|
+
keywords: [
|
|
7431
|
+
"radians",
|
|
7432
|
+
"degrees",
|
|
7433
|
+
"convert",
|
|
7434
|
+
"angle",
|
|
7435
|
+
"math"
|
|
7436
|
+
],
|
|
7437
|
+
isPure: true,
|
|
7438
|
+
inputs: [
|
|
7439
|
+
{
|
|
7440
|
+
name: "radians",
|
|
7441
|
+
type: "float",
|
|
7442
|
+
displayName: "Radians",
|
|
7443
|
+
defaultValue: 0
|
|
7444
|
+
}
|
|
7445
|
+
],
|
|
7446
|
+
outputs: [
|
|
7447
|
+
{
|
|
7448
|
+
name: "result",
|
|
7449
|
+
type: "float",
|
|
7450
|
+
displayName: "Degrees"
|
|
7451
|
+
}
|
|
7452
|
+
]
|
|
7453
|
+
};
|
|
7454
|
+
var _RadToDegExecutor = class _RadToDegExecutor {
|
|
7455
|
+
execute(node, context) {
|
|
7456
|
+
const radians = Number(context.evaluateInput(node.id, "radians", 0));
|
|
7457
|
+
return {
|
|
7458
|
+
outputs: {
|
|
7459
|
+
result: radians * (180 / Math.PI)
|
|
7460
|
+
}
|
|
7461
|
+
};
|
|
7462
|
+
}
|
|
7463
|
+
};
|
|
7464
|
+
__name(_RadToDegExecutor, "RadToDegExecutor");
|
|
7465
|
+
var RadToDegExecutor = _RadToDegExecutor;
|
|
7466
|
+
RadToDegExecutor = _ts_decorate10([
|
|
7467
|
+
RegisterNode(RadToDegTemplate)
|
|
7468
|
+
], RadToDegExecutor);
|
|
7469
|
+
var InverseLerpTemplate = {
|
|
7470
|
+
type: "InverseLerp",
|
|
7471
|
+
title: "Inverse Lerp",
|
|
7472
|
+
category: "math",
|
|
7473
|
+
color: "#4CAF50",
|
|
7474
|
+
description: "Returns the percentage of Value between A and B (\u8FD4\u56DE\u503C\u5728 A \u548C B \u4E4B\u95F4\u7684\u767E\u5206\u6BD4\u4F4D\u7F6E)",
|
|
7475
|
+
keywords: [
|
|
7476
|
+
"inverse",
|
|
7477
|
+
"lerp",
|
|
7478
|
+
"percentage",
|
|
7479
|
+
"ratio",
|
|
7480
|
+
"math"
|
|
7481
|
+
],
|
|
7482
|
+
isPure: true,
|
|
7483
|
+
inputs: [
|
|
7484
|
+
{
|
|
7485
|
+
name: "a",
|
|
7486
|
+
type: "float",
|
|
7487
|
+
displayName: "A",
|
|
7488
|
+
defaultValue: 0
|
|
7489
|
+
},
|
|
7490
|
+
{
|
|
7491
|
+
name: "b",
|
|
7492
|
+
type: "float",
|
|
7493
|
+
displayName: "B",
|
|
7494
|
+
defaultValue: 1
|
|
7495
|
+
},
|
|
7496
|
+
{
|
|
7497
|
+
name: "value",
|
|
7498
|
+
type: "float",
|
|
7499
|
+
displayName: "Value",
|
|
7500
|
+
defaultValue: 0.5
|
|
7501
|
+
}
|
|
7502
|
+
],
|
|
7503
|
+
outputs: [
|
|
7504
|
+
{
|
|
7505
|
+
name: "result",
|
|
7506
|
+
type: "float",
|
|
7507
|
+
displayName: "Alpha (0-1)"
|
|
7508
|
+
}
|
|
7509
|
+
]
|
|
7510
|
+
};
|
|
7511
|
+
var _InverseLerpExecutor = class _InverseLerpExecutor {
|
|
7512
|
+
execute(node, context) {
|
|
7513
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
7514
|
+
const b = Number(context.evaluateInput(node.id, "b", 1));
|
|
7515
|
+
const value = Number(context.evaluateInput(node.id, "value", 0.5));
|
|
7516
|
+
if (b === a) return {
|
|
7517
|
+
outputs: {
|
|
7518
|
+
result: 0
|
|
7519
|
+
}
|
|
7520
|
+
};
|
|
7521
|
+
return {
|
|
7522
|
+
outputs: {
|
|
7523
|
+
result: (value - a) / (b - a)
|
|
7524
|
+
}
|
|
7525
|
+
};
|
|
7526
|
+
}
|
|
7527
|
+
};
|
|
7528
|
+
__name(_InverseLerpExecutor, "InverseLerpExecutor");
|
|
7529
|
+
var InverseLerpExecutor = _InverseLerpExecutor;
|
|
7530
|
+
InverseLerpExecutor = _ts_decorate10([
|
|
7531
|
+
RegisterNode(InverseLerpTemplate)
|
|
7532
|
+
], InverseLerpExecutor);
|
|
7533
|
+
|
|
7534
|
+
// src/nodes/logic/ComparisonNodes.ts
|
|
7535
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
7536
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7537
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7538
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7539
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7540
|
+
}
|
|
7541
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
7542
|
+
var EqualTemplate = {
|
|
7543
|
+
type: "Equal",
|
|
7544
|
+
title: "Equal",
|
|
7545
|
+
category: "logic",
|
|
7546
|
+
color: "#9C27B0",
|
|
7547
|
+
description: "Returns true if A equals B (\u5982\u679C A \u7B49\u4E8E B \u5219\u8FD4\u56DE true)",
|
|
7548
|
+
keywords: [
|
|
7549
|
+
"equal",
|
|
7550
|
+
"==",
|
|
7551
|
+
"same",
|
|
7552
|
+
"compare",
|
|
7553
|
+
"logic"
|
|
7554
|
+
],
|
|
7555
|
+
isPure: true,
|
|
7556
|
+
inputs: [
|
|
7557
|
+
{
|
|
7558
|
+
name: "a",
|
|
7559
|
+
type: "any",
|
|
7560
|
+
displayName: "A"
|
|
7561
|
+
},
|
|
7562
|
+
{
|
|
7563
|
+
name: "b",
|
|
7564
|
+
type: "any",
|
|
7565
|
+
displayName: "B"
|
|
7566
|
+
}
|
|
7567
|
+
],
|
|
7568
|
+
outputs: [
|
|
7569
|
+
{
|
|
7570
|
+
name: "result",
|
|
7571
|
+
type: "bool",
|
|
7572
|
+
displayName: "Result"
|
|
7573
|
+
}
|
|
7574
|
+
]
|
|
7575
|
+
};
|
|
7576
|
+
var _EqualExecutor = class _EqualExecutor {
|
|
7577
|
+
execute(node, context) {
|
|
7578
|
+
const a = context.evaluateInput(node.id, "a", null);
|
|
7579
|
+
const b = context.evaluateInput(node.id, "b", null);
|
|
7580
|
+
return {
|
|
7581
|
+
outputs: {
|
|
7582
|
+
result: a === b
|
|
7583
|
+
}
|
|
7584
|
+
};
|
|
7585
|
+
}
|
|
7586
|
+
};
|
|
7587
|
+
__name(_EqualExecutor, "EqualExecutor");
|
|
7588
|
+
var EqualExecutor = _EqualExecutor;
|
|
7589
|
+
EqualExecutor = _ts_decorate11([
|
|
7590
|
+
RegisterNode(EqualTemplate)
|
|
7591
|
+
], EqualExecutor);
|
|
7592
|
+
var NotEqualTemplate = {
|
|
7593
|
+
type: "NotEqual",
|
|
7594
|
+
title: "Not Equal",
|
|
7595
|
+
category: "logic",
|
|
7596
|
+
color: "#9C27B0",
|
|
7597
|
+
description: "Returns true if A does not equal B (\u5982\u679C A \u4E0D\u7B49\u4E8E B \u5219\u8FD4\u56DE true)",
|
|
7598
|
+
keywords: [
|
|
7599
|
+
"not",
|
|
7600
|
+
"equal",
|
|
7601
|
+
"!=",
|
|
7602
|
+
"different",
|
|
7603
|
+
"compare",
|
|
7604
|
+
"logic"
|
|
7605
|
+
],
|
|
7606
|
+
isPure: true,
|
|
7607
|
+
inputs: [
|
|
7608
|
+
{
|
|
7609
|
+
name: "a",
|
|
7610
|
+
type: "any",
|
|
7611
|
+
displayName: "A"
|
|
7612
|
+
},
|
|
7613
|
+
{
|
|
7614
|
+
name: "b",
|
|
7615
|
+
type: "any",
|
|
7616
|
+
displayName: "B"
|
|
7617
|
+
}
|
|
7618
|
+
],
|
|
7619
|
+
outputs: [
|
|
7620
|
+
{
|
|
7621
|
+
name: "result",
|
|
7622
|
+
type: "bool",
|
|
7623
|
+
displayName: "Result"
|
|
7624
|
+
}
|
|
7625
|
+
]
|
|
7626
|
+
};
|
|
7627
|
+
var _NotEqualExecutor = class _NotEqualExecutor {
|
|
7628
|
+
execute(node, context) {
|
|
7629
|
+
const a = context.evaluateInput(node.id, "a", null);
|
|
7630
|
+
const b = context.evaluateInput(node.id, "b", null);
|
|
7631
|
+
return {
|
|
7632
|
+
outputs: {
|
|
7633
|
+
result: a !== b
|
|
7634
|
+
}
|
|
7635
|
+
};
|
|
7636
|
+
}
|
|
7637
|
+
};
|
|
7638
|
+
__name(_NotEqualExecutor, "NotEqualExecutor");
|
|
7639
|
+
var NotEqualExecutor = _NotEqualExecutor;
|
|
7640
|
+
NotEqualExecutor = _ts_decorate11([
|
|
7641
|
+
RegisterNode(NotEqualTemplate)
|
|
7642
|
+
], NotEqualExecutor);
|
|
7643
|
+
var GreaterThanTemplate = {
|
|
7644
|
+
type: "GreaterThan",
|
|
7645
|
+
title: "Greater Than",
|
|
7646
|
+
category: "logic",
|
|
7647
|
+
color: "#9C27B0",
|
|
7648
|
+
description: "Returns true if A is greater than B (\u5982\u679C A \u5927\u4E8E B \u5219\u8FD4\u56DE true)",
|
|
7649
|
+
keywords: [
|
|
7650
|
+
"greater",
|
|
7651
|
+
"than",
|
|
7652
|
+
">",
|
|
7653
|
+
"compare",
|
|
7654
|
+
"logic"
|
|
7655
|
+
],
|
|
7656
|
+
isPure: true,
|
|
7657
|
+
inputs: [
|
|
7658
|
+
{
|
|
7659
|
+
name: "a",
|
|
7660
|
+
type: "float",
|
|
7661
|
+
displayName: "A",
|
|
7662
|
+
defaultValue: 0
|
|
7663
|
+
},
|
|
7664
|
+
{
|
|
7665
|
+
name: "b",
|
|
7666
|
+
type: "float",
|
|
7667
|
+
displayName: "B",
|
|
7668
|
+
defaultValue: 0
|
|
7669
|
+
}
|
|
7670
|
+
],
|
|
7671
|
+
outputs: [
|
|
7672
|
+
{
|
|
7673
|
+
name: "result",
|
|
7674
|
+
type: "bool",
|
|
7675
|
+
displayName: "Result"
|
|
7676
|
+
}
|
|
7677
|
+
]
|
|
7678
|
+
};
|
|
7679
|
+
var _GreaterThanExecutor = class _GreaterThanExecutor {
|
|
7680
|
+
execute(node, context) {
|
|
7681
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
7682
|
+
const b = Number(context.evaluateInput(node.id, "b", 0));
|
|
7683
|
+
return {
|
|
7684
|
+
outputs: {
|
|
7685
|
+
result: a > b
|
|
7686
|
+
}
|
|
7687
|
+
};
|
|
7688
|
+
}
|
|
7689
|
+
};
|
|
7690
|
+
__name(_GreaterThanExecutor, "GreaterThanExecutor");
|
|
7691
|
+
var GreaterThanExecutor = _GreaterThanExecutor;
|
|
7692
|
+
GreaterThanExecutor = _ts_decorate11([
|
|
7693
|
+
RegisterNode(GreaterThanTemplate)
|
|
7694
|
+
], GreaterThanExecutor);
|
|
7695
|
+
var GreaterThanOrEqualTemplate = {
|
|
7696
|
+
type: "GreaterThanOrEqual",
|
|
7697
|
+
title: "Greater Or Equal",
|
|
7698
|
+
category: "logic",
|
|
7699
|
+
color: "#9C27B0",
|
|
7700
|
+
description: "Returns true if A is greater than or equal to B (\u5982\u679C A \u5927\u4E8E\u7B49\u4E8E B \u5219\u8FD4\u56DE true)",
|
|
7701
|
+
keywords: [
|
|
7702
|
+
"greater",
|
|
7703
|
+
"equal",
|
|
7704
|
+
">=",
|
|
7705
|
+
"compare",
|
|
7706
|
+
"logic"
|
|
7707
|
+
],
|
|
7708
|
+
isPure: true,
|
|
7709
|
+
inputs: [
|
|
7710
|
+
{
|
|
7711
|
+
name: "a",
|
|
7712
|
+
type: "float",
|
|
7713
|
+
displayName: "A",
|
|
7714
|
+
defaultValue: 0
|
|
7715
|
+
},
|
|
7716
|
+
{
|
|
7717
|
+
name: "b",
|
|
7718
|
+
type: "float",
|
|
7719
|
+
displayName: "B",
|
|
7720
|
+
defaultValue: 0
|
|
7721
|
+
}
|
|
7722
|
+
],
|
|
7723
|
+
outputs: [
|
|
7724
|
+
{
|
|
7725
|
+
name: "result",
|
|
7726
|
+
type: "bool",
|
|
7727
|
+
displayName: "Result"
|
|
7728
|
+
}
|
|
7729
|
+
]
|
|
7730
|
+
};
|
|
7731
|
+
var _GreaterThanOrEqualExecutor = class _GreaterThanOrEqualExecutor {
|
|
7732
|
+
execute(node, context) {
|
|
7733
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
7734
|
+
const b = Number(context.evaluateInput(node.id, "b", 0));
|
|
7735
|
+
return {
|
|
7736
|
+
outputs: {
|
|
7737
|
+
result: a >= b
|
|
7738
|
+
}
|
|
7739
|
+
};
|
|
7740
|
+
}
|
|
7741
|
+
};
|
|
7742
|
+
__name(_GreaterThanOrEqualExecutor, "GreaterThanOrEqualExecutor");
|
|
7743
|
+
var GreaterThanOrEqualExecutor = _GreaterThanOrEqualExecutor;
|
|
7744
|
+
GreaterThanOrEqualExecutor = _ts_decorate11([
|
|
7745
|
+
RegisterNode(GreaterThanOrEqualTemplate)
|
|
7746
|
+
], GreaterThanOrEqualExecutor);
|
|
7747
|
+
var LessThanTemplate = {
|
|
7748
|
+
type: "LessThan",
|
|
7749
|
+
title: "Less Than",
|
|
7750
|
+
category: "logic",
|
|
7751
|
+
color: "#9C27B0",
|
|
7752
|
+
description: "Returns true if A is less than B (\u5982\u679C A \u5C0F\u4E8E B \u5219\u8FD4\u56DE true)",
|
|
7753
|
+
keywords: [
|
|
7754
|
+
"less",
|
|
7755
|
+
"than",
|
|
7756
|
+
"<",
|
|
7757
|
+
"compare",
|
|
7758
|
+
"logic"
|
|
7759
|
+
],
|
|
7760
|
+
isPure: true,
|
|
7761
|
+
inputs: [
|
|
7762
|
+
{
|
|
7763
|
+
name: "a",
|
|
7764
|
+
type: "float",
|
|
7765
|
+
displayName: "A",
|
|
7766
|
+
defaultValue: 0
|
|
7767
|
+
},
|
|
7768
|
+
{
|
|
7769
|
+
name: "b",
|
|
7770
|
+
type: "float",
|
|
7771
|
+
displayName: "B",
|
|
7772
|
+
defaultValue: 0
|
|
7773
|
+
}
|
|
7774
|
+
],
|
|
7775
|
+
outputs: [
|
|
7776
|
+
{
|
|
7777
|
+
name: "result",
|
|
7778
|
+
type: "bool",
|
|
7779
|
+
displayName: "Result"
|
|
7780
|
+
}
|
|
7781
|
+
]
|
|
7782
|
+
};
|
|
7783
|
+
var _LessThanExecutor = class _LessThanExecutor {
|
|
7784
|
+
execute(node, context) {
|
|
7785
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
7786
|
+
const b = Number(context.evaluateInput(node.id, "b", 0));
|
|
7787
|
+
return {
|
|
7788
|
+
outputs: {
|
|
7789
|
+
result: a < b
|
|
7790
|
+
}
|
|
7791
|
+
};
|
|
7792
|
+
}
|
|
7793
|
+
};
|
|
7794
|
+
__name(_LessThanExecutor, "LessThanExecutor");
|
|
7795
|
+
var LessThanExecutor = _LessThanExecutor;
|
|
7796
|
+
LessThanExecutor = _ts_decorate11([
|
|
7797
|
+
RegisterNode(LessThanTemplate)
|
|
7798
|
+
], LessThanExecutor);
|
|
7799
|
+
var LessThanOrEqualTemplate = {
|
|
7800
|
+
type: "LessThanOrEqual",
|
|
7801
|
+
title: "Less Or Equal",
|
|
7802
|
+
category: "logic",
|
|
7803
|
+
color: "#9C27B0",
|
|
7804
|
+
description: "Returns true if A is less than or equal to B (\u5982\u679C A \u5C0F\u4E8E\u7B49\u4E8E B \u5219\u8FD4\u56DE true)",
|
|
7805
|
+
keywords: [
|
|
7806
|
+
"less",
|
|
7807
|
+
"equal",
|
|
7808
|
+
"<=",
|
|
7809
|
+
"compare",
|
|
7810
|
+
"logic"
|
|
7811
|
+
],
|
|
7812
|
+
isPure: true,
|
|
7813
|
+
inputs: [
|
|
7814
|
+
{
|
|
7815
|
+
name: "a",
|
|
7816
|
+
type: "float",
|
|
7817
|
+
displayName: "A",
|
|
7818
|
+
defaultValue: 0
|
|
7819
|
+
},
|
|
7820
|
+
{
|
|
7821
|
+
name: "b",
|
|
7822
|
+
type: "float",
|
|
7823
|
+
displayName: "B",
|
|
7824
|
+
defaultValue: 0
|
|
7825
|
+
}
|
|
7826
|
+
],
|
|
7827
|
+
outputs: [
|
|
7828
|
+
{
|
|
7829
|
+
name: "result",
|
|
7830
|
+
type: "bool",
|
|
7831
|
+
displayName: "Result"
|
|
7832
|
+
}
|
|
7833
|
+
]
|
|
7834
|
+
};
|
|
7835
|
+
var _LessThanOrEqualExecutor = class _LessThanOrEqualExecutor {
|
|
7836
|
+
execute(node, context) {
|
|
7837
|
+
const a = Number(context.evaluateInput(node.id, "a", 0));
|
|
7838
|
+
const b = Number(context.evaluateInput(node.id, "b", 0));
|
|
7839
|
+
return {
|
|
7840
|
+
outputs: {
|
|
7841
|
+
result: a <= b
|
|
7842
|
+
}
|
|
7843
|
+
};
|
|
7844
|
+
}
|
|
7845
|
+
};
|
|
7846
|
+
__name(_LessThanOrEqualExecutor, "LessThanOrEqualExecutor");
|
|
7847
|
+
var LessThanOrEqualExecutor = _LessThanOrEqualExecutor;
|
|
7848
|
+
LessThanOrEqualExecutor = _ts_decorate11([
|
|
7849
|
+
RegisterNode(LessThanOrEqualTemplate)
|
|
7850
|
+
], LessThanOrEqualExecutor);
|
|
7851
|
+
var AndTemplate = {
|
|
7852
|
+
type: "And",
|
|
7853
|
+
title: "AND",
|
|
7854
|
+
category: "logic",
|
|
7855
|
+
color: "#9C27B0",
|
|
7856
|
+
description: "Returns true if both A and B are true (\u5982\u679C A \u548C B \u90FD\u4E3A true \u5219\u8FD4\u56DE true)",
|
|
7857
|
+
keywords: [
|
|
7858
|
+
"and",
|
|
7859
|
+
"&&",
|
|
7860
|
+
"both",
|
|
7861
|
+
"logic"
|
|
7862
|
+
],
|
|
7863
|
+
isPure: true,
|
|
7864
|
+
inputs: [
|
|
7865
|
+
{
|
|
7866
|
+
name: "a",
|
|
7867
|
+
type: "bool",
|
|
7868
|
+
displayName: "A",
|
|
7869
|
+
defaultValue: false
|
|
7870
|
+
},
|
|
7871
|
+
{
|
|
7872
|
+
name: "b",
|
|
7873
|
+
type: "bool",
|
|
7874
|
+
displayName: "B",
|
|
7875
|
+
defaultValue: false
|
|
7876
|
+
}
|
|
7877
|
+
],
|
|
7878
|
+
outputs: [
|
|
7879
|
+
{
|
|
7880
|
+
name: "result",
|
|
7881
|
+
type: "bool",
|
|
7882
|
+
displayName: "Result"
|
|
7883
|
+
}
|
|
7884
|
+
]
|
|
7885
|
+
};
|
|
7886
|
+
var _AndExecutor = class _AndExecutor {
|
|
7887
|
+
execute(node, context) {
|
|
7888
|
+
const a = Boolean(context.evaluateInput(node.id, "a", false));
|
|
7889
|
+
const b = Boolean(context.evaluateInput(node.id, "b", false));
|
|
7890
|
+
return {
|
|
7891
|
+
outputs: {
|
|
7892
|
+
result: a && b
|
|
7893
|
+
}
|
|
7894
|
+
};
|
|
7895
|
+
}
|
|
7896
|
+
};
|
|
7897
|
+
__name(_AndExecutor, "AndExecutor");
|
|
7898
|
+
var AndExecutor = _AndExecutor;
|
|
7899
|
+
AndExecutor = _ts_decorate11([
|
|
7900
|
+
RegisterNode(AndTemplate)
|
|
7901
|
+
], AndExecutor);
|
|
7902
|
+
var OrTemplate = {
|
|
7903
|
+
type: "Or",
|
|
7904
|
+
title: "OR",
|
|
7905
|
+
category: "logic",
|
|
7906
|
+
color: "#9C27B0",
|
|
7907
|
+
description: "Returns true if either A or B is true (\u5982\u679C A \u6216 B \u4E3A true \u5219\u8FD4\u56DE true)",
|
|
7908
|
+
keywords: [
|
|
7909
|
+
"or",
|
|
7910
|
+
"||",
|
|
7911
|
+
"either",
|
|
7912
|
+
"logic"
|
|
7913
|
+
],
|
|
7914
|
+
isPure: true,
|
|
7915
|
+
inputs: [
|
|
7916
|
+
{
|
|
7917
|
+
name: "a",
|
|
7918
|
+
type: "bool",
|
|
7919
|
+
displayName: "A",
|
|
7920
|
+
defaultValue: false
|
|
7921
|
+
},
|
|
7922
|
+
{
|
|
7923
|
+
name: "b",
|
|
7924
|
+
type: "bool",
|
|
7925
|
+
displayName: "B",
|
|
7926
|
+
defaultValue: false
|
|
7927
|
+
}
|
|
7928
|
+
],
|
|
7929
|
+
outputs: [
|
|
7930
|
+
{
|
|
7931
|
+
name: "result",
|
|
7932
|
+
type: "bool",
|
|
7933
|
+
displayName: "Result"
|
|
7934
|
+
}
|
|
7935
|
+
]
|
|
7936
|
+
};
|
|
7937
|
+
var _OrExecutor = class _OrExecutor {
|
|
7938
|
+
execute(node, context) {
|
|
7939
|
+
const a = Boolean(context.evaluateInput(node.id, "a", false));
|
|
7940
|
+
const b = Boolean(context.evaluateInput(node.id, "b", false));
|
|
7941
|
+
return {
|
|
7942
|
+
outputs: {
|
|
7943
|
+
result: a || b
|
|
7944
|
+
}
|
|
7945
|
+
};
|
|
7946
|
+
}
|
|
7947
|
+
};
|
|
7948
|
+
__name(_OrExecutor, "OrExecutor");
|
|
7949
|
+
var OrExecutor = _OrExecutor;
|
|
7950
|
+
OrExecutor = _ts_decorate11([
|
|
7951
|
+
RegisterNode(OrTemplate)
|
|
7952
|
+
], OrExecutor);
|
|
7953
|
+
var NotTemplate = {
|
|
7954
|
+
type: "Not",
|
|
7955
|
+
title: "NOT",
|
|
7956
|
+
category: "logic",
|
|
7957
|
+
color: "#9C27B0",
|
|
7958
|
+
description: "Returns the opposite boolean value (\u8FD4\u56DE\u76F8\u53CD\u7684\u5E03\u5C14\u503C)",
|
|
7959
|
+
keywords: [
|
|
7960
|
+
"not",
|
|
7961
|
+
"!",
|
|
7962
|
+
"negate",
|
|
7963
|
+
"invert",
|
|
7964
|
+
"logic"
|
|
7965
|
+
],
|
|
7966
|
+
isPure: true,
|
|
7967
|
+
inputs: [
|
|
7968
|
+
{
|
|
7969
|
+
name: "value",
|
|
7970
|
+
type: "bool",
|
|
7971
|
+
displayName: "Value",
|
|
7972
|
+
defaultValue: false
|
|
7973
|
+
}
|
|
7974
|
+
],
|
|
7975
|
+
outputs: [
|
|
7976
|
+
{
|
|
7977
|
+
name: "result",
|
|
7978
|
+
type: "bool",
|
|
7979
|
+
displayName: "Result"
|
|
7980
|
+
}
|
|
7981
|
+
]
|
|
7982
|
+
};
|
|
7983
|
+
var _NotExecutor = class _NotExecutor {
|
|
7984
|
+
execute(node, context) {
|
|
7985
|
+
const value = Boolean(context.evaluateInput(node.id, "value", false));
|
|
7986
|
+
return {
|
|
7987
|
+
outputs: {
|
|
7988
|
+
result: !value
|
|
7989
|
+
}
|
|
7990
|
+
};
|
|
7991
|
+
}
|
|
7992
|
+
};
|
|
7993
|
+
__name(_NotExecutor, "NotExecutor");
|
|
7994
|
+
var NotExecutor = _NotExecutor;
|
|
7995
|
+
NotExecutor = _ts_decorate11([
|
|
7996
|
+
RegisterNode(NotTemplate)
|
|
7997
|
+
], NotExecutor);
|
|
7998
|
+
var XorTemplate = {
|
|
7999
|
+
type: "Xor",
|
|
8000
|
+
title: "XOR",
|
|
8001
|
+
category: "logic",
|
|
8002
|
+
color: "#9C27B0",
|
|
8003
|
+
description: "Returns true if exactly one of A or B is true (\u5982\u679C A \u548C B \u4E2D\u6070\u597D\u6709\u4E00\u4E2A\u4E3A true \u5219\u8FD4\u56DE true)",
|
|
8004
|
+
keywords: [
|
|
8005
|
+
"xor",
|
|
8006
|
+
"exclusive",
|
|
8007
|
+
"or",
|
|
8008
|
+
"logic"
|
|
8009
|
+
],
|
|
8010
|
+
isPure: true,
|
|
8011
|
+
inputs: [
|
|
8012
|
+
{
|
|
8013
|
+
name: "a",
|
|
8014
|
+
type: "bool",
|
|
8015
|
+
displayName: "A",
|
|
8016
|
+
defaultValue: false
|
|
8017
|
+
},
|
|
8018
|
+
{
|
|
8019
|
+
name: "b",
|
|
8020
|
+
type: "bool",
|
|
8021
|
+
displayName: "B",
|
|
8022
|
+
defaultValue: false
|
|
8023
|
+
}
|
|
8024
|
+
],
|
|
8025
|
+
outputs: [
|
|
8026
|
+
{
|
|
8027
|
+
name: "result",
|
|
8028
|
+
type: "bool",
|
|
8029
|
+
displayName: "Result"
|
|
8030
|
+
}
|
|
8031
|
+
]
|
|
8032
|
+
};
|
|
8033
|
+
var _XorExecutor = class _XorExecutor {
|
|
8034
|
+
execute(node, context) {
|
|
8035
|
+
const a = Boolean(context.evaluateInput(node.id, "a", false));
|
|
8036
|
+
const b = Boolean(context.evaluateInput(node.id, "b", false));
|
|
8037
|
+
return {
|
|
8038
|
+
outputs: {
|
|
8039
|
+
result: (a || b) && !(a && b)
|
|
8040
|
+
}
|
|
8041
|
+
};
|
|
8042
|
+
}
|
|
8043
|
+
};
|
|
8044
|
+
__name(_XorExecutor, "XorExecutor");
|
|
8045
|
+
var XorExecutor = _XorExecutor;
|
|
8046
|
+
XorExecutor = _ts_decorate11([
|
|
8047
|
+
RegisterNode(XorTemplate)
|
|
8048
|
+
], XorExecutor);
|
|
8049
|
+
var NandTemplate = {
|
|
8050
|
+
type: "Nand",
|
|
8051
|
+
title: "NAND",
|
|
8052
|
+
category: "logic",
|
|
8053
|
+
color: "#9C27B0",
|
|
8054
|
+
description: "Returns true if not both A and B are true (\u5982\u679C A \u548C B \u4E0D\u90FD\u4E3A true \u5219\u8FD4\u56DE true)",
|
|
8055
|
+
keywords: [
|
|
8056
|
+
"nand",
|
|
8057
|
+
"not",
|
|
8058
|
+
"and",
|
|
8059
|
+
"logic"
|
|
8060
|
+
],
|
|
8061
|
+
isPure: true,
|
|
8062
|
+
inputs: [
|
|
8063
|
+
{
|
|
8064
|
+
name: "a",
|
|
8065
|
+
type: "bool",
|
|
8066
|
+
displayName: "A",
|
|
8067
|
+
defaultValue: false
|
|
8068
|
+
},
|
|
8069
|
+
{
|
|
8070
|
+
name: "b",
|
|
8071
|
+
type: "bool",
|
|
8072
|
+
displayName: "B",
|
|
8073
|
+
defaultValue: false
|
|
8074
|
+
}
|
|
8075
|
+
],
|
|
8076
|
+
outputs: [
|
|
8077
|
+
{
|
|
8078
|
+
name: "result",
|
|
8079
|
+
type: "bool",
|
|
8080
|
+
displayName: "Result"
|
|
8081
|
+
}
|
|
8082
|
+
]
|
|
8083
|
+
};
|
|
8084
|
+
var _NandExecutor = class _NandExecutor {
|
|
8085
|
+
execute(node, context) {
|
|
8086
|
+
const a = Boolean(context.evaluateInput(node.id, "a", false));
|
|
8087
|
+
const b = Boolean(context.evaluateInput(node.id, "b", false));
|
|
8088
|
+
return {
|
|
8089
|
+
outputs: {
|
|
8090
|
+
result: !(a && b)
|
|
8091
|
+
}
|
|
8092
|
+
};
|
|
8093
|
+
}
|
|
8094
|
+
};
|
|
8095
|
+
__name(_NandExecutor, "NandExecutor");
|
|
8096
|
+
var NandExecutor = _NandExecutor;
|
|
8097
|
+
NandExecutor = _ts_decorate11([
|
|
8098
|
+
RegisterNode(NandTemplate)
|
|
8099
|
+
], NandExecutor);
|
|
8100
|
+
var InRangeTemplate = {
|
|
8101
|
+
type: "InRange",
|
|
8102
|
+
title: "In Range",
|
|
8103
|
+
category: "logic",
|
|
8104
|
+
color: "#9C27B0",
|
|
8105
|
+
description: "Returns true if value is between min and max (\u5982\u679C\u503C\u5728 min \u548C max \u4E4B\u95F4\u5219\u8FD4\u56DE true)",
|
|
8106
|
+
keywords: [
|
|
8107
|
+
"range",
|
|
8108
|
+
"between",
|
|
8109
|
+
"check",
|
|
8110
|
+
"logic"
|
|
8111
|
+
],
|
|
8112
|
+
isPure: true,
|
|
8113
|
+
inputs: [
|
|
8114
|
+
{
|
|
8115
|
+
name: "value",
|
|
8116
|
+
type: "float",
|
|
8117
|
+
displayName: "Value",
|
|
8118
|
+
defaultValue: 0
|
|
8119
|
+
},
|
|
8120
|
+
{
|
|
8121
|
+
name: "min",
|
|
8122
|
+
type: "float",
|
|
8123
|
+
displayName: "Min",
|
|
8124
|
+
defaultValue: 0
|
|
8125
|
+
},
|
|
8126
|
+
{
|
|
8127
|
+
name: "max",
|
|
8128
|
+
type: "float",
|
|
8129
|
+
displayName: "Max",
|
|
8130
|
+
defaultValue: 1
|
|
8131
|
+
},
|
|
8132
|
+
{
|
|
8133
|
+
name: "inclusive",
|
|
8134
|
+
type: "bool",
|
|
8135
|
+
displayName: "Inclusive",
|
|
8136
|
+
defaultValue: true
|
|
8137
|
+
}
|
|
8138
|
+
],
|
|
8139
|
+
outputs: [
|
|
8140
|
+
{
|
|
8141
|
+
name: "result",
|
|
8142
|
+
type: "bool",
|
|
8143
|
+
displayName: "Result"
|
|
8144
|
+
}
|
|
8145
|
+
]
|
|
8146
|
+
};
|
|
8147
|
+
var _InRangeExecutor = class _InRangeExecutor {
|
|
8148
|
+
execute(node, context) {
|
|
8149
|
+
const value = Number(context.evaluateInput(node.id, "value", 0));
|
|
8150
|
+
const min = Number(context.evaluateInput(node.id, "min", 0));
|
|
8151
|
+
const max = Number(context.evaluateInput(node.id, "max", 1));
|
|
8152
|
+
const inclusive = Boolean(context.evaluateInput(node.id, "inclusive", true));
|
|
8153
|
+
const result = inclusive ? value >= min && value <= max : value > min && value < max;
|
|
8154
|
+
return {
|
|
8155
|
+
outputs: {
|
|
8156
|
+
result
|
|
8157
|
+
}
|
|
8158
|
+
};
|
|
8159
|
+
}
|
|
8160
|
+
};
|
|
8161
|
+
__name(_InRangeExecutor, "InRangeExecutor");
|
|
8162
|
+
var InRangeExecutor = _InRangeExecutor;
|
|
8163
|
+
InRangeExecutor = _ts_decorate11([
|
|
8164
|
+
RegisterNode(InRangeTemplate)
|
|
8165
|
+
], InRangeExecutor);
|
|
8166
|
+
var IsNullTemplate = {
|
|
8167
|
+
type: "IsNull",
|
|
8168
|
+
title: "Is Null",
|
|
8169
|
+
category: "logic",
|
|
8170
|
+
color: "#9C27B0",
|
|
8171
|
+
description: "Returns true if the value is null or undefined (\u5982\u679C\u503C\u4E3A null \u6216 undefined \u5219\u8FD4\u56DE true)",
|
|
8172
|
+
keywords: [
|
|
8173
|
+
"null",
|
|
8174
|
+
"undefined",
|
|
8175
|
+
"empty",
|
|
8176
|
+
"check",
|
|
8177
|
+
"logic"
|
|
8178
|
+
],
|
|
8179
|
+
isPure: true,
|
|
8180
|
+
inputs: [
|
|
8181
|
+
{
|
|
8182
|
+
name: "value",
|
|
8183
|
+
type: "any",
|
|
8184
|
+
displayName: "Value"
|
|
8185
|
+
}
|
|
8186
|
+
],
|
|
8187
|
+
outputs: [
|
|
8188
|
+
{
|
|
8189
|
+
name: "result",
|
|
8190
|
+
type: "bool",
|
|
8191
|
+
displayName: "Is Null"
|
|
8192
|
+
}
|
|
8193
|
+
]
|
|
8194
|
+
};
|
|
8195
|
+
var _IsNullExecutor = class _IsNullExecutor {
|
|
8196
|
+
execute(node, context) {
|
|
8197
|
+
const value = context.evaluateInput(node.id, "value", null);
|
|
8198
|
+
return {
|
|
8199
|
+
outputs: {
|
|
8200
|
+
result: value == null
|
|
8201
|
+
}
|
|
8202
|
+
};
|
|
8203
|
+
}
|
|
8204
|
+
};
|
|
8205
|
+
__name(_IsNullExecutor, "IsNullExecutor");
|
|
8206
|
+
var IsNullExecutor = _IsNullExecutor;
|
|
8207
|
+
IsNullExecutor = _ts_decorate11([
|
|
8208
|
+
RegisterNode(IsNullTemplate)
|
|
8209
|
+
], IsNullExecutor);
|
|
8210
|
+
var SelectTemplate = {
|
|
8211
|
+
type: "Select",
|
|
8212
|
+
title: "Select",
|
|
8213
|
+
category: "logic",
|
|
8214
|
+
color: "#9C27B0",
|
|
8215
|
+
description: "Returns A if condition is true, otherwise returns B (\u5982\u679C\u6761\u4EF6\u4E3A true \u8FD4\u56DE A\uFF0C\u5426\u5219\u8FD4\u56DE B)",
|
|
8216
|
+
keywords: [
|
|
8217
|
+
"select",
|
|
8218
|
+
"choose",
|
|
8219
|
+
"ternary",
|
|
8220
|
+
"?:",
|
|
8221
|
+
"logic"
|
|
8222
|
+
],
|
|
8223
|
+
isPure: true,
|
|
8224
|
+
inputs: [
|
|
8225
|
+
{
|
|
8226
|
+
name: "condition",
|
|
8227
|
+
type: "bool",
|
|
8228
|
+
displayName: "Condition",
|
|
8229
|
+
defaultValue: false
|
|
8230
|
+
},
|
|
8231
|
+
{
|
|
8232
|
+
name: "a",
|
|
8233
|
+
type: "any",
|
|
8234
|
+
displayName: "A (True)"
|
|
8235
|
+
},
|
|
8236
|
+
{
|
|
8237
|
+
name: "b",
|
|
8238
|
+
type: "any",
|
|
8239
|
+
displayName: "B (False)"
|
|
8240
|
+
}
|
|
8241
|
+
],
|
|
8242
|
+
outputs: [
|
|
8243
|
+
{
|
|
8244
|
+
name: "result",
|
|
8245
|
+
type: "any",
|
|
8246
|
+
displayName: "Result"
|
|
8247
|
+
}
|
|
8248
|
+
]
|
|
8249
|
+
};
|
|
8250
|
+
var _SelectExecutor = class _SelectExecutor {
|
|
8251
|
+
execute(node, context) {
|
|
8252
|
+
const condition2 = Boolean(context.evaluateInput(node.id, "condition", false));
|
|
8253
|
+
const a = context.evaluateInput(node.id, "a", null);
|
|
8254
|
+
const b = context.evaluateInput(node.id, "b", null);
|
|
8255
|
+
return {
|
|
8256
|
+
outputs: {
|
|
8257
|
+
result: condition2 ? a : b
|
|
8258
|
+
}
|
|
8259
|
+
};
|
|
8260
|
+
}
|
|
8261
|
+
};
|
|
8262
|
+
__name(_SelectExecutor, "SelectExecutor");
|
|
8263
|
+
var SelectExecutor = _SelectExecutor;
|
|
8264
|
+
SelectExecutor = _ts_decorate11([
|
|
8265
|
+
RegisterNode(SelectTemplate)
|
|
8266
|
+
], SelectExecutor);
|
|
8267
|
+
|
|
8268
|
+
// src/nodes/time/GetDeltaTime.ts
|
|
8269
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
5413
8270
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5414
8271
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5415
8272
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5416
8273
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5417
8274
|
}
|
|
5418
|
-
__name(
|
|
8275
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
5419
8276
|
var GetDeltaTimeTemplate = {
|
|
5420
8277
|
type: "GetDeltaTime",
|
|
5421
8278
|
title: "Get Delta Time",
|
|
@@ -5449,18 +8306,18 @@ var _GetDeltaTimeExecutor = class _GetDeltaTimeExecutor {
|
|
|
5449
8306
|
};
|
|
5450
8307
|
__name(_GetDeltaTimeExecutor, "GetDeltaTimeExecutor");
|
|
5451
8308
|
var GetDeltaTimeExecutor = _GetDeltaTimeExecutor;
|
|
5452
|
-
GetDeltaTimeExecutor =
|
|
8309
|
+
GetDeltaTimeExecutor = _ts_decorate12([
|
|
5453
8310
|
RegisterNode(GetDeltaTimeTemplate)
|
|
5454
8311
|
], GetDeltaTimeExecutor);
|
|
5455
8312
|
|
|
5456
8313
|
// src/nodes/time/GetTime.ts
|
|
5457
|
-
function
|
|
8314
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
5458
8315
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5459
8316
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5460
8317
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5461
8318
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5462
8319
|
}
|
|
5463
|
-
__name(
|
|
8320
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
5464
8321
|
var GetTimeTemplate = {
|
|
5465
8322
|
type: "GetTime",
|
|
5466
8323
|
title: "Get Game Time",
|
|
@@ -5494,18 +8351,18 @@ var _GetTimeExecutor = class _GetTimeExecutor {
|
|
|
5494
8351
|
};
|
|
5495
8352
|
__name(_GetTimeExecutor, "GetTimeExecutor");
|
|
5496
8353
|
var GetTimeExecutor = _GetTimeExecutor;
|
|
5497
|
-
GetTimeExecutor =
|
|
8354
|
+
GetTimeExecutor = _ts_decorate13([
|
|
5498
8355
|
RegisterNode(GetTimeTemplate)
|
|
5499
8356
|
], GetTimeExecutor);
|
|
5500
8357
|
|
|
5501
8358
|
// src/nodes/time/Delay.ts
|
|
5502
|
-
function
|
|
8359
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
5503
8360
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5504
8361
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5505
8362
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5506
8363
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5507
8364
|
}
|
|
5508
|
-
__name(
|
|
8365
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
5509
8366
|
var DelayTemplate = {
|
|
5510
8367
|
type: "Delay",
|
|
5511
8368
|
title: "Delay",
|
|
@@ -5551,18 +8408,18 @@ var _DelayExecutor = class _DelayExecutor {
|
|
|
5551
8408
|
};
|
|
5552
8409
|
__name(_DelayExecutor, "DelayExecutor");
|
|
5553
8410
|
var DelayExecutor = _DelayExecutor;
|
|
5554
|
-
DelayExecutor =
|
|
8411
|
+
DelayExecutor = _ts_decorate14([
|
|
5555
8412
|
RegisterNode(DelayTemplate)
|
|
5556
8413
|
], DelayExecutor);
|
|
5557
8414
|
|
|
5558
8415
|
// src/nodes/debug/Print.ts
|
|
5559
|
-
function
|
|
8416
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
5560
8417
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5561
8418
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5562
8419
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5563
8420
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5564
8421
|
}
|
|
5565
|
-
__name(
|
|
8422
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
5566
8423
|
var PrintTemplate = {
|
|
5567
8424
|
type: "Print",
|
|
5568
8425
|
title: "Print String",
|
|
@@ -5635,7 +8492,7 @@ var _PrintExecutor = class _PrintExecutor {
|
|
|
5635
8492
|
};
|
|
5636
8493
|
__name(_PrintExecutor, "PrintExecutor");
|
|
5637
8494
|
var PrintExecutor = _PrintExecutor;
|
|
5638
|
-
PrintExecutor =
|
|
8495
|
+
PrintExecutor = _ts_decorate15([
|
|
5639
8496
|
RegisterNode(PrintTemplate)
|
|
5640
8497
|
], PrintExecutor);
|
|
5641
8498
|
|
|
@@ -5647,11 +8504,13 @@ __name(registerComponentClass, "registerComponentClass");
|
|
|
5647
8504
|
export {
|
|
5648
8505
|
AlwaysFalseCondition,
|
|
5649
8506
|
AlwaysTrueCondition,
|
|
8507
|
+
BlueprintArray,
|
|
5650
8508
|
BlueprintComponent,
|
|
5651
8509
|
BlueprintComposer,
|
|
5652
8510
|
BlueprintExpose,
|
|
5653
8511
|
BlueprintFragment,
|
|
5654
8512
|
BlueprintMethod,
|
|
8513
|
+
BlueprintObject,
|
|
5655
8514
|
BlueprintProperty,
|
|
5656
8515
|
BlueprintSystem,
|
|
5657
8516
|
BlueprintTrigger,
|
|
@@ -5670,6 +8529,8 @@ export {
|
|
|
5670
8529
|
NodeRegistry,
|
|
5671
8530
|
NotCondition,
|
|
5672
8531
|
RegisterNode,
|
|
8532
|
+
Schema,
|
|
8533
|
+
SchemaRegistry,
|
|
5673
8534
|
StateNameCondition,
|
|
5674
8535
|
TimerIdCondition,
|
|
5675
8536
|
TriggerDispatcher,
|
|
@@ -5677,7 +8538,10 @@ export {
|
|
|
5677
8538
|
TriggerTypeCondition,
|
|
5678
8539
|
TriggerTypes,
|
|
5679
8540
|
arePinTypesCompatible,
|
|
8541
|
+
buildPath,
|
|
8542
|
+
buildPortPath,
|
|
5680
8543
|
clearRegisteredComponents,
|
|
8544
|
+
cloneSchema,
|
|
5681
8545
|
condition,
|
|
5682
8546
|
createCollisionContext,
|
|
5683
8547
|
createCollisionTrigger,
|
|
@@ -5703,17 +8567,33 @@ export {
|
|
|
5703
8567
|
createTrigger,
|
|
5704
8568
|
createTriggerDispatcher,
|
|
5705
8569
|
defaultFragmentRegistry,
|
|
8570
|
+
deleteByPath,
|
|
8571
|
+
expandWildcardPath,
|
|
5706
8572
|
fragmentFromAsset,
|
|
5707
8573
|
fragmentToAsset,
|
|
5708
8574
|
generateComponentNodes,
|
|
5709
8575
|
getBlueprintMetadata,
|
|
8576
|
+
getByPath,
|
|
5710
8577
|
getNodeCategoryColor,
|
|
8578
|
+
getParentPath,
|
|
8579
|
+
getPathLastName,
|
|
5711
8580
|
getPinTypeColor,
|
|
8581
|
+
getPrimitiveDefaultValue,
|
|
5712
8582
|
getRegisteredBlueprintComponents,
|
|
8583
|
+
getSchemaDefaultValue,
|
|
8584
|
+
hasPath,
|
|
8585
|
+
hasWildcard,
|
|
5713
8586
|
inferPinType,
|
|
8587
|
+
mergeObjectSchemas,
|
|
8588
|
+
parsePath,
|
|
8589
|
+
parsePortPath,
|
|
5714
8590
|
registerAllComponentNodes,
|
|
5715
8591
|
registerComponentClass,
|
|
5716
8592
|
registerComponentNodes,
|
|
5717
|
-
|
|
8593
|
+
schemaToPinType,
|
|
8594
|
+
setByPath,
|
|
8595
|
+
updatePathOnArrayChange,
|
|
8596
|
+
validateBlueprintAsset,
|
|
8597
|
+
validateSchema
|
|
5718
8598
|
};
|
|
5719
8599
|
//# sourceMappingURL=index.js.map
|