@esengine/blueprint 4.1.0 → 4.2.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 +200 -82
- package/dist/index.js +1444 -1055
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,7 +64,19 @@ function getNodeCategoryColor(category) {
|
|
|
64
64
|
__name(getNodeCategoryColor, "getNodeCategoryColor");
|
|
65
65
|
|
|
66
66
|
// src/types/blueprint.ts
|
|
67
|
-
function createEmptyBlueprint(name) {
|
|
67
|
+
function createEmptyBlueprint(name, includeBeginPlay = true) {
|
|
68
|
+
const nodes = [];
|
|
69
|
+
if (includeBeginPlay) {
|
|
70
|
+
nodes.push({
|
|
71
|
+
id: "node_beginplay_1",
|
|
72
|
+
type: "EventBeginPlay",
|
|
73
|
+
position: {
|
|
74
|
+
x: 100,
|
|
75
|
+
y: 200
|
|
76
|
+
},
|
|
77
|
+
data: {}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
68
80
|
return {
|
|
69
81
|
version: 1,
|
|
70
82
|
type: "blueprint",
|
|
@@ -74,7 +86,7 @@ function createEmptyBlueprint(name) {
|
|
|
74
86
|
modifiedAt: Date.now()
|
|
75
87
|
},
|
|
76
88
|
variables: [],
|
|
77
|
-
nodes
|
|
89
|
+
nodes,
|
|
78
90
|
connections: []
|
|
79
91
|
};
|
|
80
92
|
}
|
|
@@ -86,6 +98,109 @@ function validateBlueprintAsset(asset) {
|
|
|
86
98
|
}
|
|
87
99
|
__name(validateBlueprintAsset, "validateBlueprintAsset");
|
|
88
100
|
|
|
101
|
+
// src/registry/BlueprintDecorators.ts
|
|
102
|
+
var registeredComponents = /* @__PURE__ */ new Map();
|
|
103
|
+
function getRegisteredBlueprintComponents() {
|
|
104
|
+
return registeredComponents;
|
|
105
|
+
}
|
|
106
|
+
__name(getRegisteredBlueprintComponents, "getRegisteredBlueprintComponents");
|
|
107
|
+
function getBlueprintMetadata(componentClass) {
|
|
108
|
+
return registeredComponents.get(componentClass);
|
|
109
|
+
}
|
|
110
|
+
__name(getBlueprintMetadata, "getBlueprintMetadata");
|
|
111
|
+
function clearRegisteredComponents() {
|
|
112
|
+
registeredComponents.clear();
|
|
113
|
+
}
|
|
114
|
+
__name(clearRegisteredComponents, "clearRegisteredComponents");
|
|
115
|
+
function getOrCreateMetadata(constructor) {
|
|
116
|
+
let metadata = registeredComponents.get(constructor);
|
|
117
|
+
if (!metadata) {
|
|
118
|
+
metadata = {
|
|
119
|
+
componentName: constructor.__componentName__ ?? constructor.name,
|
|
120
|
+
properties: [],
|
|
121
|
+
methods: []
|
|
122
|
+
};
|
|
123
|
+
registeredComponents.set(constructor, metadata);
|
|
124
|
+
}
|
|
125
|
+
return metadata;
|
|
126
|
+
}
|
|
127
|
+
__name(getOrCreateMetadata, "getOrCreateMetadata");
|
|
128
|
+
function BlueprintExpose(options = {}) {
|
|
129
|
+
return function(target) {
|
|
130
|
+
const metadata = getOrCreateMetadata(target);
|
|
131
|
+
Object.assign(metadata, options);
|
|
132
|
+
metadata.componentName = target.__componentName__ ?? target.name;
|
|
133
|
+
return target;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
__name(BlueprintExpose, "BlueprintExpose");
|
|
137
|
+
function BlueprintProperty(options = {}) {
|
|
138
|
+
return function(target, propertyKey) {
|
|
139
|
+
const key = String(propertyKey);
|
|
140
|
+
const metadata = getOrCreateMetadata(target.constructor);
|
|
141
|
+
const propMeta = {
|
|
142
|
+
propertyKey: key,
|
|
143
|
+
displayName: options.displayName ?? key,
|
|
144
|
+
description: options.description,
|
|
145
|
+
pinType: options.type ?? "any",
|
|
146
|
+
readonly: options.readonly ?? false,
|
|
147
|
+
defaultValue: options.defaultValue
|
|
148
|
+
};
|
|
149
|
+
const existingIndex = metadata.properties.findIndex((p) => p.propertyKey === key);
|
|
150
|
+
if (existingIndex >= 0) {
|
|
151
|
+
metadata.properties[existingIndex] = propMeta;
|
|
152
|
+
} else {
|
|
153
|
+
metadata.properties.push(propMeta);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
__name(BlueprintProperty, "BlueprintProperty");
|
|
158
|
+
function BlueprintMethod(options = {}) {
|
|
159
|
+
return function(target, propertyKey, descriptor) {
|
|
160
|
+
const key = String(propertyKey);
|
|
161
|
+
const metadata = getOrCreateMetadata(target.constructor);
|
|
162
|
+
const methodMeta = {
|
|
163
|
+
methodKey: key,
|
|
164
|
+
displayName: options.displayName ?? key,
|
|
165
|
+
description: options.description,
|
|
166
|
+
isPure: options.isPure ?? false,
|
|
167
|
+
params: options.params ?? [],
|
|
168
|
+
returnType: options.returnType ?? "any"
|
|
169
|
+
};
|
|
170
|
+
const existingIndex = metadata.methods.findIndex((m) => m.methodKey === key);
|
|
171
|
+
if (existingIndex >= 0) {
|
|
172
|
+
metadata.methods[existingIndex] = methodMeta;
|
|
173
|
+
} else {
|
|
174
|
+
metadata.methods.push(methodMeta);
|
|
175
|
+
}
|
|
176
|
+
return descriptor;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
__name(BlueprintMethod, "BlueprintMethod");
|
|
180
|
+
function inferPinType(typeName) {
|
|
181
|
+
const typeMap = {
|
|
182
|
+
"number": "float",
|
|
183
|
+
"Number": "float",
|
|
184
|
+
"string": "string",
|
|
185
|
+
"String": "string",
|
|
186
|
+
"boolean": "bool",
|
|
187
|
+
"Boolean": "bool",
|
|
188
|
+
"Entity": "entity",
|
|
189
|
+
"Component": "component",
|
|
190
|
+
"Vector2": "vector2",
|
|
191
|
+
"Vec2": "vector2",
|
|
192
|
+
"Vector3": "vector3",
|
|
193
|
+
"Vec3": "vector3",
|
|
194
|
+
"Color": "color",
|
|
195
|
+
"Array": "array",
|
|
196
|
+
"Object": "object",
|
|
197
|
+
"void": "exec",
|
|
198
|
+
"undefined": "exec"
|
|
199
|
+
};
|
|
200
|
+
return typeMap[typeName] ?? "any";
|
|
201
|
+
}
|
|
202
|
+
__name(inferPinType, "inferPinType");
|
|
203
|
+
|
|
89
204
|
// src/runtime/ExecutionContext.ts
|
|
90
205
|
var _ExecutionContext = class _ExecutionContext {
|
|
91
206
|
constructor(blueprint, entity, scene) {
|
|
@@ -253,10 +368,49 @@ var _ExecutionContext = class _ExecutionContext {
|
|
|
253
368
|
static clearGlobalVariables() {
|
|
254
369
|
_ExecutionContext._globalVariables.clear();
|
|
255
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Get a component class by name
|
|
373
|
+
* 通过名称获取组件类
|
|
374
|
+
*
|
|
375
|
+
* @zh 首先检查 @BlueprintExpose 装饰的组件,然后检查手动注册的组件
|
|
376
|
+
* @en First checks @BlueprintExpose decorated components, then manually registered ones
|
|
377
|
+
*/
|
|
378
|
+
getComponentClass(typeName) {
|
|
379
|
+
const blueprintComponents = getRegisteredBlueprintComponents();
|
|
380
|
+
for (const [componentClass, metadata] of blueprintComponents) {
|
|
381
|
+
if (metadata.componentName === typeName || componentClass.name === typeName) {
|
|
382
|
+
return componentClass;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return _ExecutionContext._componentRegistry.get(typeName);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Register a component class for dynamic creation
|
|
389
|
+
* 注册组件类以支持动态创建
|
|
390
|
+
*/
|
|
391
|
+
static registerComponentClass(typeName, componentClass) {
|
|
392
|
+
_ExecutionContext._componentRegistry.set(typeName, componentClass);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Unregister a component class
|
|
396
|
+
* 取消注册组件类
|
|
397
|
+
*/
|
|
398
|
+
static unregisterComponentClass(typeName) {
|
|
399
|
+
_ExecutionContext._componentRegistry.delete(typeName);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Get all registered component classes
|
|
403
|
+
* 获取所有已注册的组件类
|
|
404
|
+
*/
|
|
405
|
+
static getRegisteredComponentClasses() {
|
|
406
|
+
return new Map(_ExecutionContext._componentRegistry);
|
|
407
|
+
}
|
|
256
408
|
};
|
|
257
409
|
__name(_ExecutionContext, "ExecutionContext");
|
|
258
410
|
/** Global variables (shared) (全局变量,共享) */
|
|
259
411
|
__publicField(_ExecutionContext, "_globalVariables", /* @__PURE__ */ new Map());
|
|
412
|
+
/** Component class registry (组件类注册表) */
|
|
413
|
+
__publicField(_ExecutionContext, "_componentRegistry", /* @__PURE__ */ new Map());
|
|
260
414
|
var ExecutionContext = _ExecutionContext;
|
|
261
415
|
|
|
262
416
|
// src/runtime/NodeRegistry.ts
|
|
@@ -576,104 +730,622 @@ __name(_BlueprintVM, "BlueprintVM");
|
|
|
576
730
|
var BlueprintVM = _BlueprintVM;
|
|
577
731
|
|
|
578
732
|
// src/runtime/BlueprintComponent.ts
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
debug: false,
|
|
586
|
-
vm: null,
|
|
587
|
-
isStarted: false
|
|
588
|
-
};
|
|
733
|
+
import { Component, ECSComponent } from "@esengine/ecs-framework";
|
|
734
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
735
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
736
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
737
|
+
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;
|
|
738
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
589
739
|
}
|
|
590
|
-
__name(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
740
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
741
|
+
var _BlueprintComponent = class _BlueprintComponent extends Component {
|
|
742
|
+
constructor() {
|
|
743
|
+
super(...arguments);
|
|
744
|
+
/**
|
|
745
|
+
* @zh 蓝图资产引用
|
|
746
|
+
* @en Blueprint asset reference
|
|
747
|
+
*/
|
|
748
|
+
__publicField(this, "blueprintAsset", null);
|
|
749
|
+
/**
|
|
750
|
+
* @zh 用于序列化的蓝图资产路径
|
|
751
|
+
* @en Blueprint asset path for serialization
|
|
752
|
+
*/
|
|
753
|
+
__publicField(this, "blueprintPath", "");
|
|
754
|
+
/**
|
|
755
|
+
* @zh 实体创建时自动开始执行
|
|
756
|
+
* @en Auto-start execution when entity is created
|
|
757
|
+
*/
|
|
758
|
+
__publicField(this, "autoStart", true);
|
|
759
|
+
/**
|
|
760
|
+
* @zh 启用 VM 调试模式
|
|
761
|
+
* @en Enable debug mode for VM
|
|
762
|
+
*/
|
|
763
|
+
__publicField(this, "debug", false);
|
|
764
|
+
/**
|
|
765
|
+
* @zh 运行时 VM 实例
|
|
766
|
+
* @en Runtime VM instance
|
|
767
|
+
*/
|
|
768
|
+
__publicField(this, "vm", null);
|
|
769
|
+
/**
|
|
770
|
+
* @zh 蓝图是否已启动
|
|
771
|
+
* @en Whether the blueprint has started
|
|
772
|
+
*/
|
|
773
|
+
__publicField(this, "isStarted", false);
|
|
594
774
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
775
|
+
/**
|
|
776
|
+
* @zh 初始化蓝图 VM
|
|
777
|
+
* @en Initialize blueprint VM
|
|
778
|
+
*/
|
|
779
|
+
initialize(entity, scene) {
|
|
780
|
+
if (!this.blueprintAsset) return;
|
|
781
|
+
this.vm = new BlueprintVM(this.blueprintAsset, entity, scene);
|
|
782
|
+
this.vm.debug = this.debug;
|
|
603
783
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
784
|
+
/**
|
|
785
|
+
* @zh 开始执行蓝图
|
|
786
|
+
* @en Start blueprint execution
|
|
787
|
+
*/
|
|
788
|
+
start() {
|
|
789
|
+
if (this.vm && !this.isStarted) {
|
|
790
|
+
this.vm.start();
|
|
791
|
+
this.isStarted = true;
|
|
792
|
+
}
|
|
610
793
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
794
|
+
/**
|
|
795
|
+
* @zh 停止执行蓝图
|
|
796
|
+
* @en Stop blueprint execution
|
|
797
|
+
*/
|
|
798
|
+
stop() {
|
|
799
|
+
if (this.vm && this.isStarted) {
|
|
800
|
+
this.vm.stop();
|
|
801
|
+
this.isStarted = false;
|
|
802
|
+
}
|
|
616
803
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
804
|
+
/**
|
|
805
|
+
* @zh 更新蓝图
|
|
806
|
+
* @en Update blueprint
|
|
807
|
+
*/
|
|
808
|
+
tick(deltaTime) {
|
|
809
|
+
if (this.vm && this.isStarted) {
|
|
810
|
+
this.vm.tick(deltaTime);
|
|
623
811
|
}
|
|
624
|
-
component.vm = null;
|
|
625
|
-
component.isStarted = false;
|
|
626
812
|
}
|
|
627
|
-
|
|
628
|
-
|
|
813
|
+
/**
|
|
814
|
+
* @zh 清理蓝图资源
|
|
815
|
+
* @en Cleanup blueprint resources
|
|
816
|
+
*/
|
|
817
|
+
cleanup() {
|
|
818
|
+
if (this.vm) {
|
|
819
|
+
if (this.isStarted) {
|
|
820
|
+
this.vm.stop();
|
|
821
|
+
}
|
|
822
|
+
this.vm = null;
|
|
823
|
+
this.isStarted = false;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
__name(_BlueprintComponent, "BlueprintComponent");
|
|
828
|
+
var BlueprintComponent = _BlueprintComponent;
|
|
829
|
+
BlueprintComponent = _ts_decorate([
|
|
830
|
+
ECSComponent("Blueprint")
|
|
831
|
+
], BlueprintComponent);
|
|
629
832
|
|
|
630
833
|
// src/runtime/BlueprintSystem.ts
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
834
|
+
import { EntitySystem, Matcher, ECSSystem, Time } from "@esengine/ecs-framework";
|
|
835
|
+
|
|
836
|
+
// src/registry/ComponentNodeGenerator.ts
|
|
837
|
+
function generateComponentNodes(componentClass, metadata) {
|
|
838
|
+
const { componentName, properties, methods } = metadata;
|
|
839
|
+
const category = metadata.category ?? "component";
|
|
840
|
+
const color = metadata.color ?? "#1e8b8b";
|
|
841
|
+
generateAddComponentNode(componentClass, componentName, metadata, color);
|
|
842
|
+
generateGetComponentNode(componentClass, componentName, metadata, color);
|
|
843
|
+
for (const prop of properties) {
|
|
844
|
+
generatePropertyGetNode(componentName, prop, category, color);
|
|
845
|
+
if (!prop.readonly) {
|
|
846
|
+
generatePropertySetNode(componentName, prop, category, color);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
for (const method of methods) {
|
|
850
|
+
generateMethodCallNode(componentName, method, category, color);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
__name(generateComponentNodes, "generateComponentNodes");
|
|
854
|
+
function generateAddComponentNode(componentClass, componentName, metadata, color) {
|
|
855
|
+
const nodeType = `Add_${componentName}`;
|
|
856
|
+
const displayName = metadata.displayName ?? componentName;
|
|
857
|
+
const propertyInputs = [];
|
|
858
|
+
const propertyDefaults = {};
|
|
859
|
+
for (const prop of metadata.properties) {
|
|
860
|
+
if (!prop.readonly) {
|
|
861
|
+
propertyInputs.push({
|
|
862
|
+
name: prop.propertyKey,
|
|
863
|
+
type: prop.pinType,
|
|
864
|
+
displayName: prop.displayName,
|
|
865
|
+
defaultValue: prop.defaultValue
|
|
866
|
+
});
|
|
867
|
+
propertyDefaults[prop.propertyKey] = prop.defaultValue;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
const template = {
|
|
871
|
+
type: nodeType,
|
|
872
|
+
title: `Add ${displayName}`,
|
|
873
|
+
category: "component",
|
|
874
|
+
color,
|
|
875
|
+
description: `Adds ${displayName} component to entity (\u4E3A\u5B9E\u4F53\u6DFB\u52A0 ${displayName} \u7EC4\u4EF6)`,
|
|
876
|
+
keywords: [
|
|
877
|
+
"add",
|
|
878
|
+
"component",
|
|
879
|
+
"create",
|
|
880
|
+
componentName.toLowerCase()
|
|
881
|
+
],
|
|
882
|
+
menuPath: [
|
|
883
|
+
"Components",
|
|
884
|
+
displayName,
|
|
885
|
+
`Add ${displayName}`
|
|
886
|
+
],
|
|
887
|
+
inputs: [
|
|
888
|
+
{
|
|
889
|
+
name: "exec",
|
|
890
|
+
type: "exec",
|
|
891
|
+
displayName: ""
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "entity",
|
|
895
|
+
type: "entity",
|
|
896
|
+
displayName: "Entity"
|
|
897
|
+
},
|
|
898
|
+
...propertyInputs
|
|
899
|
+
],
|
|
900
|
+
outputs: [
|
|
901
|
+
{
|
|
902
|
+
name: "exec",
|
|
903
|
+
type: "exec",
|
|
904
|
+
displayName: ""
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
name: "component",
|
|
908
|
+
type: "component",
|
|
909
|
+
displayName
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
name: "success",
|
|
913
|
+
type: "bool",
|
|
914
|
+
displayName: "Success"
|
|
646
915
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
916
|
+
]
|
|
917
|
+
};
|
|
918
|
+
const propertyKeys = metadata.properties.filter((p) => !p.readonly).map((p) => p.propertyKey);
|
|
919
|
+
const executor = {
|
|
920
|
+
execute(node, context) {
|
|
921
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
922
|
+
if (!entity || entity.isDestroyed) {
|
|
923
|
+
return {
|
|
924
|
+
outputs: {
|
|
925
|
+
component: null,
|
|
926
|
+
success: false
|
|
927
|
+
},
|
|
928
|
+
nextExec: "exec"
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
const existing = entity.components.find((c) => c.constructor === componentClass || c.constructor.name === componentName || c.constructor.__componentName__ === componentName);
|
|
932
|
+
if (existing) {
|
|
933
|
+
return {
|
|
934
|
+
outputs: {
|
|
935
|
+
component: existing,
|
|
936
|
+
success: false
|
|
937
|
+
},
|
|
938
|
+
nextExec: "exec"
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
try {
|
|
942
|
+
const component = new componentClass();
|
|
943
|
+
for (const key of propertyKeys) {
|
|
944
|
+
const value = context.evaluateInput(node.id, key, propertyDefaults[key]);
|
|
945
|
+
if (value !== void 0) {
|
|
946
|
+
component[key] = value;
|
|
947
|
+
}
|
|
654
948
|
}
|
|
949
|
+
entity.addComponent(component);
|
|
950
|
+
return {
|
|
951
|
+
outputs: {
|
|
952
|
+
component,
|
|
953
|
+
success: true
|
|
954
|
+
},
|
|
955
|
+
nextExec: "exec"
|
|
956
|
+
};
|
|
957
|
+
} catch (error) {
|
|
958
|
+
console.error(`[Blueprint] Failed to add ${componentName}:`, error);
|
|
959
|
+
return {
|
|
960
|
+
outputs: {
|
|
961
|
+
component: null,
|
|
962
|
+
success: false
|
|
963
|
+
},
|
|
964
|
+
nextExec: "exec"
|
|
965
|
+
};
|
|
655
966
|
}
|
|
656
|
-
},
|
|
657
|
-
onEntityRemoved(entity) {
|
|
658
|
-
cleanupBlueprint(entity.blueprintComponent);
|
|
659
967
|
}
|
|
660
968
|
};
|
|
969
|
+
NodeRegistry.instance.register(template, executor);
|
|
661
970
|
}
|
|
662
|
-
__name(
|
|
663
|
-
function
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
971
|
+
__name(generateAddComponentNode, "generateAddComponentNode");
|
|
972
|
+
function generateGetComponentNode(componentClass, componentName, metadata, color) {
|
|
973
|
+
const nodeType = `Get_${componentName}`;
|
|
974
|
+
const displayName = metadata.displayName ?? componentName;
|
|
975
|
+
const template = {
|
|
976
|
+
type: nodeType,
|
|
977
|
+
title: `Get ${displayName}`,
|
|
978
|
+
category: "component",
|
|
979
|
+
color,
|
|
980
|
+
isPure: true,
|
|
981
|
+
description: `Gets ${displayName} component from entity (\u4ECE\u5B9E\u4F53\u83B7\u53D6 ${displayName} \u7EC4\u4EF6)`,
|
|
982
|
+
keywords: [
|
|
983
|
+
"get",
|
|
984
|
+
"component",
|
|
985
|
+
componentName.toLowerCase()
|
|
986
|
+
],
|
|
987
|
+
menuPath: [
|
|
988
|
+
"Components",
|
|
989
|
+
displayName,
|
|
990
|
+
`Get ${displayName}`
|
|
991
|
+
],
|
|
992
|
+
inputs: [
|
|
993
|
+
{
|
|
994
|
+
name: "entity",
|
|
995
|
+
type: "entity",
|
|
996
|
+
displayName: "Entity"
|
|
997
|
+
}
|
|
998
|
+
],
|
|
999
|
+
outputs: [
|
|
1000
|
+
{
|
|
1001
|
+
name: "component",
|
|
1002
|
+
type: "component",
|
|
1003
|
+
displayName
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
name: "found",
|
|
1007
|
+
type: "bool",
|
|
1008
|
+
displayName: "Found"
|
|
1009
|
+
}
|
|
1010
|
+
]
|
|
1011
|
+
};
|
|
1012
|
+
const executor = {
|
|
1013
|
+
execute(node, context) {
|
|
1014
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
1015
|
+
if (!entity || entity.isDestroyed) {
|
|
1016
|
+
return {
|
|
1017
|
+
outputs: {
|
|
1018
|
+
component: null,
|
|
1019
|
+
found: false
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
const component = entity.components.find((c) => c.constructor === componentClass || c.constructor.name === componentName || c.constructor.__componentName__ === componentName);
|
|
1024
|
+
return {
|
|
1025
|
+
outputs: {
|
|
1026
|
+
component: component ?? null,
|
|
1027
|
+
found: component != null
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
NodeRegistry.instance.register(template, executor);
|
|
1033
|
+
}
|
|
1034
|
+
__name(generateGetComponentNode, "generateGetComponentNode");
|
|
1035
|
+
function generatePropertyGetNode(componentName, prop, category, color) {
|
|
1036
|
+
const nodeType = `Get_${componentName}_${prop.propertyKey}`;
|
|
1037
|
+
const { displayName, pinType } = prop;
|
|
1038
|
+
const template = {
|
|
1039
|
+
type: nodeType,
|
|
1040
|
+
title: `Get ${displayName}`,
|
|
1041
|
+
subtitle: componentName,
|
|
1042
|
+
category,
|
|
1043
|
+
color,
|
|
1044
|
+
isPure: true,
|
|
1045
|
+
description: prop.description ?? `Gets ${displayName} from ${componentName} (\u4ECE ${componentName} \u83B7\u53D6 ${displayName})`,
|
|
1046
|
+
keywords: [
|
|
1047
|
+
"get",
|
|
1048
|
+
"property",
|
|
1049
|
+
componentName.toLowerCase(),
|
|
1050
|
+
prop.propertyKey.toLowerCase()
|
|
1051
|
+
],
|
|
1052
|
+
menuPath: [
|
|
1053
|
+
"Components",
|
|
1054
|
+
componentName,
|
|
1055
|
+
`Get ${displayName}`
|
|
1056
|
+
],
|
|
1057
|
+
inputs: [
|
|
1058
|
+
{
|
|
1059
|
+
name: "component",
|
|
1060
|
+
type: "component",
|
|
1061
|
+
displayName: componentName
|
|
1062
|
+
}
|
|
1063
|
+
],
|
|
1064
|
+
outputs: [
|
|
1065
|
+
{
|
|
1066
|
+
name: "value",
|
|
1067
|
+
type: pinType,
|
|
1068
|
+
displayName
|
|
1069
|
+
}
|
|
1070
|
+
]
|
|
1071
|
+
};
|
|
1072
|
+
const propertyKey = prop.propertyKey;
|
|
1073
|
+
const defaultValue = prop.defaultValue;
|
|
1074
|
+
const executor = {
|
|
1075
|
+
execute(node, context) {
|
|
1076
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
1077
|
+
if (!component) {
|
|
1078
|
+
return {
|
|
1079
|
+
outputs: {
|
|
1080
|
+
value: defaultValue ?? null
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
const value = component[propertyKey];
|
|
1085
|
+
return {
|
|
1086
|
+
outputs: {
|
|
1087
|
+
value
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
NodeRegistry.instance.register(template, executor);
|
|
1093
|
+
}
|
|
1094
|
+
__name(generatePropertyGetNode, "generatePropertyGetNode");
|
|
1095
|
+
function generatePropertySetNode(componentName, prop, category, color) {
|
|
1096
|
+
const nodeType = `Set_${componentName}_${prop.propertyKey}`;
|
|
1097
|
+
const { displayName, pinType, defaultValue } = prop;
|
|
1098
|
+
const template = {
|
|
1099
|
+
type: nodeType,
|
|
1100
|
+
title: `Set ${displayName}`,
|
|
1101
|
+
subtitle: componentName,
|
|
1102
|
+
category,
|
|
1103
|
+
color,
|
|
1104
|
+
description: prop.description ?? `Sets ${displayName} on ${componentName} (\u8BBE\u7F6E ${componentName} \u7684 ${displayName})`,
|
|
1105
|
+
keywords: [
|
|
1106
|
+
"set",
|
|
1107
|
+
"property",
|
|
1108
|
+
componentName.toLowerCase(),
|
|
1109
|
+
prop.propertyKey.toLowerCase()
|
|
1110
|
+
],
|
|
1111
|
+
menuPath: [
|
|
1112
|
+
"Components",
|
|
1113
|
+
componentName,
|
|
1114
|
+
`Set ${displayName}`
|
|
1115
|
+
],
|
|
1116
|
+
inputs: [
|
|
1117
|
+
{
|
|
1118
|
+
name: "exec",
|
|
1119
|
+
type: "exec",
|
|
1120
|
+
displayName: ""
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
name: "component",
|
|
1124
|
+
type: "component",
|
|
1125
|
+
displayName: componentName
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
name: "value",
|
|
1129
|
+
type: pinType,
|
|
1130
|
+
displayName,
|
|
1131
|
+
defaultValue
|
|
1132
|
+
}
|
|
1133
|
+
],
|
|
1134
|
+
outputs: [
|
|
1135
|
+
{
|
|
1136
|
+
name: "exec",
|
|
1137
|
+
type: "exec",
|
|
1138
|
+
displayName: ""
|
|
1139
|
+
}
|
|
1140
|
+
]
|
|
1141
|
+
};
|
|
1142
|
+
const propertyKey = prop.propertyKey;
|
|
1143
|
+
const executor = {
|
|
1144
|
+
execute(node, context) {
|
|
1145
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
1146
|
+
const value = context.evaluateInput(node.id, "value", defaultValue);
|
|
1147
|
+
if (component) {
|
|
1148
|
+
component[propertyKey] = value;
|
|
1149
|
+
}
|
|
1150
|
+
return {
|
|
1151
|
+
nextExec: "exec"
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
NodeRegistry.instance.register(template, executor);
|
|
1156
|
+
}
|
|
1157
|
+
__name(generatePropertySetNode, "generatePropertySetNode");
|
|
1158
|
+
function generateMethodCallNode(componentName, method, category, color) {
|
|
1159
|
+
const nodeType = `Call_${componentName}_${method.methodKey}`;
|
|
1160
|
+
const { displayName, isPure, params, returnType } = method;
|
|
1161
|
+
const inputs = [];
|
|
1162
|
+
if (!isPure) {
|
|
1163
|
+
inputs.push({
|
|
1164
|
+
name: "exec",
|
|
1165
|
+
type: "exec",
|
|
1166
|
+
displayName: ""
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
inputs.push({
|
|
1170
|
+
name: "component",
|
|
1171
|
+
type: "component",
|
|
1172
|
+
displayName: componentName
|
|
1173
|
+
});
|
|
1174
|
+
const paramNames = [];
|
|
1175
|
+
for (const param of params) {
|
|
1176
|
+
inputs.push({
|
|
1177
|
+
name: param.name,
|
|
1178
|
+
type: param.type ?? "any",
|
|
1179
|
+
displayName: param.displayName ?? param.name,
|
|
1180
|
+
defaultValue: param.defaultValue
|
|
1181
|
+
});
|
|
1182
|
+
paramNames.push(param.name);
|
|
1183
|
+
}
|
|
1184
|
+
const outputs = [];
|
|
1185
|
+
if (!isPure) {
|
|
1186
|
+
outputs.push({
|
|
1187
|
+
name: "exec",
|
|
1188
|
+
type: "exec",
|
|
1189
|
+
displayName: ""
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
if (returnType !== "exec" && returnType !== "any") {
|
|
1193
|
+
outputs.push({
|
|
1194
|
+
name: "result",
|
|
1195
|
+
type: returnType,
|
|
1196
|
+
displayName: "Result"
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
const template = {
|
|
1200
|
+
type: nodeType,
|
|
1201
|
+
title: displayName,
|
|
1202
|
+
subtitle: componentName,
|
|
1203
|
+
category,
|
|
1204
|
+
color,
|
|
1205
|
+
isPure,
|
|
1206
|
+
description: method.description ?? `Calls ${displayName} on ${componentName} (\u8C03\u7528 ${componentName} \u7684 ${displayName})`,
|
|
1207
|
+
keywords: [
|
|
1208
|
+
"call",
|
|
1209
|
+
"method",
|
|
1210
|
+
componentName.toLowerCase(),
|
|
1211
|
+
method.methodKey.toLowerCase()
|
|
1212
|
+
],
|
|
1213
|
+
menuPath: [
|
|
1214
|
+
"Components",
|
|
1215
|
+
componentName,
|
|
1216
|
+
displayName
|
|
1217
|
+
],
|
|
1218
|
+
inputs,
|
|
1219
|
+
outputs
|
|
1220
|
+
};
|
|
1221
|
+
const methodKey = method.methodKey;
|
|
1222
|
+
const executor = {
|
|
1223
|
+
execute(node, context) {
|
|
1224
|
+
const component = context.evaluateInput(node.id, "component", null);
|
|
1225
|
+
if (!component) {
|
|
1226
|
+
return isPure ? {
|
|
1227
|
+
outputs: {
|
|
1228
|
+
result: null
|
|
1229
|
+
}
|
|
1230
|
+
} : {
|
|
1231
|
+
nextExec: "exec"
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
const args = paramNames.map((name) => context.evaluateInput(node.id, name, void 0));
|
|
1235
|
+
const fn = component[methodKey];
|
|
1236
|
+
if (typeof fn !== "function") {
|
|
1237
|
+
console.warn(`Method ${methodKey} not found on component ${componentName}`);
|
|
1238
|
+
return isPure ? {
|
|
1239
|
+
outputs: {
|
|
1240
|
+
result: null
|
|
1241
|
+
}
|
|
1242
|
+
} : {
|
|
1243
|
+
nextExec: "exec"
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
const result = fn.apply(component, args);
|
|
1247
|
+
return isPure ? {
|
|
1248
|
+
outputs: {
|
|
1249
|
+
result
|
|
1250
|
+
}
|
|
1251
|
+
} : {
|
|
1252
|
+
outputs: {
|
|
1253
|
+
result
|
|
1254
|
+
},
|
|
1255
|
+
nextExec: "exec"
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
NodeRegistry.instance.register(template, executor);
|
|
1260
|
+
}
|
|
1261
|
+
__name(generateMethodCallNode, "generateMethodCallNode");
|
|
1262
|
+
function registerAllComponentNodes() {
|
|
1263
|
+
const components = getRegisteredBlueprintComponents();
|
|
1264
|
+
for (const [componentClass, metadata] of components) {
|
|
1265
|
+
try {
|
|
1266
|
+
generateComponentNodes(componentClass, metadata);
|
|
1267
|
+
console.log(`[Blueprint] Registered component: ${metadata.componentName} (${metadata.properties.length} properties, ${metadata.methods.length} methods)`);
|
|
1268
|
+
} catch (error) {
|
|
1269
|
+
console.error(`[Blueprint] Failed to register component ${metadata.componentName}:`, error);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
console.log(`[Blueprint] Registered ${components.size} component(s)`);
|
|
1273
|
+
}
|
|
1274
|
+
__name(registerAllComponentNodes, "registerAllComponentNodes");
|
|
1275
|
+
function registerComponentNodes(componentClass) {
|
|
1276
|
+
const components = getRegisteredBlueprintComponents();
|
|
1277
|
+
const metadata = components.get(componentClass);
|
|
1278
|
+
if (!metadata) {
|
|
1279
|
+
console.warn(`[Blueprint] Component ${componentClass.name} is not marked with @BlueprintExpose`);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
generateComponentNodes(componentClass, metadata);
|
|
1283
|
+
}
|
|
1284
|
+
__name(registerComponentNodes, "registerComponentNodes");
|
|
1285
|
+
|
|
1286
|
+
// src/runtime/BlueprintSystem.ts
|
|
1287
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1288
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1289
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1290
|
+
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;
|
|
1291
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1292
|
+
}
|
|
1293
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
1294
|
+
function _ts_metadata(k, v) {
|
|
1295
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1296
|
+
}
|
|
1297
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
1298
|
+
var _BlueprintSystem = class _BlueprintSystem extends EntitySystem {
|
|
1299
|
+
constructor() {
|
|
1300
|
+
super(Matcher.all(BlueprintComponent));
|
|
1301
|
+
__publicField(this, "_componentsRegistered", false);
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* @zh 系统初始化时注册所有组件节点
|
|
1305
|
+
* @en Register all component nodes when system initializes
|
|
1306
|
+
*/
|
|
1307
|
+
onInitialize() {
|
|
1308
|
+
if (!this._componentsRegistered) {
|
|
1309
|
+
registerAllComponentNodes();
|
|
1310
|
+
this._componentsRegistered = true;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* @zh 处理所有带有蓝图组件的实体
|
|
1315
|
+
* @en Process all entities with blueprint components
|
|
1316
|
+
*/
|
|
1317
|
+
process(entities) {
|
|
1318
|
+
const dt = Time.deltaTime;
|
|
1319
|
+
for (const entity of entities) {
|
|
1320
|
+
const blueprint = entity.getComponent(BlueprintComponent);
|
|
1321
|
+
if (!blueprint?.blueprintAsset) continue;
|
|
1322
|
+
if (!blueprint.vm) {
|
|
1323
|
+
blueprint.initialize(entity, this.scene);
|
|
1324
|
+
}
|
|
1325
|
+
if (blueprint.autoStart && !blueprint.isStarted) {
|
|
1326
|
+
blueprint.start();
|
|
1327
|
+
}
|
|
1328
|
+
blueprint.tick(dt);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* @zh 实体移除时清理蓝图资源
|
|
1333
|
+
* @en Cleanup blueprint resources when entity is removed
|
|
1334
|
+
*/
|
|
1335
|
+
onRemoved(entity) {
|
|
1336
|
+
const blueprint = entity.getComponent(BlueprintComponent);
|
|
1337
|
+
if (blueprint) {
|
|
1338
|
+
blueprint.cleanup();
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
__name(_BlueprintSystem, "BlueprintSystem");
|
|
1343
|
+
var BlueprintSystem = _BlueprintSystem;
|
|
1344
|
+
BlueprintSystem = _ts_decorate2([
|
|
1345
|
+
ECSSystem("BlueprintSystem"),
|
|
1346
|
+
_ts_metadata("design:type", Function),
|
|
1347
|
+
_ts_metadata("design:paramtypes", [])
|
|
1348
|
+
], BlueprintSystem);
|
|
677
1349
|
|
|
678
1350
|
// src/triggers/TriggerTypes.ts
|
|
679
1351
|
var TriggerTypes = {
|
|
@@ -1488,966 +2160,532 @@ var _TriggerDispatcher = class _TriggerDispatcher {
|
|
|
1488
2160
|
/**
|
|
1489
2161
|
* @zh 取消订阅所有
|
|
1490
2162
|
* @en Unsubscribe from all
|
|
1491
|
-
*/
|
|
1492
|
-
unsubscribeAll(callback) {
|
|
1493
|
-
this._globalSubscribers.delete(callback);
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* @zh 清除所有订阅
|
|
1497
|
-
* @en Clear all subscriptions
|
|
1498
|
-
*/
|
|
1499
|
-
clearSubscriptions() {
|
|
1500
|
-
this._typeSubscribers.clear();
|
|
1501
|
-
this._globalSubscribers.clear();
|
|
1502
|
-
}
|
|
1503
|
-
};
|
|
1504
|
-
__name(_TriggerDispatcher, "TriggerDispatcher");
|
|
1505
|
-
var TriggerDispatcher = _TriggerDispatcher;
|
|
1506
|
-
var _EntityTriggerManager = class _EntityTriggerManager {
|
|
1507
|
-
constructor(dispatcher) {
|
|
1508
|
-
__publicField(this, "_dispatcher");
|
|
1509
|
-
__publicField(this, "_entityTriggers", /* @__PURE__ */ new Map());
|
|
1510
|
-
this._dispatcher = dispatcher ?? new TriggerDispatcher();
|
|
1511
|
-
}
|
|
1512
|
-
get dispatcher() {
|
|
1513
|
-
return this._dispatcher;
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* @zh 为实体注册触发器
|
|
1517
|
-
* @en Register trigger for entity
|
|
1518
|
-
*/
|
|
1519
|
-
registerForEntity(entityId, trigger) {
|
|
1520
|
-
this._dispatcher.registry.register(trigger);
|
|
1521
|
-
if (!this._entityTriggers.has(entityId)) {
|
|
1522
|
-
this._entityTriggers.set(entityId, /* @__PURE__ */ new Set());
|
|
1523
|
-
}
|
|
1524
|
-
this._entityTriggers.get(entityId).add(trigger.id);
|
|
1525
|
-
}
|
|
1526
|
-
/**
|
|
1527
|
-
* @zh 注销实体的触发器
|
|
1528
|
-
* @en Unregister trigger from entity
|
|
1529
|
-
*/
|
|
1530
|
-
unregisterFromEntity(entityId, triggerId) {
|
|
1531
|
-
const entitySet = this._entityTriggers.get(entityId);
|
|
1532
|
-
if (!entitySet) {
|
|
1533
|
-
return false;
|
|
1534
|
-
}
|
|
1535
|
-
if (!entitySet.has(triggerId)) {
|
|
1536
|
-
return false;
|
|
1537
|
-
}
|
|
1538
|
-
entitySet.delete(triggerId);
|
|
1539
|
-
return this._dispatcher.registry.unregister(triggerId);
|
|
1540
|
-
}
|
|
1541
|
-
/**
|
|
1542
|
-
* @zh 获取实体的所有触发器
|
|
1543
|
-
* @en Get all triggers for entity
|
|
1544
|
-
*/
|
|
1545
|
-
getEntityTriggers(entityId) {
|
|
1546
|
-
const entitySet = this._entityTriggers.get(entityId);
|
|
1547
|
-
if (!entitySet) {
|
|
1548
|
-
return [];
|
|
1549
|
-
}
|
|
1550
|
-
const triggers = [];
|
|
1551
|
-
for (const triggerId of entitySet) {
|
|
1552
|
-
const trigger = this._dispatcher.registry.get(triggerId);
|
|
1553
|
-
if (trigger) {
|
|
1554
|
-
triggers.push(trigger);
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
return triggers;
|
|
1558
|
-
}
|
|
1559
|
-
/**
|
|
1560
|
-
* @zh 清除实体的所有触发器
|
|
1561
|
-
* @en Clear all triggers for entity
|
|
1562
|
-
*/
|
|
1563
|
-
clearEntityTriggers(entityId) {
|
|
1564
|
-
const entitySet = this._entityTriggers.get(entityId);
|
|
1565
|
-
if (!entitySet) {
|
|
1566
|
-
return;
|
|
1567
|
-
}
|
|
1568
|
-
for (const triggerId of entitySet) {
|
|
1569
|
-
this._dispatcher.registry.unregister(triggerId);
|
|
1570
|
-
}
|
|
1571
|
-
this._entityTriggers.delete(entityId);
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* @zh 调度触发器到实体
|
|
1575
|
-
* @en Dispatch trigger to entity
|
|
1576
|
-
*/
|
|
1577
|
-
dispatchToEntity(entityId, context) {
|
|
1578
|
-
const entityTriggers = this.getEntityTriggers(entityId);
|
|
1579
|
-
const results = [];
|
|
1580
|
-
let triggeredCount = 0;
|
|
1581
|
-
for (const trigger of entityTriggers) {
|
|
1582
|
-
if (trigger.shouldFire(context)) {
|
|
1583
|
-
try {
|
|
1584
|
-
trigger.fire(context);
|
|
1585
|
-
triggeredCount++;
|
|
1586
|
-
results.push({
|
|
1587
|
-
triggerId: trigger.id,
|
|
1588
|
-
success: true
|
|
1589
|
-
});
|
|
1590
|
-
} catch (error) {
|
|
1591
|
-
results.push({
|
|
1592
|
-
triggerId: trigger.id,
|
|
1593
|
-
success: false,
|
|
1594
|
-
error: error instanceof Error ? error.message : String(error)
|
|
1595
|
-
});
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
return {
|
|
1600
|
-
context,
|
|
1601
|
-
triggeredCount,
|
|
1602
|
-
results
|
|
1603
|
-
};
|
|
1604
|
-
}
|
|
1605
|
-
};
|
|
1606
|
-
__name(_EntityTriggerManager, "EntityTriggerManager");
|
|
1607
|
-
var EntityTriggerManager = _EntityTriggerManager;
|
|
1608
|
-
function createTriggerDispatcher(registry) {
|
|
1609
|
-
return new TriggerDispatcher(registry);
|
|
1610
|
-
}
|
|
1611
|
-
__name(createTriggerDispatcher, "createTriggerDispatcher");
|
|
1612
|
-
function createEntityTriggerManager(dispatcher) {
|
|
1613
|
-
return new EntityTriggerManager(dispatcher);
|
|
1614
|
-
}
|
|
1615
|
-
__name(createEntityTriggerManager, "createEntityTriggerManager");
|
|
1616
|
-
|
|
1617
|
-
// src/composition/BlueprintFragment.ts
|
|
1618
|
-
var _BlueprintFragment = class _BlueprintFragment {
|
|
1619
|
-
constructor(config) {
|
|
1620
|
-
__publicField(this, "id");
|
|
1621
|
-
__publicField(this, "name");
|
|
1622
|
-
__publicField(this, "description");
|
|
1623
|
-
__publicField(this, "category");
|
|
1624
|
-
__publicField(this, "tags");
|
|
1625
|
-
__publicField(this, "inputs");
|
|
1626
|
-
__publicField(this, "outputs");
|
|
1627
|
-
__publicField(this, "graph");
|
|
1628
|
-
__publicField(this, "version");
|
|
1629
|
-
__publicField(this, "icon");
|
|
1630
|
-
__publicField(this, "color");
|
|
1631
|
-
this.id = config.id;
|
|
1632
|
-
this.name = config.name;
|
|
1633
|
-
this.description = config.description;
|
|
1634
|
-
this.category = config.category;
|
|
1635
|
-
this.tags = config.tags;
|
|
1636
|
-
this.inputs = config.inputs ?? [];
|
|
1637
|
-
this.outputs = config.outputs ?? [];
|
|
1638
|
-
this.graph = config.graph;
|
|
1639
|
-
this.version = config.version;
|
|
1640
|
-
this.icon = config.icon;
|
|
1641
|
-
this.color = config.color;
|
|
1642
|
-
}
|
|
1643
|
-
/**
|
|
1644
|
-
* @zh 获取所有暴露引脚
|
|
1645
|
-
* @en Get all exposed pins
|
|
1646
|
-
*/
|
|
1647
|
-
getAllExposedPins() {
|
|
1648
|
-
return [
|
|
1649
|
-
...this.inputs,
|
|
1650
|
-
...this.outputs
|
|
1651
|
-
];
|
|
1652
|
-
}
|
|
1653
|
-
/**
|
|
1654
|
-
* @zh 通过名称查找输入引脚
|
|
1655
|
-
* @en Find input pin by name
|
|
1656
|
-
*/
|
|
1657
|
-
findInput(name) {
|
|
1658
|
-
return this.inputs.find((p) => p.name === name);
|
|
1659
|
-
}
|
|
1660
|
-
/**
|
|
1661
|
-
* @zh 通过名称查找输出引脚
|
|
1662
|
-
* @en Find output pin by name
|
|
1663
|
-
*/
|
|
1664
|
-
findOutput(name) {
|
|
1665
|
-
return this.outputs.find((p) => p.name === name);
|
|
1666
|
-
}
|
|
1667
|
-
};
|
|
1668
|
-
__name(_BlueprintFragment, "BlueprintFragment");
|
|
1669
|
-
var BlueprintFragment = _BlueprintFragment;
|
|
1670
|
-
function createExposedPin(name, type, direction, internalNodeId, internalPinName, options) {
|
|
1671
|
-
return {
|
|
1672
|
-
name,
|
|
1673
|
-
displayName: options?.displayName ?? name,
|
|
1674
|
-
type,
|
|
1675
|
-
direction,
|
|
1676
|
-
description: options?.description,
|
|
1677
|
-
defaultValue: options?.defaultValue,
|
|
1678
|
-
internalNodeId,
|
|
1679
|
-
internalPinName
|
|
1680
|
-
};
|
|
1681
|
-
}
|
|
1682
|
-
__name(createExposedPin, "createExposedPin");
|
|
1683
|
-
function createFragment(config) {
|
|
1684
|
-
return new BlueprintFragment(config);
|
|
1685
|
-
}
|
|
1686
|
-
__name(createFragment, "createFragment");
|
|
1687
|
-
function fragmentFromAsset(asset) {
|
|
1688
|
-
return new BlueprintFragment({
|
|
1689
|
-
...asset.fragment,
|
|
1690
|
-
graph: asset.graph
|
|
1691
|
-
});
|
|
1692
|
-
}
|
|
1693
|
-
__name(fragmentFromAsset, "fragmentFromAsset");
|
|
1694
|
-
function fragmentToAsset(fragment) {
|
|
1695
|
-
return {
|
|
1696
|
-
version: 1,
|
|
1697
|
-
type: "blueprint-fragment",
|
|
1698
|
-
fragment: {
|
|
1699
|
-
id: fragment.id,
|
|
1700
|
-
name: fragment.name,
|
|
1701
|
-
description: fragment.description,
|
|
1702
|
-
category: fragment.category,
|
|
1703
|
-
tags: fragment.tags,
|
|
1704
|
-
inputs: fragment.inputs,
|
|
1705
|
-
outputs: fragment.outputs,
|
|
1706
|
-
version: fragment.version,
|
|
1707
|
-
icon: fragment.icon,
|
|
1708
|
-
color: fragment.color
|
|
1709
|
-
},
|
|
1710
|
-
graph: fragment.graph
|
|
1711
|
-
};
|
|
1712
|
-
}
|
|
1713
|
-
__name(fragmentToAsset, "fragmentToAsset");
|
|
1714
|
-
|
|
1715
|
-
// src/composition/BlueprintComposer.ts
|
|
1716
|
-
var _BlueprintComposer = class _BlueprintComposer {
|
|
1717
|
-
constructor(name) {
|
|
1718
|
-
__publicField(this, "name");
|
|
1719
|
-
__publicField(this, "slots", /* @__PURE__ */ new Map());
|
|
1720
|
-
__publicField(this, "connections", /* @__PURE__ */ new Map());
|
|
1721
|
-
__publicField(this, "connectionIdCounter", 0);
|
|
1722
|
-
this.name = name;
|
|
2163
|
+
*/
|
|
2164
|
+
unsubscribeAll(callback) {
|
|
2165
|
+
this._globalSubscribers.delete(callback);
|
|
1723
2166
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
2167
|
+
/**
|
|
2168
|
+
* @zh 清除所有订阅
|
|
2169
|
+
* @en Clear all subscriptions
|
|
2170
|
+
*/
|
|
2171
|
+
clearSubscriptions() {
|
|
2172
|
+
this._typeSubscribers.clear();
|
|
2173
|
+
this._globalSubscribers.clear();
|
|
1726
2174
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
2175
|
+
};
|
|
2176
|
+
__name(_TriggerDispatcher, "TriggerDispatcher");
|
|
2177
|
+
var TriggerDispatcher = _TriggerDispatcher;
|
|
2178
|
+
var _EntityTriggerManager = class _EntityTriggerManager {
|
|
2179
|
+
constructor(dispatcher) {
|
|
2180
|
+
__publicField(this, "_dispatcher");
|
|
2181
|
+
__publicField(this, "_entityTriggers", /* @__PURE__ */ new Map());
|
|
2182
|
+
this._dispatcher = dispatcher ?? new TriggerDispatcher();
|
|
1729
2183
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
throw new Error(`Slot '${slotId}' already exists`);
|
|
1733
|
-
}
|
|
1734
|
-
const slot = {
|
|
1735
|
-
id: slotId,
|
|
1736
|
-
name: options?.name ?? fragment.name,
|
|
1737
|
-
fragment,
|
|
1738
|
-
position: options?.position ?? {
|
|
1739
|
-
x: 0,
|
|
1740
|
-
y: 0
|
|
1741
|
-
}
|
|
1742
|
-
};
|
|
1743
|
-
this.slots.set(slotId, slot);
|
|
2184
|
+
get dispatcher() {
|
|
2185
|
+
return this._dispatcher;
|
|
1744
2186
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
for (const id of toRemove) {
|
|
1756
|
-
this.connections.delete(id);
|
|
2187
|
+
/**
|
|
2188
|
+
* @zh 为实体注册触发器
|
|
2189
|
+
* @en Register trigger for entity
|
|
2190
|
+
*/
|
|
2191
|
+
registerForEntity(entityId, trigger) {
|
|
2192
|
+
this._dispatcher.registry.register(trigger);
|
|
2193
|
+
if (!this._entityTriggers.has(entityId)) {
|
|
2194
|
+
this._entityTriggers.set(entityId, /* @__PURE__ */ new Set());
|
|
1757
2195
|
}
|
|
1758
|
-
this.
|
|
2196
|
+
this._entityTriggers.get(entityId).add(trigger.id);
|
|
1759
2197
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
2198
|
+
/**
|
|
2199
|
+
* @zh 注销实体的触发器
|
|
2200
|
+
* @en Unregister trigger from entity
|
|
2201
|
+
*/
|
|
2202
|
+
unregisterFromEntity(entityId, triggerId) {
|
|
2203
|
+
const entitySet = this._entityTriggers.get(entityId);
|
|
2204
|
+
if (!entitySet) {
|
|
2205
|
+
return false;
|
|
1765
2206
|
}
|
|
1766
|
-
if (!
|
|
1767
|
-
|
|
2207
|
+
if (!entitySet.has(triggerId)) {
|
|
2208
|
+
return false;
|
|
1768
2209
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
2210
|
+
entitySet.delete(triggerId);
|
|
2211
|
+
return this._dispatcher.registry.unregister(triggerId);
|
|
2212
|
+
}
|
|
2213
|
+
/**
|
|
2214
|
+
* @zh 获取实体的所有触发器
|
|
2215
|
+
* @en Get all triggers for entity
|
|
2216
|
+
*/
|
|
2217
|
+
getEntityTriggers(entityId) {
|
|
2218
|
+
const entitySet = this._entityTriggers.get(entityId);
|
|
2219
|
+
if (!entitySet) {
|
|
2220
|
+
return [];
|
|
1773
2221
|
}
|
|
1774
|
-
|
|
1775
|
-
|
|
2222
|
+
const triggers = [];
|
|
2223
|
+
for (const triggerId of entitySet) {
|
|
2224
|
+
const trigger = this._dispatcher.registry.get(triggerId);
|
|
2225
|
+
if (trigger) {
|
|
2226
|
+
triggers.push(trigger);
|
|
2227
|
+
}
|
|
1776
2228
|
}
|
|
1777
|
-
|
|
1778
|
-
const connection = {
|
|
1779
|
-
id: connectionId,
|
|
1780
|
-
fromSlotId,
|
|
1781
|
-
fromPin,
|
|
1782
|
-
toSlotId,
|
|
1783
|
-
toPin
|
|
1784
|
-
};
|
|
1785
|
-
this.connections.set(connectionId, connection);
|
|
1786
|
-
}
|
|
1787
|
-
disconnect(connectionId) {
|
|
1788
|
-
this.connections.delete(connectionId);
|
|
2229
|
+
return triggers;
|
|
1789
2230
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
type: "unconnected-input",
|
|
1799
|
-
message: `Input '${input.name}' in slot '${slot.id}' is not connected`,
|
|
1800
|
-
slotId: slot.id,
|
|
1801
|
-
pinName: input.name
|
|
1802
|
-
});
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
for (const output of slot.fragment.outputs) {
|
|
1806
|
-
const hasConnection = Array.from(this.connections.values()).some((c) => c.fromSlotId === slot.id && c.fromPin === output.name);
|
|
1807
|
-
if (!hasConnection) {
|
|
1808
|
-
warnings.push({
|
|
1809
|
-
type: "unused-output",
|
|
1810
|
-
message: `Output '${output.name}' in slot '${slot.id}' is not connected`,
|
|
1811
|
-
slotId: slot.id,
|
|
1812
|
-
pinName: output.name
|
|
1813
|
-
});
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
2231
|
+
/**
|
|
2232
|
+
* @zh 清除实体的所有触发器
|
|
2233
|
+
* @en Clear all triggers for entity
|
|
2234
|
+
*/
|
|
2235
|
+
clearEntityTriggers(entityId) {
|
|
2236
|
+
const entitySet = this._entityTriggers.get(entityId);
|
|
2237
|
+
if (!entitySet) {
|
|
2238
|
+
return;
|
|
1816
2239
|
}
|
|
1817
|
-
for (const
|
|
1818
|
-
|
|
1819
|
-
const toSlot = this.slots.get(conn.toSlotId);
|
|
1820
|
-
if (!fromSlot || !toSlot) {
|
|
1821
|
-
errors.push({
|
|
1822
|
-
type: "invalid-slot",
|
|
1823
|
-
message: `Invalid slot reference in connection '${conn.id}'`
|
|
1824
|
-
});
|
|
1825
|
-
continue;
|
|
1826
|
-
}
|
|
1827
|
-
const fromPinDef = fromSlot.fragment.outputs.find((p) => p.name === conn.fromPin);
|
|
1828
|
-
const toPinDef = toSlot.fragment.inputs.find((p) => p.name === conn.toPin);
|
|
1829
|
-
if (fromPinDef && toPinDef && fromPinDef.type !== toPinDef.type) {
|
|
1830
|
-
if (fromPinDef.type !== "any" && toPinDef.type !== "any") {
|
|
1831
|
-
errors.push({
|
|
1832
|
-
type: "type-mismatch",
|
|
1833
|
-
message: `Type mismatch: '${fromPinDef.type}' -> '${toPinDef.type}' in connection '${conn.id}'`
|
|
1834
|
-
});
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
2240
|
+
for (const triggerId of entitySet) {
|
|
2241
|
+
this._dispatcher.registry.unregister(triggerId);
|
|
1837
2242
|
}
|
|
1838
|
-
|
|
1839
|
-
isValid: errors.length === 0,
|
|
1840
|
-
errors,
|
|
1841
|
-
warnings
|
|
1842
|
-
};
|
|
2243
|
+
this._entityTriggers.delete(entityId);
|
|
1843
2244
|
}
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
x: node.position.x + slot.position.x,
|
|
1861
|
-
y: node.position.y + slot.position.y
|
|
1862
|
-
}
|
|
1863
|
-
});
|
|
1864
|
-
}
|
|
1865
|
-
for (const conn of slot.fragment.graph.connections) {
|
|
1866
|
-
const newFromId = slotNodeMap.get(conn.fromNodeId);
|
|
1867
|
-
const newToId = slotNodeMap.get(conn.toNodeId);
|
|
1868
|
-
if (newFromId && newToId) {
|
|
1869
|
-
connections.push({
|
|
1870
|
-
...conn,
|
|
1871
|
-
id: `conn_internal_${connections.length}`,
|
|
1872
|
-
fromNodeId: newFromId,
|
|
1873
|
-
toNodeId: newToId
|
|
2245
|
+
/**
|
|
2246
|
+
* @zh 调度触发器到实体
|
|
2247
|
+
* @en Dispatch trigger to entity
|
|
2248
|
+
*/
|
|
2249
|
+
dispatchToEntity(entityId, context) {
|
|
2250
|
+
const entityTriggers = this.getEntityTriggers(entityId);
|
|
2251
|
+
const results = [];
|
|
2252
|
+
let triggeredCount = 0;
|
|
2253
|
+
for (const trigger of entityTriggers) {
|
|
2254
|
+
if (trigger.shouldFire(context)) {
|
|
2255
|
+
try {
|
|
2256
|
+
trigger.fire(context);
|
|
2257
|
+
triggeredCount++;
|
|
2258
|
+
results.push({
|
|
2259
|
+
triggerId: trigger.id,
|
|
2260
|
+
success: true
|
|
1874
2261
|
});
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
for (const slotConn of this.connections.values()) {
|
|
1885
|
-
const fromSlot = this.slots.get(slotConn.fromSlotId);
|
|
1886
|
-
const toSlot = this.slots.get(slotConn.toSlotId);
|
|
1887
|
-
if (!fromSlot || !toSlot) continue;
|
|
1888
|
-
const fromPinDef = fromSlot.fragment.outputs.find((p) => p.name === slotConn.fromPin);
|
|
1889
|
-
const toPinDef = toSlot.fragment.inputs.find((p) => p.name === slotConn.toPin);
|
|
1890
|
-
if (!fromPinDef || !toPinDef) continue;
|
|
1891
|
-
const fromNodeMap = nodeIdMap.get(slotConn.fromSlotId);
|
|
1892
|
-
const toNodeMap = nodeIdMap.get(slotConn.toSlotId);
|
|
1893
|
-
if (!fromNodeMap || !toNodeMap) continue;
|
|
1894
|
-
const fromNodeId = fromNodeMap.get(fromPinDef.internalNodeId);
|
|
1895
|
-
const toNodeId = toNodeMap.get(toPinDef.internalNodeId);
|
|
1896
|
-
if (fromNodeId && toNodeId) {
|
|
1897
|
-
connections.push({
|
|
1898
|
-
id: `conn_slot_${connections.length}`,
|
|
1899
|
-
fromNodeId,
|
|
1900
|
-
fromPin: fromPinDef.internalPinName,
|
|
1901
|
-
toNodeId,
|
|
1902
|
-
toPin: toPinDef.internalPinName
|
|
1903
|
-
});
|
|
2262
|
+
} catch (error) {
|
|
2263
|
+
results.push({
|
|
2264
|
+
triggerId: trigger.id,
|
|
2265
|
+
success: false,
|
|
2266
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
1904
2269
|
}
|
|
1905
2270
|
}
|
|
1906
2271
|
return {
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
name: this.name,
|
|
1911
|
-
description: `Composed from ${this.slots.size} fragments`,
|
|
1912
|
-
createdAt: Date.now(),
|
|
1913
|
-
modifiedAt: Date.now()
|
|
1914
|
-
},
|
|
1915
|
-
variables,
|
|
1916
|
-
nodes,
|
|
1917
|
-
connections
|
|
2272
|
+
context,
|
|
2273
|
+
triggeredCount,
|
|
2274
|
+
results
|
|
1918
2275
|
};
|
|
1919
2276
|
}
|
|
1920
|
-
clear() {
|
|
1921
|
-
this.slots.clear();
|
|
1922
|
-
this.connections.clear();
|
|
1923
|
-
this.connectionIdCounter = 0;
|
|
1924
|
-
}
|
|
1925
2277
|
};
|
|
1926
|
-
__name(
|
|
1927
|
-
var
|
|
1928
|
-
function
|
|
1929
|
-
return new
|
|
2278
|
+
__name(_EntityTriggerManager, "EntityTriggerManager");
|
|
2279
|
+
var EntityTriggerManager = _EntityTriggerManager;
|
|
2280
|
+
function createTriggerDispatcher(registry) {
|
|
2281
|
+
return new TriggerDispatcher(registry);
|
|
1930
2282
|
}
|
|
1931
|
-
__name(
|
|
2283
|
+
__name(createTriggerDispatcher, "createTriggerDispatcher");
|
|
2284
|
+
function createEntityTriggerManager(dispatcher) {
|
|
2285
|
+
return new EntityTriggerManager(dispatcher);
|
|
2286
|
+
}
|
|
2287
|
+
__name(createEntityTriggerManager, "createEntityTriggerManager");
|
|
1932
2288
|
|
|
1933
|
-
// src/composition/
|
|
1934
|
-
var
|
|
1935
|
-
constructor() {
|
|
1936
|
-
__publicField(this, "
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
this
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
this
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
if (filter.category) {
|
|
1959
|
-
results = results.filter((f) => f.category === filter.category);
|
|
1960
|
-
}
|
|
1961
|
-
if (filter.tags && filter.tags.length > 0) {
|
|
1962
|
-
results = results.filter((f) => f.tags && filter.tags.some((t) => f.tags.includes(t)));
|
|
1963
|
-
}
|
|
1964
|
-
if (filter.search) {
|
|
1965
|
-
const searchLower = filter.search.toLowerCase();
|
|
1966
|
-
results = results.filter((f) => f.name.toLowerCase().includes(searchLower) || f.description?.toLowerCase().includes(searchLower));
|
|
1967
|
-
}
|
|
1968
|
-
return results;
|
|
1969
|
-
}
|
|
1970
|
-
getCategories() {
|
|
1971
|
-
const categories = /* @__PURE__ */ new Set();
|
|
1972
|
-
for (const fragment of this.fragments.values()) {
|
|
1973
|
-
if (fragment.category) {
|
|
1974
|
-
categories.add(fragment.category);
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
return Array.from(categories).sort();
|
|
2289
|
+
// src/composition/BlueprintFragment.ts
|
|
2290
|
+
var _BlueprintFragment = class _BlueprintFragment {
|
|
2291
|
+
constructor(config) {
|
|
2292
|
+
__publicField(this, "id");
|
|
2293
|
+
__publicField(this, "name");
|
|
2294
|
+
__publicField(this, "description");
|
|
2295
|
+
__publicField(this, "category");
|
|
2296
|
+
__publicField(this, "tags");
|
|
2297
|
+
__publicField(this, "inputs");
|
|
2298
|
+
__publicField(this, "outputs");
|
|
2299
|
+
__publicField(this, "graph");
|
|
2300
|
+
__publicField(this, "version");
|
|
2301
|
+
__publicField(this, "icon");
|
|
2302
|
+
__publicField(this, "color");
|
|
2303
|
+
this.id = config.id;
|
|
2304
|
+
this.name = config.name;
|
|
2305
|
+
this.description = config.description;
|
|
2306
|
+
this.category = config.category;
|
|
2307
|
+
this.tags = config.tags;
|
|
2308
|
+
this.inputs = config.inputs ?? [];
|
|
2309
|
+
this.outputs = config.outputs ?? [];
|
|
2310
|
+
this.graph = config.graph;
|
|
2311
|
+
this.version = config.version;
|
|
2312
|
+
this.icon = config.icon;
|
|
2313
|
+
this.color = config.color;
|
|
1978
2314
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
return Array.from(tags).sort();
|
|
2315
|
+
/**
|
|
2316
|
+
* @zh 获取所有暴露引脚
|
|
2317
|
+
* @en Get all exposed pins
|
|
2318
|
+
*/
|
|
2319
|
+
getAllExposedPins() {
|
|
2320
|
+
return [
|
|
2321
|
+
...this.inputs,
|
|
2322
|
+
...this.outputs
|
|
2323
|
+
];
|
|
1989
2324
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
2325
|
+
/**
|
|
2326
|
+
* @zh 通过名称查找输入引脚
|
|
2327
|
+
* @en Find input pin by name
|
|
2328
|
+
*/
|
|
2329
|
+
findInput(name) {
|
|
2330
|
+
return this.inputs.find((p) => p.name === name);
|
|
1992
2331
|
}
|
|
1993
2332
|
/**
|
|
1994
|
-
* @zh
|
|
1995
|
-
* @en
|
|
2333
|
+
* @zh 通过名称查找输出引脚
|
|
2334
|
+
* @en Find output pin by name
|
|
1996
2335
|
*/
|
|
1997
|
-
|
|
1998
|
-
return this.
|
|
2336
|
+
findOutput(name) {
|
|
2337
|
+
return this.outputs.find((p) => p.name === name);
|
|
1999
2338
|
}
|
|
2000
2339
|
};
|
|
2001
|
-
__name(
|
|
2002
|
-
var
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
}
|
|
2014
|
-
__name(getRegisteredBlueprintComponents, "getRegisteredBlueprintComponents");
|
|
2015
|
-
function getBlueprintMetadata(componentClass) {
|
|
2016
|
-
return registeredComponents.get(componentClass);
|
|
2017
|
-
}
|
|
2018
|
-
__name(getBlueprintMetadata, "getBlueprintMetadata");
|
|
2019
|
-
function clearRegisteredComponents() {
|
|
2020
|
-
registeredComponents.clear();
|
|
2021
|
-
}
|
|
2022
|
-
__name(clearRegisteredComponents, "clearRegisteredComponents");
|
|
2023
|
-
function getOrCreateMetadata(constructor) {
|
|
2024
|
-
let metadata = registeredComponents.get(constructor);
|
|
2025
|
-
if (!metadata) {
|
|
2026
|
-
metadata = {
|
|
2027
|
-
componentName: constructor.__componentName__ ?? constructor.name,
|
|
2028
|
-
properties: [],
|
|
2029
|
-
methods: []
|
|
2030
|
-
};
|
|
2031
|
-
registeredComponents.set(constructor, metadata);
|
|
2032
|
-
}
|
|
2033
|
-
return metadata;
|
|
2034
|
-
}
|
|
2035
|
-
__name(getOrCreateMetadata, "getOrCreateMetadata");
|
|
2036
|
-
function BlueprintExpose(options = {}) {
|
|
2037
|
-
return function(target) {
|
|
2038
|
-
const metadata = getOrCreateMetadata(target);
|
|
2039
|
-
Object.assign(metadata, options);
|
|
2040
|
-
metadata.componentName = target.__componentName__ ?? target.name;
|
|
2041
|
-
return target;
|
|
2042
|
-
};
|
|
2043
|
-
}
|
|
2044
|
-
__name(BlueprintExpose, "BlueprintExpose");
|
|
2045
|
-
function BlueprintProperty(options = {}) {
|
|
2046
|
-
return function(target, propertyKey) {
|
|
2047
|
-
const key = String(propertyKey);
|
|
2048
|
-
const metadata = getOrCreateMetadata(target.constructor);
|
|
2049
|
-
const propMeta = {
|
|
2050
|
-
propertyKey: key,
|
|
2051
|
-
displayName: options.displayName ?? key,
|
|
2052
|
-
description: options.description,
|
|
2053
|
-
pinType: options.type ?? "any",
|
|
2054
|
-
readonly: options.readonly ?? false,
|
|
2055
|
-
defaultValue: options.defaultValue
|
|
2056
|
-
};
|
|
2057
|
-
const existingIndex = metadata.properties.findIndex((p) => p.propertyKey === key);
|
|
2058
|
-
if (existingIndex >= 0) {
|
|
2059
|
-
metadata.properties[existingIndex] = propMeta;
|
|
2060
|
-
} else {
|
|
2061
|
-
metadata.properties.push(propMeta);
|
|
2062
|
-
}
|
|
2063
|
-
};
|
|
2064
|
-
}
|
|
2065
|
-
__name(BlueprintProperty, "BlueprintProperty");
|
|
2066
|
-
function BlueprintMethod(options = {}) {
|
|
2067
|
-
return function(target, propertyKey, descriptor) {
|
|
2068
|
-
const key = String(propertyKey);
|
|
2069
|
-
const metadata = getOrCreateMetadata(target.constructor);
|
|
2070
|
-
const methodMeta = {
|
|
2071
|
-
methodKey: key,
|
|
2072
|
-
displayName: options.displayName ?? key,
|
|
2073
|
-
description: options.description,
|
|
2074
|
-
isPure: options.isPure ?? false,
|
|
2075
|
-
params: options.params ?? [],
|
|
2076
|
-
returnType: options.returnType ?? "any"
|
|
2077
|
-
};
|
|
2078
|
-
const existingIndex = metadata.methods.findIndex((m) => m.methodKey === key);
|
|
2079
|
-
if (existingIndex >= 0) {
|
|
2080
|
-
metadata.methods[existingIndex] = methodMeta;
|
|
2081
|
-
} else {
|
|
2082
|
-
metadata.methods.push(methodMeta);
|
|
2083
|
-
}
|
|
2084
|
-
return descriptor;
|
|
2340
|
+
__name(_BlueprintFragment, "BlueprintFragment");
|
|
2341
|
+
var BlueprintFragment = _BlueprintFragment;
|
|
2342
|
+
function createExposedPin(name, type, direction, internalNodeId, internalPinName, options) {
|
|
2343
|
+
return {
|
|
2344
|
+
name,
|
|
2345
|
+
displayName: options?.displayName ?? name,
|
|
2346
|
+
type,
|
|
2347
|
+
direction,
|
|
2348
|
+
description: options?.description,
|
|
2349
|
+
defaultValue: options?.defaultValue,
|
|
2350
|
+
internalNodeId,
|
|
2351
|
+
internalPinName
|
|
2085
2352
|
};
|
|
2086
2353
|
}
|
|
2087
|
-
__name(
|
|
2088
|
-
function
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2354
|
+
__name(createExposedPin, "createExposedPin");
|
|
2355
|
+
function createFragment(config) {
|
|
2356
|
+
return new BlueprintFragment(config);
|
|
2357
|
+
}
|
|
2358
|
+
__name(createFragment, "createFragment");
|
|
2359
|
+
function fragmentFromAsset(asset) {
|
|
2360
|
+
return new BlueprintFragment({
|
|
2361
|
+
...asset.fragment,
|
|
2362
|
+
graph: asset.graph
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
__name(fragmentFromAsset, "fragmentFromAsset");
|
|
2366
|
+
function fragmentToAsset(fragment) {
|
|
2367
|
+
return {
|
|
2368
|
+
version: 1,
|
|
2369
|
+
type: "blueprint-fragment",
|
|
2370
|
+
fragment: {
|
|
2371
|
+
id: fragment.id,
|
|
2372
|
+
name: fragment.name,
|
|
2373
|
+
description: fragment.description,
|
|
2374
|
+
category: fragment.category,
|
|
2375
|
+
tags: fragment.tags,
|
|
2376
|
+
inputs: fragment.inputs,
|
|
2377
|
+
outputs: fragment.outputs,
|
|
2378
|
+
version: fragment.version,
|
|
2379
|
+
icon: fragment.icon,
|
|
2380
|
+
color: fragment.color
|
|
2381
|
+
},
|
|
2382
|
+
graph: fragment.graph
|
|
2107
2383
|
};
|
|
2108
|
-
return typeMap[typeName] ?? "any";
|
|
2109
2384
|
}
|
|
2110
|
-
__name(
|
|
2385
|
+
__name(fragmentToAsset, "fragmentToAsset");
|
|
2111
2386
|
|
|
2112
|
-
// src/
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
if (!prop.readonly) {
|
|
2121
|
-
generatePropertySetNode(componentName, prop, category, color);
|
|
2122
|
-
}
|
|
2387
|
+
// src/composition/BlueprintComposer.ts
|
|
2388
|
+
var _BlueprintComposer = class _BlueprintComposer {
|
|
2389
|
+
constructor(name) {
|
|
2390
|
+
__publicField(this, "name");
|
|
2391
|
+
__publicField(this, "slots", /* @__PURE__ */ new Map());
|
|
2392
|
+
__publicField(this, "connections", /* @__PURE__ */ new Map());
|
|
2393
|
+
__publicField(this, "connectionIdCounter", 0);
|
|
2394
|
+
this.name = name;
|
|
2123
2395
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2396
|
+
getSlots() {
|
|
2397
|
+
return Array.from(this.slots.values());
|
|
2126
2398
|
}
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
"component",
|
|
2142
|
-
componentName.toLowerCase()
|
|
2143
|
-
],
|
|
2144
|
-
menuPath: [
|
|
2145
|
-
"Components",
|
|
2146
|
-
displayName,
|
|
2147
|
-
`Get ${displayName}`
|
|
2148
|
-
],
|
|
2149
|
-
inputs: [
|
|
2150
|
-
{
|
|
2151
|
-
name: "entity",
|
|
2152
|
-
type: "entity",
|
|
2153
|
-
displayName: "Entity"
|
|
2399
|
+
getConnections() {
|
|
2400
|
+
return Array.from(this.connections.values());
|
|
2401
|
+
}
|
|
2402
|
+
addFragment(fragment, slotId, options) {
|
|
2403
|
+
if (this.slots.has(slotId)) {
|
|
2404
|
+
throw new Error(`Slot '${slotId}' already exists`);
|
|
2405
|
+
}
|
|
2406
|
+
const slot = {
|
|
2407
|
+
id: slotId,
|
|
2408
|
+
name: options?.name ?? fragment.name,
|
|
2409
|
+
fragment,
|
|
2410
|
+
position: options?.position ?? {
|
|
2411
|
+
x: 0,
|
|
2412
|
+
y: 0
|
|
2154
2413
|
}
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2414
|
+
};
|
|
2415
|
+
this.slots.set(slotId, slot);
|
|
2416
|
+
}
|
|
2417
|
+
removeSlot(slotId) {
|
|
2418
|
+
if (!this.slots.has(slotId)) {
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
const toRemove = [];
|
|
2422
|
+
for (const [id, conn] of this.connections) {
|
|
2423
|
+
if (conn.fromSlotId === slotId || conn.toSlotId === slotId) {
|
|
2424
|
+
toRemove.push(id);
|
|
2166
2425
|
}
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2426
|
+
}
|
|
2427
|
+
for (const id of toRemove) {
|
|
2428
|
+
this.connections.delete(id);
|
|
2429
|
+
}
|
|
2430
|
+
this.slots.delete(slotId);
|
|
2431
|
+
}
|
|
2432
|
+
connect(fromSlotId, fromPin, toSlotId, toPin) {
|
|
2433
|
+
const fromSlot = this.slots.get(fromSlotId);
|
|
2434
|
+
const toSlot = this.slots.get(toSlotId);
|
|
2435
|
+
if (!fromSlot) {
|
|
2436
|
+
throw new Error(`Source slot '${fromSlotId}' not found`);
|
|
2437
|
+
}
|
|
2438
|
+
if (!toSlot) {
|
|
2439
|
+
throw new Error(`Target slot '${toSlotId}' not found`);
|
|
2440
|
+
}
|
|
2441
|
+
const fromPinDef = fromSlot.fragment.outputs.find((p) => p.name === fromPin);
|
|
2442
|
+
const toPinDef = toSlot.fragment.inputs.find((p) => p.name === toPin);
|
|
2443
|
+
if (!fromPinDef) {
|
|
2444
|
+
throw new Error(`Output pin '${fromPin}' not found in slot '${fromSlotId}'`);
|
|
2445
|
+
}
|
|
2446
|
+
if (!toPinDef) {
|
|
2447
|
+
throw new Error(`Input pin '${toPin}' not found in slot '${toSlotId}'`);
|
|
2448
|
+
}
|
|
2449
|
+
const connectionId = `conn_${++this.connectionIdCounter}`;
|
|
2450
|
+
const connection = {
|
|
2451
|
+
id: connectionId,
|
|
2452
|
+
fromSlotId,
|
|
2453
|
+
fromPin,
|
|
2454
|
+
toSlotId,
|
|
2455
|
+
toPin
|
|
2456
|
+
};
|
|
2457
|
+
this.connections.set(connectionId, connection);
|
|
2458
|
+
}
|
|
2459
|
+
disconnect(connectionId) {
|
|
2460
|
+
this.connections.delete(connectionId);
|
|
2461
|
+
}
|
|
2462
|
+
validate() {
|
|
2463
|
+
const errors = [];
|
|
2464
|
+
const warnings = [];
|
|
2465
|
+
for (const slot of this.slots.values()) {
|
|
2466
|
+
for (const input of slot.fragment.inputs) {
|
|
2467
|
+
const hasConnection = Array.from(this.connections.values()).some((c) => c.toSlotId === slot.id && c.toPin === input.name);
|
|
2468
|
+
if (!hasConnection && input.defaultValue === void 0) {
|
|
2469
|
+
warnings.push({
|
|
2470
|
+
type: "unconnected-input",
|
|
2471
|
+
message: `Input '${input.name}' in slot '${slot.id}' is not connected`,
|
|
2472
|
+
slotId: slot.id,
|
|
2473
|
+
pinName: input.name
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2179
2476
|
}
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2477
|
+
for (const output of slot.fragment.outputs) {
|
|
2478
|
+
const hasConnection = Array.from(this.connections.values()).some((c) => c.fromSlotId === slot.id && c.fromPin === output.name);
|
|
2479
|
+
if (!hasConnection) {
|
|
2480
|
+
warnings.push({
|
|
2481
|
+
type: "unused-output",
|
|
2482
|
+
message: `Output '${output.name}' in slot '${slot.id}' is not connected`,
|
|
2483
|
+
slotId: slot.id,
|
|
2484
|
+
pinName: output.name
|
|
2485
|
+
});
|
|
2185
2486
|
}
|
|
2186
|
-
};
|
|
2187
|
-
}
|
|
2188
|
-
};
|
|
2189
|
-
NodeRegistry.instance.register(template, executor);
|
|
2190
|
-
}
|
|
2191
|
-
__name(generateGetComponentNode, "generateGetComponentNode");
|
|
2192
|
-
function generatePropertyGetNode(componentName, prop, category, color) {
|
|
2193
|
-
const nodeType = `Get_${componentName}_${prop.propertyKey}`;
|
|
2194
|
-
const { displayName, pinType } = prop;
|
|
2195
|
-
const template = {
|
|
2196
|
-
type: nodeType,
|
|
2197
|
-
title: `Get ${displayName}`,
|
|
2198
|
-
subtitle: componentName,
|
|
2199
|
-
category,
|
|
2200
|
-
color,
|
|
2201
|
-
isPure: true,
|
|
2202
|
-
description: prop.description ?? `Gets ${displayName} from ${componentName} (\u4ECE ${componentName} \u83B7\u53D6 ${displayName})`,
|
|
2203
|
-
keywords: [
|
|
2204
|
-
"get",
|
|
2205
|
-
"property",
|
|
2206
|
-
componentName.toLowerCase(),
|
|
2207
|
-
prop.propertyKey.toLowerCase()
|
|
2208
|
-
],
|
|
2209
|
-
menuPath: [
|
|
2210
|
-
"Components",
|
|
2211
|
-
componentName,
|
|
2212
|
-
`Get ${displayName}`
|
|
2213
|
-
],
|
|
2214
|
-
inputs: [
|
|
2215
|
-
{
|
|
2216
|
-
name: "component",
|
|
2217
|
-
type: "component",
|
|
2218
|
-
displayName: componentName
|
|
2219
2487
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2488
|
+
}
|
|
2489
|
+
for (const conn of this.connections.values()) {
|
|
2490
|
+
const fromSlot = this.slots.get(conn.fromSlotId);
|
|
2491
|
+
const toSlot = this.slots.get(conn.toSlotId);
|
|
2492
|
+
if (!fromSlot || !toSlot) {
|
|
2493
|
+
errors.push({
|
|
2494
|
+
type: "invalid-slot",
|
|
2495
|
+
message: `Invalid slot reference in connection '${conn.id}'`
|
|
2496
|
+
});
|
|
2497
|
+
continue;
|
|
2226
2498
|
}
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2499
|
+
const fromPinDef = fromSlot.fragment.outputs.find((p) => p.name === conn.fromPin);
|
|
2500
|
+
const toPinDef = toSlot.fragment.inputs.find((p) => p.name === conn.toPin);
|
|
2501
|
+
if (fromPinDef && toPinDef && fromPinDef.type !== toPinDef.type) {
|
|
2502
|
+
if (fromPinDef.type !== "any" && toPinDef.type !== "any") {
|
|
2503
|
+
errors.push({
|
|
2504
|
+
type: "type-mismatch",
|
|
2505
|
+
message: `Type mismatch: '${fromPinDef.type}' -> '${toPinDef.type}' in connection '${conn.id}'`
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return {
|
|
2511
|
+
isValid: errors.length === 0,
|
|
2512
|
+
errors,
|
|
2513
|
+
warnings
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
compile() {
|
|
2517
|
+
const nodes = [];
|
|
2518
|
+
const connections = [];
|
|
2519
|
+
const variables = [];
|
|
2520
|
+
const nodeIdMap = /* @__PURE__ */ new Map();
|
|
2521
|
+
let nodeIdCounter = 0;
|
|
2522
|
+
for (const slot of this.slots.values()) {
|
|
2523
|
+
const slotNodeMap = /* @__PURE__ */ new Map();
|
|
2524
|
+
nodeIdMap.set(slot.id, slotNodeMap);
|
|
2525
|
+
for (const node of slot.fragment.graph.nodes) {
|
|
2526
|
+
const newNodeId = `node_${++nodeIdCounter}`;
|
|
2527
|
+
slotNodeMap.set(node.id, newNodeId);
|
|
2528
|
+
nodes.push({
|
|
2529
|
+
...node,
|
|
2530
|
+
id: newNodeId,
|
|
2531
|
+
position: {
|
|
2532
|
+
x: node.position.x + slot.position.x,
|
|
2533
|
+
y: node.position.y + slot.position.y
|
|
2238
2534
|
}
|
|
2239
|
-
};
|
|
2535
|
+
});
|
|
2240
2536
|
}
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2537
|
+
for (const conn of slot.fragment.graph.connections) {
|
|
2538
|
+
const newFromId = slotNodeMap.get(conn.fromNodeId);
|
|
2539
|
+
const newToId = slotNodeMap.get(conn.toNodeId);
|
|
2540
|
+
if (newFromId && newToId) {
|
|
2541
|
+
connections.push({
|
|
2542
|
+
...conn,
|
|
2543
|
+
id: `conn_internal_${connections.length}`,
|
|
2544
|
+
fromNodeId: newFromId,
|
|
2545
|
+
toNodeId: newToId
|
|
2546
|
+
});
|
|
2245
2547
|
}
|
|
2246
|
-
};
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
NodeRegistry.instance.register(template, executor);
|
|
2250
|
-
}
|
|
2251
|
-
__name(generatePropertyGetNode, "generatePropertyGetNode");
|
|
2252
|
-
function generatePropertySetNode(componentName, prop, category, color) {
|
|
2253
|
-
const nodeType = `Set_${componentName}_${prop.propertyKey}`;
|
|
2254
|
-
const { displayName, pinType, defaultValue } = prop;
|
|
2255
|
-
const template = {
|
|
2256
|
-
type: nodeType,
|
|
2257
|
-
title: `Set ${displayName}`,
|
|
2258
|
-
subtitle: componentName,
|
|
2259
|
-
category,
|
|
2260
|
-
color,
|
|
2261
|
-
description: prop.description ?? `Sets ${displayName} on ${componentName} (\u8BBE\u7F6E ${componentName} \u7684 ${displayName})`,
|
|
2262
|
-
keywords: [
|
|
2263
|
-
"set",
|
|
2264
|
-
"property",
|
|
2265
|
-
componentName.toLowerCase(),
|
|
2266
|
-
prop.propertyKey.toLowerCase()
|
|
2267
|
-
],
|
|
2268
|
-
menuPath: [
|
|
2269
|
-
"Components",
|
|
2270
|
-
componentName,
|
|
2271
|
-
`Set ${displayName}`
|
|
2272
|
-
],
|
|
2273
|
-
inputs: [
|
|
2274
|
-
{
|
|
2275
|
-
name: "exec",
|
|
2276
|
-
type: "exec",
|
|
2277
|
-
displayName: ""
|
|
2278
|
-
},
|
|
2279
|
-
{
|
|
2280
|
-
name: "component",
|
|
2281
|
-
type: "component",
|
|
2282
|
-
displayName: componentName
|
|
2283
|
-
},
|
|
2284
|
-
{
|
|
2285
|
-
name: "value",
|
|
2286
|
-
type: pinType,
|
|
2287
|
-
displayName,
|
|
2288
|
-
defaultValue
|
|
2289
2548
|
}
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
displayName: ""
|
|
2549
|
+
for (const variable of slot.fragment.graph.variables) {
|
|
2550
|
+
variables.push({
|
|
2551
|
+
...variable,
|
|
2552
|
+
name: `${slot.id}_${variable.name}`
|
|
2553
|
+
});
|
|
2296
2554
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
const
|
|
2303
|
-
const
|
|
2304
|
-
if (
|
|
2305
|
-
|
|
2555
|
+
}
|
|
2556
|
+
for (const slotConn of this.connections.values()) {
|
|
2557
|
+
const fromSlot = this.slots.get(slotConn.fromSlotId);
|
|
2558
|
+
const toSlot = this.slots.get(slotConn.toSlotId);
|
|
2559
|
+
if (!fromSlot || !toSlot) continue;
|
|
2560
|
+
const fromPinDef = fromSlot.fragment.outputs.find((p) => p.name === slotConn.fromPin);
|
|
2561
|
+
const toPinDef = toSlot.fragment.inputs.find((p) => p.name === slotConn.toPin);
|
|
2562
|
+
if (!fromPinDef || !toPinDef) continue;
|
|
2563
|
+
const fromNodeMap = nodeIdMap.get(slotConn.fromSlotId);
|
|
2564
|
+
const toNodeMap = nodeIdMap.get(slotConn.toSlotId);
|
|
2565
|
+
if (!fromNodeMap || !toNodeMap) continue;
|
|
2566
|
+
const fromNodeId = fromNodeMap.get(fromPinDef.internalNodeId);
|
|
2567
|
+
const toNodeId = toNodeMap.get(toPinDef.internalNodeId);
|
|
2568
|
+
if (fromNodeId && toNodeId) {
|
|
2569
|
+
connections.push({
|
|
2570
|
+
id: `conn_slot_${connections.length}`,
|
|
2571
|
+
fromNodeId,
|
|
2572
|
+
fromPin: fromPinDef.internalPinName,
|
|
2573
|
+
toNodeId,
|
|
2574
|
+
toPin: toPinDef.internalPinName
|
|
2575
|
+
});
|
|
2306
2576
|
}
|
|
2307
|
-
return {
|
|
2308
|
-
nextExec: "exec"
|
|
2309
|
-
};
|
|
2310
2577
|
}
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
});
|
|
2578
|
+
return {
|
|
2579
|
+
version: 1,
|
|
2580
|
+
type: "blueprint",
|
|
2581
|
+
metadata: {
|
|
2582
|
+
name: this.name,
|
|
2583
|
+
description: `Composed from ${this.slots.size} fragments`,
|
|
2584
|
+
createdAt: Date.now(),
|
|
2585
|
+
modifiedAt: Date.now()
|
|
2586
|
+
},
|
|
2587
|
+
variables,
|
|
2588
|
+
nodes,
|
|
2589
|
+
connections
|
|
2590
|
+
};
|
|
2325
2591
|
}
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
});
|
|
2331
|
-
const paramNames = [];
|
|
2332
|
-
for (const param of params) {
|
|
2333
|
-
inputs.push({
|
|
2334
|
-
name: param.name,
|
|
2335
|
-
type: param.type ?? "any",
|
|
2336
|
-
displayName: param.displayName ?? param.name,
|
|
2337
|
-
defaultValue: param.defaultValue
|
|
2338
|
-
});
|
|
2339
|
-
paramNames.push(param.name);
|
|
2592
|
+
clear() {
|
|
2593
|
+
this.slots.clear();
|
|
2594
|
+
this.connections.clear();
|
|
2595
|
+
this.connectionIdCounter = 0;
|
|
2340
2596
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2597
|
+
};
|
|
2598
|
+
__name(_BlueprintComposer, "BlueprintComposer");
|
|
2599
|
+
var BlueprintComposer = _BlueprintComposer;
|
|
2600
|
+
function createComposer(name) {
|
|
2601
|
+
return new BlueprintComposer(name);
|
|
2602
|
+
}
|
|
2603
|
+
__name(createComposer, "createComposer");
|
|
2604
|
+
|
|
2605
|
+
// src/composition/FragmentRegistry.ts
|
|
2606
|
+
var _FragmentRegistry = class _FragmentRegistry {
|
|
2607
|
+
constructor() {
|
|
2608
|
+
__publicField(this, "fragments", /* @__PURE__ */ new Map());
|
|
2348
2609
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
});
|
|
2610
|
+
register(fragment) {
|
|
2611
|
+
if (this.fragments.has(fragment.id)) {
|
|
2612
|
+
console.warn(`Fragment '${fragment.id}' already registered, overwriting`);
|
|
2613
|
+
}
|
|
2614
|
+
this.fragments.set(fragment.id, fragment);
|
|
2355
2615
|
}
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
} : {
|
|
2388
|
-
nextExec: "exec"
|
|
2389
|
-
};
|
|
2390
|
-
}
|
|
2391
|
-
const args = paramNames.map((name) => context.evaluateInput(node.id, name, void 0));
|
|
2392
|
-
const fn = component[methodKey];
|
|
2393
|
-
if (typeof fn !== "function") {
|
|
2394
|
-
console.warn(`Method ${methodKey} not found on component ${componentName}`);
|
|
2395
|
-
return isPure ? {
|
|
2396
|
-
outputs: {
|
|
2397
|
-
result: null
|
|
2398
|
-
}
|
|
2399
|
-
} : {
|
|
2400
|
-
nextExec: "exec"
|
|
2401
|
-
};
|
|
2616
|
+
unregister(id) {
|
|
2617
|
+
this.fragments.delete(id);
|
|
2618
|
+
}
|
|
2619
|
+
get(id) {
|
|
2620
|
+
return this.fragments.get(id);
|
|
2621
|
+
}
|
|
2622
|
+
has(id) {
|
|
2623
|
+
return this.fragments.has(id);
|
|
2624
|
+
}
|
|
2625
|
+
getAll() {
|
|
2626
|
+
return Array.from(this.fragments.values());
|
|
2627
|
+
}
|
|
2628
|
+
filter(filter) {
|
|
2629
|
+
let results = this.getAll();
|
|
2630
|
+
if (filter.category) {
|
|
2631
|
+
results = results.filter((f) => f.category === filter.category);
|
|
2632
|
+
}
|
|
2633
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
2634
|
+
results = results.filter((f) => f.tags && filter.tags.some((t) => f.tags.includes(t)));
|
|
2635
|
+
}
|
|
2636
|
+
if (filter.search) {
|
|
2637
|
+
const searchLower = filter.search.toLowerCase();
|
|
2638
|
+
results = results.filter((f) => f.name.toLowerCase().includes(searchLower) || f.description?.toLowerCase().includes(searchLower));
|
|
2639
|
+
}
|
|
2640
|
+
return results;
|
|
2641
|
+
}
|
|
2642
|
+
getCategories() {
|
|
2643
|
+
const categories = /* @__PURE__ */ new Set();
|
|
2644
|
+
for (const fragment of this.fragments.values()) {
|
|
2645
|
+
if (fragment.category) {
|
|
2646
|
+
categories.add(fragment.category);
|
|
2402
2647
|
}
|
|
2403
|
-
const result = fn.apply(component, args);
|
|
2404
|
-
return isPure ? {
|
|
2405
|
-
outputs: {
|
|
2406
|
-
result
|
|
2407
|
-
}
|
|
2408
|
-
} : {
|
|
2409
|
-
outputs: {
|
|
2410
|
-
result
|
|
2411
|
-
},
|
|
2412
|
-
nextExec: "exec"
|
|
2413
|
-
};
|
|
2414
2648
|
}
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
} catch (error) {
|
|
2426
|
-
console.error(`[Blueprint] Failed to register component ${metadata.componentName}:`, error);
|
|
2649
|
+
return Array.from(categories).sort();
|
|
2650
|
+
}
|
|
2651
|
+
getTags() {
|
|
2652
|
+
const tags = /* @__PURE__ */ new Set();
|
|
2653
|
+
for (const fragment of this.fragments.values()) {
|
|
2654
|
+
if (fragment.tags) {
|
|
2655
|
+
for (const tag of fragment.tags) {
|
|
2656
|
+
tags.add(tag);
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2427
2659
|
}
|
|
2660
|
+
return Array.from(tags).sort();
|
|
2428
2661
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
__name(registerAllComponentNodes, "registerAllComponentNodes");
|
|
2432
|
-
function registerComponentNodes(componentClass) {
|
|
2433
|
-
const components = getRegisteredBlueprintComponents();
|
|
2434
|
-
const metadata = components.get(componentClass);
|
|
2435
|
-
if (!metadata) {
|
|
2436
|
-
console.warn(`[Blueprint] Component ${componentClass.name} is not marked with @BlueprintExpose`);
|
|
2437
|
-
return;
|
|
2662
|
+
clear() {
|
|
2663
|
+
this.fragments.clear();
|
|
2438
2664
|
}
|
|
2439
|
-
|
|
2665
|
+
/**
|
|
2666
|
+
* @zh 获取片段数量
|
|
2667
|
+
* @en Get fragment count
|
|
2668
|
+
*/
|
|
2669
|
+
get size() {
|
|
2670
|
+
return this.fragments.size;
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
__name(_FragmentRegistry, "FragmentRegistry");
|
|
2674
|
+
var FragmentRegistry = _FragmentRegistry;
|
|
2675
|
+
var defaultFragmentRegistry = new FragmentRegistry();
|
|
2676
|
+
function createFragmentRegistry() {
|
|
2677
|
+
return new FragmentRegistry();
|
|
2440
2678
|
}
|
|
2441
|
-
__name(
|
|
2679
|
+
__name(createFragmentRegistry, "createFragmentRegistry");
|
|
2442
2680
|
|
|
2443
2681
|
// src/nodes/events/EventBeginPlay.ts
|
|
2444
|
-
function
|
|
2682
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
2445
2683
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2446
2684
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2447
2685
|
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;
|
|
2448
2686
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2449
2687
|
}
|
|
2450
|
-
__name(
|
|
2688
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
2451
2689
|
var EventBeginPlayTemplate = {
|
|
2452
2690
|
type: "EventBeginPlay",
|
|
2453
2691
|
title: "Event Begin Play",
|
|
@@ -2458,7 +2696,12 @@ var EventBeginPlayTemplate = {
|
|
|
2458
2696
|
"start",
|
|
2459
2697
|
"begin",
|
|
2460
2698
|
"init",
|
|
2461
|
-
"event"
|
|
2699
|
+
"event",
|
|
2700
|
+
"self"
|
|
2701
|
+
],
|
|
2702
|
+
menuPath: [
|
|
2703
|
+
"Events",
|
|
2704
|
+
"Begin Play"
|
|
2462
2705
|
],
|
|
2463
2706
|
inputs: [],
|
|
2464
2707
|
outputs: [
|
|
@@ -2466,30 +2709,38 @@ var EventBeginPlayTemplate = {
|
|
|
2466
2709
|
name: "exec",
|
|
2467
2710
|
type: "exec",
|
|
2468
2711
|
displayName: ""
|
|
2712
|
+
},
|
|
2713
|
+
{
|
|
2714
|
+
name: "self",
|
|
2715
|
+
type: "entity",
|
|
2716
|
+
displayName: "Self"
|
|
2469
2717
|
}
|
|
2470
2718
|
]
|
|
2471
2719
|
};
|
|
2472
2720
|
var _EventBeginPlayExecutor = class _EventBeginPlayExecutor {
|
|
2473
|
-
execute(_node,
|
|
2721
|
+
execute(_node, context) {
|
|
2474
2722
|
return {
|
|
2475
|
-
nextExec: "exec"
|
|
2723
|
+
nextExec: "exec",
|
|
2724
|
+
outputs: {
|
|
2725
|
+
self: context.entity
|
|
2726
|
+
}
|
|
2476
2727
|
};
|
|
2477
2728
|
}
|
|
2478
2729
|
};
|
|
2479
2730
|
__name(_EventBeginPlayExecutor, "EventBeginPlayExecutor");
|
|
2480
2731
|
var EventBeginPlayExecutor = _EventBeginPlayExecutor;
|
|
2481
|
-
EventBeginPlayExecutor =
|
|
2732
|
+
EventBeginPlayExecutor = _ts_decorate3([
|
|
2482
2733
|
RegisterNode(EventBeginPlayTemplate)
|
|
2483
2734
|
], EventBeginPlayExecutor);
|
|
2484
2735
|
|
|
2485
2736
|
// src/nodes/events/EventTick.ts
|
|
2486
|
-
function
|
|
2737
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
2487
2738
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2488
2739
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2489
2740
|
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;
|
|
2490
2741
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2491
2742
|
}
|
|
2492
|
-
__name(
|
|
2743
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
2493
2744
|
var EventTickTemplate = {
|
|
2494
2745
|
type: "EventTick",
|
|
2495
2746
|
title: "Event Tick",
|
|
@@ -2500,7 +2751,12 @@ var EventTickTemplate = {
|
|
|
2500
2751
|
"update",
|
|
2501
2752
|
"frame",
|
|
2502
2753
|
"tick",
|
|
2503
|
-
"event"
|
|
2754
|
+
"event",
|
|
2755
|
+
"self"
|
|
2756
|
+
],
|
|
2757
|
+
menuPath: [
|
|
2758
|
+
"Events",
|
|
2759
|
+
"Tick"
|
|
2504
2760
|
],
|
|
2505
2761
|
inputs: [],
|
|
2506
2762
|
outputs: [
|
|
@@ -2509,6 +2765,11 @@ var EventTickTemplate = {
|
|
|
2509
2765
|
type: "exec",
|
|
2510
2766
|
displayName: ""
|
|
2511
2767
|
},
|
|
2768
|
+
{
|
|
2769
|
+
name: "self",
|
|
2770
|
+
type: "entity",
|
|
2771
|
+
displayName: "Self"
|
|
2772
|
+
},
|
|
2512
2773
|
{
|
|
2513
2774
|
name: "deltaTime",
|
|
2514
2775
|
type: "float",
|
|
@@ -2521,6 +2782,7 @@ var _EventTickExecutor = class _EventTickExecutor {
|
|
|
2521
2782
|
return {
|
|
2522
2783
|
nextExec: "exec",
|
|
2523
2784
|
outputs: {
|
|
2785
|
+
self: context.entity,
|
|
2524
2786
|
deltaTime: context.deltaTime
|
|
2525
2787
|
}
|
|
2526
2788
|
};
|
|
@@ -2528,18 +2790,18 @@ var _EventTickExecutor = class _EventTickExecutor {
|
|
|
2528
2790
|
};
|
|
2529
2791
|
__name(_EventTickExecutor, "EventTickExecutor");
|
|
2530
2792
|
var EventTickExecutor = _EventTickExecutor;
|
|
2531
|
-
EventTickExecutor =
|
|
2793
|
+
EventTickExecutor = _ts_decorate4([
|
|
2532
2794
|
RegisterNode(EventTickTemplate)
|
|
2533
2795
|
], EventTickExecutor);
|
|
2534
2796
|
|
|
2535
2797
|
// src/nodes/events/EventEndPlay.ts
|
|
2536
|
-
function
|
|
2798
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
2537
2799
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2538
2800
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2539
2801
|
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;
|
|
2540
2802
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2541
2803
|
}
|
|
2542
|
-
__name(
|
|
2804
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
2543
2805
|
var EventEndPlayTemplate = {
|
|
2544
2806
|
type: "EventEndPlay",
|
|
2545
2807
|
title: "Event End Play",
|
|
@@ -2550,7 +2812,12 @@ var EventEndPlayTemplate = {
|
|
|
2550
2812
|
"stop",
|
|
2551
2813
|
"end",
|
|
2552
2814
|
"destroy",
|
|
2553
|
-
"event"
|
|
2815
|
+
"event",
|
|
2816
|
+
"self"
|
|
2817
|
+
],
|
|
2818
|
+
menuPath: [
|
|
2819
|
+
"Events",
|
|
2820
|
+
"End Play"
|
|
2554
2821
|
],
|
|
2555
2822
|
inputs: [],
|
|
2556
2823
|
outputs: [
|
|
@@ -2558,30 +2825,38 @@ var EventEndPlayTemplate = {
|
|
|
2558
2825
|
name: "exec",
|
|
2559
2826
|
type: "exec",
|
|
2560
2827
|
displayName: ""
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
name: "self",
|
|
2831
|
+
type: "entity",
|
|
2832
|
+
displayName: "Self"
|
|
2561
2833
|
}
|
|
2562
2834
|
]
|
|
2563
2835
|
};
|
|
2564
2836
|
var _EventEndPlayExecutor = class _EventEndPlayExecutor {
|
|
2565
|
-
execute(_node,
|
|
2837
|
+
execute(_node, context) {
|
|
2566
2838
|
return {
|
|
2567
|
-
nextExec: "exec"
|
|
2839
|
+
nextExec: "exec",
|
|
2840
|
+
outputs: {
|
|
2841
|
+
self: context.entity
|
|
2842
|
+
}
|
|
2568
2843
|
};
|
|
2569
2844
|
}
|
|
2570
2845
|
};
|
|
2571
2846
|
__name(_EventEndPlayExecutor, "EventEndPlayExecutor");
|
|
2572
2847
|
var EventEndPlayExecutor = _EventEndPlayExecutor;
|
|
2573
|
-
EventEndPlayExecutor =
|
|
2848
|
+
EventEndPlayExecutor = _ts_decorate5([
|
|
2574
2849
|
RegisterNode(EventEndPlayTemplate)
|
|
2575
2850
|
], EventEndPlayExecutor);
|
|
2576
2851
|
|
|
2577
2852
|
// src/nodes/ecs/EntityNodes.ts
|
|
2578
|
-
function
|
|
2853
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
2579
2854
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2580
2855
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2581
2856
|
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;
|
|
2582
2857
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2583
2858
|
}
|
|
2584
|
-
__name(
|
|
2859
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
2585
2860
|
var GetSelfTemplate = {
|
|
2586
2861
|
type: "ECS_GetSelf",
|
|
2587
2862
|
title: "Get Self",
|
|
@@ -2621,7 +2896,7 @@ var _GetSelfExecutor = class _GetSelfExecutor {
|
|
|
2621
2896
|
};
|
|
2622
2897
|
__name(_GetSelfExecutor, "GetSelfExecutor");
|
|
2623
2898
|
var GetSelfExecutor = _GetSelfExecutor;
|
|
2624
|
-
GetSelfExecutor =
|
|
2899
|
+
GetSelfExecutor = _ts_decorate6([
|
|
2625
2900
|
RegisterNode(GetSelfTemplate)
|
|
2626
2901
|
], GetSelfExecutor);
|
|
2627
2902
|
var CreateEntityTemplate = {
|
|
@@ -2682,7 +2957,7 @@ var _CreateEntityExecutor = class _CreateEntityExecutor {
|
|
|
2682
2957
|
};
|
|
2683
2958
|
__name(_CreateEntityExecutor, "CreateEntityExecutor");
|
|
2684
2959
|
var CreateEntityExecutor = _CreateEntityExecutor;
|
|
2685
|
-
CreateEntityExecutor =
|
|
2960
|
+
CreateEntityExecutor = _ts_decorate6([
|
|
2686
2961
|
RegisterNode(CreateEntityTemplate)
|
|
2687
2962
|
], CreateEntityExecutor);
|
|
2688
2963
|
var DestroyEntityTemplate = {
|
|
@@ -2736,7 +3011,7 @@ var _DestroyEntityExecutor = class _DestroyEntityExecutor {
|
|
|
2736
3011
|
};
|
|
2737
3012
|
__name(_DestroyEntityExecutor, "DestroyEntityExecutor");
|
|
2738
3013
|
var DestroyEntityExecutor = _DestroyEntityExecutor;
|
|
2739
|
-
DestroyEntityExecutor =
|
|
3014
|
+
DestroyEntityExecutor = _ts_decorate6([
|
|
2740
3015
|
RegisterNode(DestroyEntityTemplate)
|
|
2741
3016
|
], DestroyEntityExecutor);
|
|
2742
3017
|
var DestroySelfTemplate = {
|
|
@@ -2778,7 +3053,7 @@ var _DestroySelfExecutor = class _DestroySelfExecutor {
|
|
|
2778
3053
|
};
|
|
2779
3054
|
__name(_DestroySelfExecutor, "DestroySelfExecutor");
|
|
2780
3055
|
var DestroySelfExecutor = _DestroySelfExecutor;
|
|
2781
|
-
DestroySelfExecutor =
|
|
3056
|
+
DestroySelfExecutor = _ts_decorate6([
|
|
2782
3057
|
RegisterNode(DestroySelfTemplate)
|
|
2783
3058
|
], DestroySelfExecutor);
|
|
2784
3059
|
var IsValidTemplate = {
|
|
@@ -2829,7 +3104,7 @@ var _IsValidExecutor = class _IsValidExecutor {
|
|
|
2829
3104
|
};
|
|
2830
3105
|
__name(_IsValidExecutor, "IsValidExecutor");
|
|
2831
3106
|
var IsValidExecutor = _IsValidExecutor;
|
|
2832
|
-
IsValidExecutor =
|
|
3107
|
+
IsValidExecutor = _ts_decorate6([
|
|
2833
3108
|
RegisterNode(IsValidTemplate)
|
|
2834
3109
|
], IsValidExecutor);
|
|
2835
3110
|
var GetEntityNameTemplate = {
|
|
@@ -2877,7 +3152,7 @@ var _GetEntityNameExecutor = class _GetEntityNameExecutor {
|
|
|
2877
3152
|
};
|
|
2878
3153
|
__name(_GetEntityNameExecutor, "GetEntityNameExecutor");
|
|
2879
3154
|
var GetEntityNameExecutor = _GetEntityNameExecutor;
|
|
2880
|
-
GetEntityNameExecutor =
|
|
3155
|
+
GetEntityNameExecutor = _ts_decorate6([
|
|
2881
3156
|
RegisterNode(GetEntityNameTemplate)
|
|
2882
3157
|
], GetEntityNameExecutor);
|
|
2883
3158
|
var SetEntityNameTemplate = {
|
|
@@ -2937,7 +3212,7 @@ var _SetEntityNameExecutor = class _SetEntityNameExecutor {
|
|
|
2937
3212
|
};
|
|
2938
3213
|
__name(_SetEntityNameExecutor, "SetEntityNameExecutor");
|
|
2939
3214
|
var SetEntityNameExecutor = _SetEntityNameExecutor;
|
|
2940
|
-
SetEntityNameExecutor =
|
|
3215
|
+
SetEntityNameExecutor = _ts_decorate6([
|
|
2941
3216
|
RegisterNode(SetEntityNameTemplate)
|
|
2942
3217
|
], SetEntityNameExecutor);
|
|
2943
3218
|
var GetEntityTagTemplate = {
|
|
@@ -2985,7 +3260,7 @@ var _GetEntityTagExecutor = class _GetEntityTagExecutor {
|
|
|
2985
3260
|
};
|
|
2986
3261
|
__name(_GetEntityTagExecutor, "GetEntityTagExecutor");
|
|
2987
3262
|
var GetEntityTagExecutor = _GetEntityTagExecutor;
|
|
2988
|
-
GetEntityTagExecutor =
|
|
3263
|
+
GetEntityTagExecutor = _ts_decorate6([
|
|
2989
3264
|
RegisterNode(GetEntityTagTemplate)
|
|
2990
3265
|
], GetEntityTagExecutor);
|
|
2991
3266
|
var SetEntityTagTemplate = {
|
|
@@ -3045,7 +3320,7 @@ var _SetEntityTagExecutor = class _SetEntityTagExecutor {
|
|
|
3045
3320
|
};
|
|
3046
3321
|
__name(_SetEntityTagExecutor, "SetEntityTagExecutor");
|
|
3047
3322
|
var SetEntityTagExecutor = _SetEntityTagExecutor;
|
|
3048
|
-
SetEntityTagExecutor =
|
|
3323
|
+
SetEntityTagExecutor = _ts_decorate6([
|
|
3049
3324
|
RegisterNode(SetEntityTagTemplate)
|
|
3050
3325
|
], SetEntityTagExecutor);
|
|
3051
3326
|
var SetEntityActiveTemplate = {
|
|
@@ -3106,7 +3381,7 @@ var _SetEntityActiveExecutor = class _SetEntityActiveExecutor {
|
|
|
3106
3381
|
};
|
|
3107
3382
|
__name(_SetEntityActiveExecutor, "SetEntityActiveExecutor");
|
|
3108
3383
|
var SetEntityActiveExecutor = _SetEntityActiveExecutor;
|
|
3109
|
-
SetEntityActiveExecutor =
|
|
3384
|
+
SetEntityActiveExecutor = _ts_decorate6([
|
|
3110
3385
|
RegisterNode(SetEntityActiveTemplate)
|
|
3111
3386
|
], SetEntityActiveExecutor);
|
|
3112
3387
|
var IsEntityActiveTemplate = {
|
|
@@ -3154,7 +3429,7 @@ var _IsEntityActiveExecutor = class _IsEntityActiveExecutor {
|
|
|
3154
3429
|
};
|
|
3155
3430
|
__name(_IsEntityActiveExecutor, "IsEntityActiveExecutor");
|
|
3156
3431
|
var IsEntityActiveExecutor = _IsEntityActiveExecutor;
|
|
3157
|
-
IsEntityActiveExecutor =
|
|
3432
|
+
IsEntityActiveExecutor = _ts_decorate6([
|
|
3158
3433
|
RegisterNode(IsEntityActiveTemplate)
|
|
3159
3434
|
], IsEntityActiveExecutor);
|
|
3160
3435
|
var FindEntityByNameTemplate = {
|
|
@@ -3212,7 +3487,7 @@ var _FindEntityByNameExecutor = class _FindEntityByNameExecutor {
|
|
|
3212
3487
|
};
|
|
3213
3488
|
__name(_FindEntityByNameExecutor, "FindEntityByNameExecutor");
|
|
3214
3489
|
var FindEntityByNameExecutor = _FindEntityByNameExecutor;
|
|
3215
|
-
FindEntityByNameExecutor =
|
|
3490
|
+
FindEntityByNameExecutor = _ts_decorate6([
|
|
3216
3491
|
RegisterNode(FindEntityByNameTemplate)
|
|
3217
3492
|
], FindEntityByNameExecutor);
|
|
3218
3493
|
var FindEntitiesByTagTemplate = {
|
|
@@ -3271,7 +3546,7 @@ var _FindEntitiesByTagExecutor = class _FindEntitiesByTagExecutor {
|
|
|
3271
3546
|
};
|
|
3272
3547
|
__name(_FindEntitiesByTagExecutor, "FindEntitiesByTagExecutor");
|
|
3273
3548
|
var FindEntitiesByTagExecutor = _FindEntitiesByTagExecutor;
|
|
3274
|
-
FindEntitiesByTagExecutor =
|
|
3549
|
+
FindEntitiesByTagExecutor = _ts_decorate6([
|
|
3275
3550
|
RegisterNode(FindEntitiesByTagTemplate)
|
|
3276
3551
|
], FindEntitiesByTagExecutor);
|
|
3277
3552
|
var GetEntityIdTemplate = {
|
|
@@ -3319,7 +3594,7 @@ var _GetEntityIdExecutor = class _GetEntityIdExecutor {
|
|
|
3319
3594
|
};
|
|
3320
3595
|
__name(_GetEntityIdExecutor, "GetEntityIdExecutor");
|
|
3321
3596
|
var GetEntityIdExecutor = _GetEntityIdExecutor;
|
|
3322
|
-
GetEntityIdExecutor =
|
|
3597
|
+
GetEntityIdExecutor = _ts_decorate6([
|
|
3323
3598
|
RegisterNode(GetEntityIdTemplate)
|
|
3324
3599
|
], GetEntityIdExecutor);
|
|
3325
3600
|
var FindEntityByIdTemplate = {
|
|
@@ -3375,18 +3650,132 @@ var _FindEntityByIdExecutor = class _FindEntityByIdExecutor {
|
|
|
3375
3650
|
};
|
|
3376
3651
|
__name(_FindEntityByIdExecutor, "FindEntityByIdExecutor");
|
|
3377
3652
|
var FindEntityByIdExecutor = _FindEntityByIdExecutor;
|
|
3378
|
-
FindEntityByIdExecutor =
|
|
3653
|
+
FindEntityByIdExecutor = _ts_decorate6([
|
|
3379
3654
|
RegisterNode(FindEntityByIdTemplate)
|
|
3380
3655
|
], FindEntityByIdExecutor);
|
|
3381
3656
|
|
|
3382
3657
|
// src/nodes/ecs/ComponentNodes.ts
|
|
3383
|
-
function
|
|
3658
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
3384
3659
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3385
3660
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3386
3661
|
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;
|
|
3387
3662
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3388
3663
|
}
|
|
3389
|
-
__name(
|
|
3664
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
3665
|
+
var AddComponentTemplate = {
|
|
3666
|
+
type: "ECS_AddComponent",
|
|
3667
|
+
title: "Add Component",
|
|
3668
|
+
category: "component",
|
|
3669
|
+
color: "#1e8b8b",
|
|
3670
|
+
description: "Adds a component to an entity by type name (\u6309\u7C7B\u578B\u540D\u79F0\u4E3A\u5B9E\u4F53\u6DFB\u52A0\u7EC4\u4EF6)",
|
|
3671
|
+
keywords: [
|
|
3672
|
+
"component",
|
|
3673
|
+
"add",
|
|
3674
|
+
"create",
|
|
3675
|
+
"attach"
|
|
3676
|
+
],
|
|
3677
|
+
menuPath: [
|
|
3678
|
+
"ECS",
|
|
3679
|
+
"Component",
|
|
3680
|
+
"Add Component"
|
|
3681
|
+
],
|
|
3682
|
+
inputs: [
|
|
3683
|
+
{
|
|
3684
|
+
name: "exec",
|
|
3685
|
+
type: "exec",
|
|
3686
|
+
displayName: ""
|
|
3687
|
+
},
|
|
3688
|
+
{
|
|
3689
|
+
name: "entity",
|
|
3690
|
+
type: "entity",
|
|
3691
|
+
displayName: "Entity"
|
|
3692
|
+
},
|
|
3693
|
+
{
|
|
3694
|
+
name: "componentType",
|
|
3695
|
+
type: "string",
|
|
3696
|
+
displayName: "Component Type",
|
|
3697
|
+
defaultValue: ""
|
|
3698
|
+
}
|
|
3699
|
+
],
|
|
3700
|
+
outputs: [
|
|
3701
|
+
{
|
|
3702
|
+
name: "exec",
|
|
3703
|
+
type: "exec",
|
|
3704
|
+
displayName: ""
|
|
3705
|
+
},
|
|
3706
|
+
{
|
|
3707
|
+
name: "component",
|
|
3708
|
+
type: "component",
|
|
3709
|
+
displayName: "Component"
|
|
3710
|
+
},
|
|
3711
|
+
{
|
|
3712
|
+
name: "success",
|
|
3713
|
+
type: "bool",
|
|
3714
|
+
displayName: "Success"
|
|
3715
|
+
}
|
|
3716
|
+
]
|
|
3717
|
+
};
|
|
3718
|
+
var _AddComponentExecutor = class _AddComponentExecutor {
|
|
3719
|
+
execute(node, context) {
|
|
3720
|
+
const entity = context.evaluateInput(node.id, "entity", context.entity);
|
|
3721
|
+
const componentType = context.evaluateInput(node.id, "componentType", "");
|
|
3722
|
+
if (!entity || entity.isDestroyed || !componentType) {
|
|
3723
|
+
return {
|
|
3724
|
+
outputs: {
|
|
3725
|
+
component: null,
|
|
3726
|
+
success: false
|
|
3727
|
+
},
|
|
3728
|
+
nextExec: "exec"
|
|
3729
|
+
};
|
|
3730
|
+
}
|
|
3731
|
+
const existing = entity.components.find((c) => c.constructor.name === componentType || c.constructor.__componentName__ === componentType);
|
|
3732
|
+
if (existing) {
|
|
3733
|
+
return {
|
|
3734
|
+
outputs: {
|
|
3735
|
+
component: existing,
|
|
3736
|
+
success: false
|
|
3737
|
+
},
|
|
3738
|
+
nextExec: "exec"
|
|
3739
|
+
};
|
|
3740
|
+
}
|
|
3741
|
+
const ComponentClass = context.getComponentClass?.(componentType);
|
|
3742
|
+
if (!ComponentClass) {
|
|
3743
|
+
console.warn(`[Blueprint] Component type not found: ${componentType}`);
|
|
3744
|
+
return {
|
|
3745
|
+
outputs: {
|
|
3746
|
+
component: null,
|
|
3747
|
+
success: false
|
|
3748
|
+
},
|
|
3749
|
+
nextExec: "exec"
|
|
3750
|
+
};
|
|
3751
|
+
}
|
|
3752
|
+
try {
|
|
3753
|
+
const component = new ComponentClass();
|
|
3754
|
+
entity.addComponent(component);
|
|
3755
|
+
return {
|
|
3756
|
+
outputs: {
|
|
3757
|
+
component,
|
|
3758
|
+
success: true
|
|
3759
|
+
},
|
|
3760
|
+
nextExec: "exec"
|
|
3761
|
+
};
|
|
3762
|
+
} catch (error) {
|
|
3763
|
+
console.error(`[Blueprint] Failed to add component ${componentType}:`, error);
|
|
3764
|
+
return {
|
|
3765
|
+
outputs: {
|
|
3766
|
+
component: null,
|
|
3767
|
+
success: false
|
|
3768
|
+
},
|
|
3769
|
+
nextExec: "exec"
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
};
|
|
3774
|
+
__name(_AddComponentExecutor, "AddComponentExecutor");
|
|
3775
|
+
var AddComponentExecutor = _AddComponentExecutor;
|
|
3776
|
+
AddComponentExecutor = _ts_decorate7([
|
|
3777
|
+
RegisterNode(AddComponentTemplate)
|
|
3778
|
+
], AddComponentExecutor);
|
|
3390
3779
|
var HasComponentTemplate = {
|
|
3391
3780
|
type: "ECS_HasComponent",
|
|
3392
3781
|
title: "Has Component",
|
|
@@ -3448,7 +3837,7 @@ var _HasComponentExecutor = class _HasComponentExecutor {
|
|
|
3448
3837
|
};
|
|
3449
3838
|
__name(_HasComponentExecutor, "HasComponentExecutor");
|
|
3450
3839
|
var HasComponentExecutor = _HasComponentExecutor;
|
|
3451
|
-
HasComponentExecutor =
|
|
3840
|
+
HasComponentExecutor = _ts_decorate7([
|
|
3452
3841
|
RegisterNode(HasComponentTemplate)
|
|
3453
3842
|
], HasComponentExecutor);
|
|
3454
3843
|
var GetComponentTemplate = {
|
|
@@ -3518,7 +3907,7 @@ var _GetComponentExecutor = class _GetComponentExecutor {
|
|
|
3518
3907
|
};
|
|
3519
3908
|
__name(_GetComponentExecutor, "GetComponentExecutor");
|
|
3520
3909
|
var GetComponentExecutor = _GetComponentExecutor;
|
|
3521
|
-
GetComponentExecutor =
|
|
3910
|
+
GetComponentExecutor = _ts_decorate7([
|
|
3522
3911
|
RegisterNode(GetComponentTemplate)
|
|
3523
3912
|
], GetComponentExecutor);
|
|
3524
3913
|
var GetAllComponentsTemplate = {
|
|
@@ -3584,7 +3973,7 @@ var _GetAllComponentsExecutor = class _GetAllComponentsExecutor {
|
|
|
3584
3973
|
};
|
|
3585
3974
|
__name(_GetAllComponentsExecutor, "GetAllComponentsExecutor");
|
|
3586
3975
|
var GetAllComponentsExecutor = _GetAllComponentsExecutor;
|
|
3587
|
-
GetAllComponentsExecutor =
|
|
3976
|
+
GetAllComponentsExecutor = _ts_decorate7([
|
|
3588
3977
|
RegisterNode(GetAllComponentsTemplate)
|
|
3589
3978
|
], GetAllComponentsExecutor);
|
|
3590
3979
|
var RemoveComponentTemplate = {
|
|
@@ -3667,7 +4056,7 @@ var _RemoveComponentExecutor = class _RemoveComponentExecutor {
|
|
|
3667
4056
|
};
|
|
3668
4057
|
__name(_RemoveComponentExecutor, "RemoveComponentExecutor");
|
|
3669
4058
|
var RemoveComponentExecutor = _RemoveComponentExecutor;
|
|
3670
|
-
RemoveComponentExecutor =
|
|
4059
|
+
RemoveComponentExecutor = _ts_decorate7([
|
|
3671
4060
|
RegisterNode(RemoveComponentTemplate)
|
|
3672
4061
|
], RemoveComponentExecutor);
|
|
3673
4062
|
var GetComponentPropertyTemplate = {
|
|
@@ -3745,7 +4134,7 @@ var _GetComponentPropertyExecutor = class _GetComponentPropertyExecutor {
|
|
|
3745
4134
|
};
|
|
3746
4135
|
__name(_GetComponentPropertyExecutor, "GetComponentPropertyExecutor");
|
|
3747
4136
|
var GetComponentPropertyExecutor = _GetComponentPropertyExecutor;
|
|
3748
|
-
GetComponentPropertyExecutor =
|
|
4137
|
+
GetComponentPropertyExecutor = _ts_decorate7([
|
|
3749
4138
|
RegisterNode(GetComponentPropertyTemplate)
|
|
3750
4139
|
], GetComponentPropertyExecutor);
|
|
3751
4140
|
var SetComponentPropertyTemplate = {
|
|
@@ -3835,7 +4224,7 @@ var _SetComponentPropertyExecutor = class _SetComponentPropertyExecutor {
|
|
|
3835
4224
|
};
|
|
3836
4225
|
__name(_SetComponentPropertyExecutor, "SetComponentPropertyExecutor");
|
|
3837
4226
|
var SetComponentPropertyExecutor = _SetComponentPropertyExecutor;
|
|
3838
|
-
SetComponentPropertyExecutor =
|
|
4227
|
+
SetComponentPropertyExecutor = _ts_decorate7([
|
|
3839
4228
|
RegisterNode(SetComponentPropertyTemplate)
|
|
3840
4229
|
], SetComponentPropertyExecutor);
|
|
3841
4230
|
var GetComponentTypeNameTemplate = {
|
|
@@ -3891,7 +4280,7 @@ var _GetComponentTypeNameExecutor = class _GetComponentTypeNameExecutor {
|
|
|
3891
4280
|
};
|
|
3892
4281
|
__name(_GetComponentTypeNameExecutor, "GetComponentTypeNameExecutor");
|
|
3893
4282
|
var GetComponentTypeNameExecutor = _GetComponentTypeNameExecutor;
|
|
3894
|
-
GetComponentTypeNameExecutor =
|
|
4283
|
+
GetComponentTypeNameExecutor = _ts_decorate7([
|
|
3895
4284
|
RegisterNode(GetComponentTypeNameTemplate)
|
|
3896
4285
|
], GetComponentTypeNameExecutor);
|
|
3897
4286
|
var GetEntityFromComponentTemplate = {
|
|
@@ -3954,18 +4343,18 @@ var _GetEntityFromComponentExecutor = class _GetEntityFromComponentExecutor {
|
|
|
3954
4343
|
};
|
|
3955
4344
|
__name(_GetEntityFromComponentExecutor, "GetEntityFromComponentExecutor");
|
|
3956
4345
|
var GetEntityFromComponentExecutor = _GetEntityFromComponentExecutor;
|
|
3957
|
-
GetEntityFromComponentExecutor =
|
|
4346
|
+
GetEntityFromComponentExecutor = _ts_decorate7([
|
|
3958
4347
|
RegisterNode(GetEntityFromComponentTemplate)
|
|
3959
4348
|
], GetEntityFromComponentExecutor);
|
|
3960
4349
|
|
|
3961
4350
|
// src/nodes/ecs/FlowNodes.ts
|
|
3962
|
-
function
|
|
4351
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
3963
4352
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3964
4353
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3965
4354
|
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;
|
|
3966
4355
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3967
4356
|
}
|
|
3968
|
-
__name(
|
|
4357
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
3969
4358
|
var BranchTemplate = {
|
|
3970
4359
|
type: "Flow_Branch",
|
|
3971
4360
|
title: "Branch",
|
|
@@ -4019,7 +4408,7 @@ var _BranchExecutor = class _BranchExecutor {
|
|
|
4019
4408
|
};
|
|
4020
4409
|
__name(_BranchExecutor, "BranchExecutor");
|
|
4021
4410
|
var BranchExecutor = _BranchExecutor;
|
|
4022
|
-
BranchExecutor =
|
|
4411
|
+
BranchExecutor = _ts_decorate8([
|
|
4023
4412
|
RegisterNode(BranchTemplate)
|
|
4024
4413
|
], BranchExecutor);
|
|
4025
4414
|
var SequenceTemplate = {
|
|
@@ -4093,7 +4482,7 @@ var _SequenceExecutor = class _SequenceExecutor {
|
|
|
4093
4482
|
};
|
|
4094
4483
|
__name(_SequenceExecutor, "SequenceExecutor");
|
|
4095
4484
|
var SequenceExecutor = _SequenceExecutor;
|
|
4096
|
-
SequenceExecutor =
|
|
4485
|
+
SequenceExecutor = _ts_decorate8([
|
|
4097
4486
|
RegisterNode(SequenceTemplate)
|
|
4098
4487
|
], SequenceExecutor);
|
|
4099
4488
|
var DoOnceTemplate = {
|
|
@@ -4157,7 +4546,7 @@ var _DoOnceExecutor = class _DoOnceExecutor {
|
|
|
4157
4546
|
};
|
|
4158
4547
|
__name(_DoOnceExecutor, "DoOnceExecutor");
|
|
4159
4548
|
var DoOnceExecutor = _DoOnceExecutor;
|
|
4160
|
-
DoOnceExecutor =
|
|
4549
|
+
DoOnceExecutor = _ts_decorate8([
|
|
4161
4550
|
RegisterNode(DoOnceTemplate)
|
|
4162
4551
|
], DoOnceExecutor);
|
|
4163
4552
|
var FlipFlopTemplate = {
|
|
@@ -4219,7 +4608,7 @@ var _FlipFlopExecutor = class _FlipFlopExecutor {
|
|
|
4219
4608
|
};
|
|
4220
4609
|
__name(_FlipFlopExecutor, "FlipFlopExecutor");
|
|
4221
4610
|
var FlipFlopExecutor = _FlipFlopExecutor;
|
|
4222
|
-
FlipFlopExecutor =
|
|
4611
|
+
FlipFlopExecutor = _ts_decorate8([
|
|
4223
4612
|
RegisterNode(FlipFlopTemplate)
|
|
4224
4613
|
], FlipFlopExecutor);
|
|
4225
4614
|
var GateTemplate = {
|
|
@@ -4309,7 +4698,7 @@ var _GateExecutor = class _GateExecutor {
|
|
|
4309
4698
|
};
|
|
4310
4699
|
__name(_GateExecutor, "GateExecutor");
|
|
4311
4700
|
var GateExecutor = _GateExecutor;
|
|
4312
|
-
GateExecutor =
|
|
4701
|
+
GateExecutor = _ts_decorate8([
|
|
4313
4702
|
RegisterNode(GateTemplate)
|
|
4314
4703
|
], GateExecutor);
|
|
4315
4704
|
var ForLoopTemplate = {
|
|
@@ -4399,7 +4788,7 @@ var _ForLoopExecutor = class _ForLoopExecutor {
|
|
|
4399
4788
|
};
|
|
4400
4789
|
__name(_ForLoopExecutor, "ForLoopExecutor");
|
|
4401
4790
|
var ForLoopExecutor = _ForLoopExecutor;
|
|
4402
|
-
ForLoopExecutor =
|
|
4791
|
+
ForLoopExecutor = _ts_decorate8([
|
|
4403
4792
|
RegisterNode(ForLoopTemplate)
|
|
4404
4793
|
], ForLoopExecutor);
|
|
4405
4794
|
var WhileLoopTemplate = {
|
|
@@ -4459,18 +4848,18 @@ var _WhileLoopExecutor = class _WhileLoopExecutor {
|
|
|
4459
4848
|
};
|
|
4460
4849
|
__name(_WhileLoopExecutor, "WhileLoopExecutor");
|
|
4461
4850
|
var WhileLoopExecutor = _WhileLoopExecutor;
|
|
4462
|
-
WhileLoopExecutor =
|
|
4851
|
+
WhileLoopExecutor = _ts_decorate8([
|
|
4463
4852
|
RegisterNode(WhileLoopTemplate)
|
|
4464
4853
|
], WhileLoopExecutor);
|
|
4465
4854
|
|
|
4466
4855
|
// src/nodes/math/MathOperations.ts
|
|
4467
|
-
function
|
|
4856
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
4468
4857
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4469
4858
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4470
4859
|
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;
|
|
4471
4860
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4472
4861
|
}
|
|
4473
|
-
__name(
|
|
4862
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
4474
4863
|
var AddTemplate = {
|
|
4475
4864
|
type: "Add",
|
|
4476
4865
|
title: "Add",
|
|
@@ -4520,7 +4909,7 @@ var _AddExecutor = class _AddExecutor {
|
|
|
4520
4909
|
};
|
|
4521
4910
|
__name(_AddExecutor, "AddExecutor");
|
|
4522
4911
|
var AddExecutor = _AddExecutor;
|
|
4523
|
-
AddExecutor =
|
|
4912
|
+
AddExecutor = _ts_decorate9([
|
|
4524
4913
|
RegisterNode(AddTemplate)
|
|
4525
4914
|
], AddExecutor);
|
|
4526
4915
|
var SubtractTemplate = {
|
|
@@ -4571,7 +4960,7 @@ var _SubtractExecutor = class _SubtractExecutor {
|
|
|
4571
4960
|
};
|
|
4572
4961
|
__name(_SubtractExecutor, "SubtractExecutor");
|
|
4573
4962
|
var SubtractExecutor = _SubtractExecutor;
|
|
4574
|
-
SubtractExecutor =
|
|
4963
|
+
SubtractExecutor = _ts_decorate9([
|
|
4575
4964
|
RegisterNode(SubtractTemplate)
|
|
4576
4965
|
], SubtractExecutor);
|
|
4577
4966
|
var MultiplyTemplate = {
|
|
@@ -4622,7 +5011,7 @@ var _MultiplyExecutor = class _MultiplyExecutor {
|
|
|
4622
5011
|
};
|
|
4623
5012
|
__name(_MultiplyExecutor, "MultiplyExecutor");
|
|
4624
5013
|
var MultiplyExecutor = _MultiplyExecutor;
|
|
4625
|
-
MultiplyExecutor =
|
|
5014
|
+
MultiplyExecutor = _ts_decorate9([
|
|
4626
5015
|
RegisterNode(MultiplyTemplate)
|
|
4627
5016
|
], MultiplyExecutor);
|
|
4628
5017
|
var DivideTemplate = {
|
|
@@ -4679,18 +5068,18 @@ var _DivideExecutor = class _DivideExecutor {
|
|
|
4679
5068
|
};
|
|
4680
5069
|
__name(_DivideExecutor, "DivideExecutor");
|
|
4681
5070
|
var DivideExecutor = _DivideExecutor;
|
|
4682
|
-
DivideExecutor =
|
|
5071
|
+
DivideExecutor = _ts_decorate9([
|
|
4683
5072
|
RegisterNode(DivideTemplate)
|
|
4684
5073
|
], DivideExecutor);
|
|
4685
5074
|
|
|
4686
5075
|
// src/nodes/time/GetDeltaTime.ts
|
|
4687
|
-
function
|
|
5076
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
4688
5077
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4689
5078
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4690
5079
|
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;
|
|
4691
5080
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4692
5081
|
}
|
|
4693
|
-
__name(
|
|
5082
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
4694
5083
|
var GetDeltaTimeTemplate = {
|
|
4695
5084
|
type: "GetDeltaTime",
|
|
4696
5085
|
title: "Get Delta Time",
|
|
@@ -4724,18 +5113,18 @@ var _GetDeltaTimeExecutor = class _GetDeltaTimeExecutor {
|
|
|
4724
5113
|
};
|
|
4725
5114
|
__name(_GetDeltaTimeExecutor, "GetDeltaTimeExecutor");
|
|
4726
5115
|
var GetDeltaTimeExecutor = _GetDeltaTimeExecutor;
|
|
4727
|
-
GetDeltaTimeExecutor =
|
|
5116
|
+
GetDeltaTimeExecutor = _ts_decorate10([
|
|
4728
5117
|
RegisterNode(GetDeltaTimeTemplate)
|
|
4729
5118
|
], GetDeltaTimeExecutor);
|
|
4730
5119
|
|
|
4731
5120
|
// src/nodes/time/GetTime.ts
|
|
4732
|
-
function
|
|
5121
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
4733
5122
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4734
5123
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4735
5124
|
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;
|
|
4736
5125
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4737
5126
|
}
|
|
4738
|
-
__name(
|
|
5127
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
4739
5128
|
var GetTimeTemplate = {
|
|
4740
5129
|
type: "GetTime",
|
|
4741
5130
|
title: "Get Game Time",
|
|
@@ -4769,18 +5158,18 @@ var _GetTimeExecutor = class _GetTimeExecutor {
|
|
|
4769
5158
|
};
|
|
4770
5159
|
__name(_GetTimeExecutor, "GetTimeExecutor");
|
|
4771
5160
|
var GetTimeExecutor = _GetTimeExecutor;
|
|
4772
|
-
GetTimeExecutor =
|
|
5161
|
+
GetTimeExecutor = _ts_decorate11([
|
|
4773
5162
|
RegisterNode(GetTimeTemplate)
|
|
4774
5163
|
], GetTimeExecutor);
|
|
4775
5164
|
|
|
4776
5165
|
// src/nodes/time/Delay.ts
|
|
4777
|
-
function
|
|
5166
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
4778
5167
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4779
5168
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4780
5169
|
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;
|
|
4781
5170
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4782
5171
|
}
|
|
4783
|
-
__name(
|
|
5172
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
4784
5173
|
var DelayTemplate = {
|
|
4785
5174
|
type: "Delay",
|
|
4786
5175
|
title: "Delay",
|
|
@@ -4826,18 +5215,18 @@ var _DelayExecutor = class _DelayExecutor {
|
|
|
4826
5215
|
};
|
|
4827
5216
|
__name(_DelayExecutor, "DelayExecutor");
|
|
4828
5217
|
var DelayExecutor = _DelayExecutor;
|
|
4829
|
-
DelayExecutor =
|
|
5218
|
+
DelayExecutor = _ts_decorate12([
|
|
4830
5219
|
RegisterNode(DelayTemplate)
|
|
4831
5220
|
], DelayExecutor);
|
|
4832
5221
|
|
|
4833
5222
|
// src/nodes/debug/Print.ts
|
|
4834
|
-
function
|
|
5223
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
4835
5224
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4836
5225
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4837
5226
|
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;
|
|
4838
5227
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4839
5228
|
}
|
|
4840
|
-
__name(
|
|
5229
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
4841
5230
|
var PrintTemplate = {
|
|
4842
5231
|
type: "Print",
|
|
4843
5232
|
title: "Print String",
|
|
@@ -4910,17 +5299,25 @@ var _PrintExecutor = class _PrintExecutor {
|
|
|
4910
5299
|
};
|
|
4911
5300
|
__name(_PrintExecutor, "PrintExecutor");
|
|
4912
5301
|
var PrintExecutor = _PrintExecutor;
|
|
4913
|
-
PrintExecutor =
|
|
5302
|
+
PrintExecutor = _ts_decorate13([
|
|
4914
5303
|
RegisterNode(PrintTemplate)
|
|
4915
5304
|
], PrintExecutor);
|
|
5305
|
+
|
|
5306
|
+
// src/index.ts
|
|
5307
|
+
function registerComponentClass(typeName, componentClass) {
|
|
5308
|
+
ExecutionContext.registerComponentClass(typeName, componentClass);
|
|
5309
|
+
}
|
|
5310
|
+
__name(registerComponentClass, "registerComponentClass");
|
|
4916
5311
|
export {
|
|
4917
5312
|
AlwaysFalseCondition,
|
|
4918
5313
|
AlwaysTrueCondition,
|
|
5314
|
+
BlueprintComponent,
|
|
4919
5315
|
BlueprintComposer,
|
|
4920
5316
|
BlueprintExpose,
|
|
4921
5317
|
BlueprintFragment,
|
|
4922
5318
|
BlueprintMethod,
|
|
4923
5319
|
BlueprintProperty,
|
|
5320
|
+
BlueprintSystem,
|
|
4924
5321
|
BlueprintTrigger,
|
|
4925
5322
|
BlueprintVM,
|
|
4926
5323
|
CollisionEntityCondition,
|
|
@@ -4944,11 +5341,8 @@ export {
|
|
|
4944
5341
|
TriggerTypeCondition,
|
|
4945
5342
|
TriggerTypes,
|
|
4946
5343
|
arePinTypesCompatible,
|
|
4947
|
-
cleanupBlueprint,
|
|
4948
5344
|
clearRegisteredComponents,
|
|
4949
5345
|
condition,
|
|
4950
|
-
createBlueprintComponentData,
|
|
4951
|
-
createBlueprintSystem,
|
|
4952
5346
|
createCollisionContext,
|
|
4953
5347
|
createCollisionTrigger,
|
|
4954
5348
|
createComposer,
|
|
@@ -4981,14 +5375,9 @@ export {
|
|
|
4981
5375
|
getPinTypeColor,
|
|
4982
5376
|
getRegisteredBlueprintComponents,
|
|
4983
5377
|
inferPinType,
|
|
4984
|
-
initializeBlueprintVM,
|
|
4985
5378
|
registerAllComponentNodes,
|
|
5379
|
+
registerComponentClass,
|
|
4986
5380
|
registerComponentNodes,
|
|
4987
|
-
startBlueprint,
|
|
4988
|
-
stopBlueprint,
|
|
4989
|
-
tickBlueprint,
|
|
4990
|
-
triggerBlueprintEvent,
|
|
4991
|
-
triggerCustomBlueprintEvent,
|
|
4992
5381
|
validateBlueprintAsset
|
|
4993
5382
|
};
|
|
4994
5383
|
//# sourceMappingURL=index.js.map
|