@holoscript/core 6.0.4 → 7.0.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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +3 -2
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/index.d.ts +501 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/tools/index.d.ts +22 -1
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +105 -57
- package/dist/GLTFPipeline-DEN36VNK.js +0 -12
- package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
- package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
- package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
- package/dist/USDZExporter-NTMBNTDB.js +0 -707
- package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2CWOLHTE.js +0 -69
- package/dist/chunk-33LSUQDD.cjs +0 -835
- package/dist/chunk-3FJCK5XA.js +0 -2232
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3SAK5KFL.cjs +0 -83
- package/dist/chunk-4XSNJCLC.cjs +0 -1859
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5BGSECRJ.cjs +0 -2237
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5O6TQC6M.cjs +0 -1871
- package/dist/chunk-5OEOHAAW.cjs +0 -682
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-5WUNN6ZN.cjs +0 -428
- package/dist/chunk-6TZPZCOJ.cjs +0 -1404
- package/dist/chunk-6UEHYZ7V.cjs +0 -773
- package/dist/chunk-6XSERL6L.js +0 -5678
- package/dist/chunk-72EQECGT.cjs +0 -908
- package/dist/chunk-7AGYRWKW.cjs +0 -507
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-A7PIMZGU.js +0 -263
- package/dist/chunk-ATSKSYVE.cjs +0 -51683
- package/dist/chunk-B5TCIAPQ.cjs +0 -117
- package/dist/chunk-BF2235SI.cjs +0 -5714
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BND3ST2K.cjs +0 -662
- package/dist/chunk-BU7VWW2K.js +0 -2522
- package/dist/chunk-BWFJEM5A.js +0 -5419
- package/dist/chunk-CAUCGUEA.cjs +0 -130
- package/dist/chunk-CBJSLA2E.cjs +0 -5423
- package/dist/chunk-CDPGV4DN.js +0 -114
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CS2EMTGF.js +0 -1966
- package/dist/chunk-DMG7C4H2.js +0 -975
- package/dist/chunk-DXJQDCFL.js +0 -468
- package/dist/chunk-E3FWRT3Z.js +0 -608
- package/dist/chunk-E3UALNFA.js +0 -421
- package/dist/chunk-EONILVMF.js +0 -762
- package/dist/chunk-EQV4R3EV.cjs +0 -769
- package/dist/chunk-F3HH56EB.cjs +0 -5538
- package/dist/chunk-F4IULT7N.js +0 -1488
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-FFKU7BTK.cjs +0 -1046
- package/dist/chunk-FHQVYCH2.js +0 -70
- package/dist/chunk-FSF7EQVA.cjs +0 -1974
- package/dist/chunk-G4VZTCIB.js +0 -659
- package/dist/chunk-G7CT3EMP.cjs +0 -1002
- package/dist/chunk-GGHSW2NN.js +0 -51334
- package/dist/chunk-GVUR45UF.cjs +0 -777
- package/dist/chunk-H5Z7NASB.js +0 -9662
- package/dist/chunk-HE7ULERA.cjs +0 -697
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HPS76H7Q.js +0 -309
- package/dist/chunk-HQUEA5R6.cjs +0 -424
- package/dist/chunk-HYNTS5CP.js +0 -422
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IBDG74G2.cjs +0 -1219
- package/dist/chunk-IFNQFCTM.js +0 -3098
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-IWI6J7FX.js +0 -421
- package/dist/chunk-K3JDKWGI.cjs +0 -270
- package/dist/chunk-K6EKD26I.js +0 -630
- package/dist/chunk-KCQ5NDYC.cjs +0 -3172
- package/dist/chunk-KED34ILP.js +0 -832
- package/dist/chunk-KSGXLT74.cjs +0 -457
- package/dist/chunk-L4G4RLXX.js +0 -767
- package/dist/chunk-LDP5OK6G.js +0 -1216
- package/dist/chunk-LGGRPKTV.cjs +0 -735
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-LSW7P7ML.js +0 -3675
- package/dist/chunk-LXJ4667L.cjs +0 -3874
- package/dist/chunk-LZ266PCM.cjs +0 -4499
- package/dist/chunk-MD6KDHVE.cjs +0 -237
- package/dist/chunk-MEASWI2Y.js +0 -126
- package/dist/chunk-MPXBVFHQ.js +0 -768
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUKG4SK.cjs +0 -3075
- package/dist/chunk-NDQNIJEH.js +0 -1715
- package/dist/chunk-NOZZ46QU.js +0 -168
- package/dist/chunk-OFKWH2IP.js +0 -449
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PMGODDJA.cjs +0 -319
- package/dist/chunk-Q4QX3AET.cjs +0 -1505
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-Q5JT3YML.cjs +0 -129
- package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
- package/dist/chunk-QGKNANZ3.js +0 -3071
- package/dist/chunk-QLEAOI3Q.cjs +0 -424
- package/dist/chunk-R7MA7QWV.js +0 -732
- package/dist/chunk-RVYPEYPX.js +0 -678
- package/dist/chunk-S2N5TNMA.js +0 -1855
- package/dist/chunk-S565K7NK.js +0 -752
- package/dist/chunk-SDAMZIRE.js +0 -765
- package/dist/chunk-T36DDXSF.js +0 -4250
- package/dist/chunk-T4NKMBDL.js +0 -5474
- package/dist/chunk-T7LEXZUZ.cjs +0 -2526
- package/dist/chunk-TEWCN33Y.js +0 -694
- package/dist/chunk-TQSZUOW5.cjs +0 -793
- package/dist/chunk-TSH3MSQU.cjs +0 -129
- package/dist/chunk-UERJ3YJV.js +0 -504
- package/dist/chunk-UPJBDCVF.js +0 -1395
- package/dist/chunk-V3NN3HPP.js +0 -4462
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-WB4Z63GG.js +0 -229
- package/dist/chunk-WDW67DZB.cjs +0 -9728
- package/dist/chunk-WGMEAYBG.js +0 -126
- package/dist/chunk-X4ZF6CNE.cjs +0 -473
- package/dist/chunk-X6SEAXAX.cjs +0 -3681
- package/dist/chunk-XCWFGZAA.js +0 -1043
- package/dist/chunk-XD6IYDUX.js +0 -903
- package/dist/chunk-XG23EUQX.cjs +0 -1717
- package/dist/chunk-XRKWN5PL.cjs +0 -173
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-XUTX5CBW.js +0 -126
- package/dist/chunk-XWPNTWDN.cjs +0 -755
- package/dist/chunk-XXINBTZK.cjs +0 -633
- package/dist/chunk-YCXFCXDS.js +0 -1868
- package/dist/chunk-YQK5JNFK.js +0 -3725
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-Z34RLXRA.cjs +0 -612
- package/dist/chunk-ZP4D3CSX.cjs +0 -72
- package/dist/cli/holoscript-runner.cjs +0 -2259
- package/dist/cli/holoscript-runner.js +0 -2234
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -28
- package/dist/compiler/agent-inference.js +0 -5
- package/dist/compiler/android-xr.cjs +0 -19
- package/dist/compiler/android-xr.js +0 -9
- package/dist/compiler/android.cjs +0 -20
- package/dist/compiler/android.js +0 -10
- package/dist/compiler/ar.cjs +0 -20
- package/dist/compiler/ar.js +0 -8
- package/dist/compiler/babylon.cjs +0 -17
- package/dist/compiler/babylon.js +0 -11
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -602
- package/dist/compiler/domain-block-utils.js +0 -8
- package/dist/compiler/dtdl.cjs +0 -24
- package/dist/compiler/dtdl.js +0 -8
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -15
- package/dist/compiler/godot.js +0 -9
- package/dist/compiler/incremental.cjs +0 -29
- package/dist/compiler/incremental.js +0 -4
- package/dist/compiler/index.cjs +0 -2578
- package/dist/compiler/index.js +0 -2383
- package/dist/compiler/ios.cjs +0 -20
- package/dist/compiler/ios.js +0 -10
- package/dist/compiler/multi-layer.cjs +0 -20
- package/dist/compiler/multi-layer.js +0 -11
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -15
- package/dist/compiler/openxr.js +0 -9
- package/dist/compiler/playcanvas.cjs +0 -16
- package/dist/compiler/playcanvas.js +0 -10
- package/dist/compiler/r3f.cjs +0 -34
- package/dist/compiler/r3f.js +0 -12
- package/dist/compiler/remotion.cjs +0 -23
- package/dist/compiler/remotion.js +0 -4
- package/dist/compiler/reproducibility.cjs +0 -39
- package/dist/compiler/reproducibility.js +0 -4
- package/dist/compiler/sdf.cjs +0 -21
- package/dist/compiler/sdf.js +0 -9
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -17
- package/dist/compiler/state.js +0 -7
- package/dist/compiler/trait-composition.cjs +0 -26
- package/dist/compiler/trait-composition.js +0 -5
- package/dist/compiler/unity.cjs +0 -15
- package/dist/compiler/unity.js +0 -9
- package/dist/compiler/unreal.cjs +0 -19
- package/dist/compiler/unreal.js +0 -9
- package/dist/compiler/urdf.cjs +0 -45
- package/dist/compiler/urdf.js +0 -9
- package/dist/compiler/usd-physics.cjs +0 -23
- package/dist/compiler/usd-physics.js +0 -6
- package/dist/compiler/visionos.cjs +0 -15
- package/dist/compiler/visionos.js +0 -9
- package/dist/compiler/vrchat.cjs +0 -19
- package/dist/compiler/vrchat.js +0 -9
- package/dist/compiler/vrr.cjs +0 -21
- package/dist/compiler/vrr.js +0 -9
- package/dist/compiler/wasm.cjs +0 -33
- package/dist/compiler/wasm.js +0 -9
- package/dist/compiler/webgpu.cjs +0 -15
- package/dist/compiler/webgpu.js +0 -9
- package/dist/debugger.cjs +0 -21
- package/dist/debugger.js +0 -8
- package/dist/entries/interop.cjs +0 -62
- package/dist/entries/interop.js +0 -5
- package/dist/entries/scripting.cjs +0 -68
- package/dist/entries/scripting.js +0 -11
- package/dist/index.cjs +0 -40921
- package/dist/index.js +0 -37763
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
- package/dist/ml-dsa-WYLJHJO6.js +0 -1178
- package/dist/parser.cjs +0 -27
- package/dist/parser.js +0 -10
- package/dist/playwright-5OSAPTNH.js +0 -98660
- package/dist/playwright-RL6GY4F7.cjs +0 -98673
- package/dist/runtime.cjs +0 -16
- package/dist/runtime.js +0 -7
- package/dist/storage/index.cjs +0 -37
- package/dist/storage/index.js +0 -4
- package/dist/traits/index.cjs +0 -14649
- package/dist/traits/index.js +0 -12243
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
package/dist/chunk-5OEOHAAW.cjs
DELETED
|
@@ -1,682 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkLXJ4667L_cjs = require('./chunk-LXJ4667L.cjs');
|
|
4
|
-
var chunkBF2235SI_cjs = require('./chunk-BF2235SI.cjs');
|
|
5
|
-
var chunk3SAK5KFL_cjs = require('./chunk-3SAK5KFL.cjs');
|
|
6
|
-
var platform = require('@holoscript/platform');
|
|
7
|
-
|
|
8
|
-
// src/compiler/UnrealCompiler.ts
|
|
9
|
-
var UnrealCompiler_exports = {};
|
|
10
|
-
chunk3SAK5KFL_cjs.__export(UnrealCompiler_exports, {
|
|
11
|
-
UnrealCompiler: () => exports.UnrealCompiler,
|
|
12
|
-
compileToUnreal: () => compileToUnreal
|
|
13
|
-
});
|
|
14
|
-
function compileToUnreal(composition, options) {
|
|
15
|
-
const compiler = new exports.UnrealCompiler(options);
|
|
16
|
-
return compiler.compile(composition, chunkBF2235SI_cjs.createTestCompilerToken());
|
|
17
|
-
}
|
|
18
|
-
exports.UnrealCompiler = void 0;
|
|
19
|
-
var init_UnrealCompiler = chunk3SAK5KFL_cjs.__esm({
|
|
20
|
-
"src/compiler/UnrealCompiler.ts"() {
|
|
21
|
-
chunkBF2235SI_cjs.init_CompilerBase();
|
|
22
|
-
chunkLXJ4667L_cjs.init_DomainBlockCompilerMixin();
|
|
23
|
-
exports.UnrealCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
|
|
24
|
-
constructor(options = {}) {
|
|
25
|
-
super();
|
|
26
|
-
this.compilerName = "UnrealCompiler";
|
|
27
|
-
this.headerLines = [];
|
|
28
|
-
this.sourceLines = [];
|
|
29
|
-
this.indentLevel = 0;
|
|
30
|
-
this.currentFile = "header";
|
|
31
|
-
this.options = {
|
|
32
|
-
moduleName: options.moduleName || "HoloWorld",
|
|
33
|
-
className: options.className || "AGeneratedScene",
|
|
34
|
-
indent: options.indent || " ",
|
|
35
|
-
engineVersion: options.engineVersion || "5.4",
|
|
36
|
-
useEnhancedInput: options.useEnhancedInput ?? true,
|
|
37
|
-
generateBlueprints: options.generateBlueprints ?? false
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
getRequiredCapability() {
|
|
41
|
-
return platform.ANSCapabilityPath.UNREAL;
|
|
42
|
-
}
|
|
43
|
-
compile(composition, agentToken, outputPath) {
|
|
44
|
-
this.validateCompilerAccess(agentToken, outputPath);
|
|
45
|
-
this.headerLines = [];
|
|
46
|
-
this.sourceLines = [];
|
|
47
|
-
this.indentLevel = 0;
|
|
48
|
-
const headerFile = this.generateHeader(composition);
|
|
49
|
-
const sourceFile = this.generateSource(composition);
|
|
50
|
-
const result = {
|
|
51
|
-
headerFile,
|
|
52
|
-
sourceFile
|
|
53
|
-
};
|
|
54
|
-
if (this.options.generateBlueprints) {
|
|
55
|
-
result.blueprintJson = this.generateBlueprintJson(composition);
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
generateHeader(composition) {
|
|
60
|
-
this.headerLines = [];
|
|
61
|
-
this.currentFile = "header";
|
|
62
|
-
this.indentLevel = 0;
|
|
63
|
-
this.emitH("// Auto-generated by HoloScript UnrealCompiler");
|
|
64
|
-
this.emitH(
|
|
65
|
-
`// Source: composition "${this.escapeStringValue(composition.name, "TypeScript")}"`
|
|
66
|
-
);
|
|
67
|
-
this.emitH(`// Unreal Engine: ${this.options.engineVersion}`);
|
|
68
|
-
this.emitH("// Do not edit manually \u2014 regenerate from .holo source");
|
|
69
|
-
this.emitH("");
|
|
70
|
-
this.emitH("#pragma once");
|
|
71
|
-
this.emitH("");
|
|
72
|
-
this.emitH('#include "CoreMinimal.h"');
|
|
73
|
-
this.emitH('#include "GameFramework/Actor.h"');
|
|
74
|
-
this.emitH('#include "Components/StaticMeshComponent.h"');
|
|
75
|
-
this.emitH('#include "Components/PointLightComponent.h"');
|
|
76
|
-
this.emitH('#include "Components/SpotLightComponent.h"');
|
|
77
|
-
this.emitH('#include "Components/DirectionalLightComponent.h"');
|
|
78
|
-
this.emitH('#include "Components/AudioComponent.h"');
|
|
79
|
-
this.emitH('#include "Components/BoxComponent.h"');
|
|
80
|
-
this.emitH('#include "Components/SphereComponent.h"');
|
|
81
|
-
if (composition.objects?.some((o) => o.traits?.some((t) => t.name === "physics"))) {
|
|
82
|
-
this.emitH('#include "PhysicsEngine/PhysicsConstraintComponent.h"');
|
|
83
|
-
}
|
|
84
|
-
if (this.options.useEnhancedInput) {
|
|
85
|
-
this.emitH('#include "EnhancedInputComponent.h"');
|
|
86
|
-
this.emitH('#include "EnhancedInputSubsystems.h"');
|
|
87
|
-
}
|
|
88
|
-
this.emitH(`#include "${this.options.className.replace(/^A/, "")}.generated.h"`);
|
|
89
|
-
this.emitH("");
|
|
90
|
-
this.emitH("// Forward declarations");
|
|
91
|
-
this.emitH("class UNiagaraComponent;");
|
|
92
|
-
this.emitH("class UWidgetComponent;");
|
|
93
|
-
this.emitH("");
|
|
94
|
-
this.emitH("UCLASS(Blueprintable, BlueprintType)");
|
|
95
|
-
this.emitH(
|
|
96
|
-
`class ${this.options.moduleName.toUpperCase()}_API ${this.options.className} : public AActor`
|
|
97
|
-
);
|
|
98
|
-
this.emitH("{");
|
|
99
|
-
this.indentLevel++;
|
|
100
|
-
this.emitH("GENERATED_BODY()");
|
|
101
|
-
this.emitH("");
|
|
102
|
-
this.emitH("public:");
|
|
103
|
-
this.emitH(`${this.options.className}();`);
|
|
104
|
-
this.emitH("");
|
|
105
|
-
this.emitH("// === Scene Components ===");
|
|
106
|
-
this.emitH('UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "HoloScript")');
|
|
107
|
-
this.emitH("USceneComponent* RootSceneComponent;");
|
|
108
|
-
this.emitH("");
|
|
109
|
-
for (const obj of composition.objects || []) {
|
|
110
|
-
const varName = this.sanitizeName(obj.name);
|
|
111
|
-
const compType = this.getComponentType(obj);
|
|
112
|
-
this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Objects")`);
|
|
113
|
-
this.emitH(`${compType}* ${varName};`);
|
|
114
|
-
}
|
|
115
|
-
this.emitH("");
|
|
116
|
-
for (const light of composition.lights || []) {
|
|
117
|
-
const varName = this.sanitizeName(light.name);
|
|
118
|
-
const lightType = this.getLightComponentType(light.lightType);
|
|
119
|
-
this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lighting")`);
|
|
120
|
-
this.emitH(`${lightType}* ${varName};`);
|
|
121
|
-
}
|
|
122
|
-
this.emitH("");
|
|
123
|
-
for (const audio of composition.audio || []) {
|
|
124
|
-
const varName = this.sanitizeName(audio.name);
|
|
125
|
-
this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Audio")`);
|
|
126
|
-
this.emitH(`UAudioComponent* ${varName};`);
|
|
127
|
-
}
|
|
128
|
-
this.emitH("");
|
|
129
|
-
if (composition.state) {
|
|
130
|
-
this.emitH("// === State Properties ===");
|
|
131
|
-
for (const prop of composition.state.properties) {
|
|
132
|
-
const cppType = this.toCppType(prop.value);
|
|
133
|
-
this.emitH(`UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "State")`);
|
|
134
|
-
this.emitH(`${cppType} ${this.escapeStringValue(prop.key, "TypeScript")};`);
|
|
135
|
-
}
|
|
136
|
-
this.emitH("");
|
|
137
|
-
}
|
|
138
|
-
this.emitH("protected:");
|
|
139
|
-
this.emitH("virtual void BeginPlay() override;");
|
|
140
|
-
this.emitH("virtual void Tick(float DeltaTime) override;");
|
|
141
|
-
this.emitH(
|
|
142
|
-
"virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;"
|
|
143
|
-
);
|
|
144
|
-
this.emitH("");
|
|
145
|
-
this.emitH("public:");
|
|
146
|
-
this.emitH("// === Blueprint Callable Functions ===");
|
|
147
|
-
if (composition.logic?.actions) {
|
|
148
|
-
for (const action of composition.logic.actions) {
|
|
149
|
-
this.emitH(`UFUNCTION(BlueprintCallable, Category = "HoloScript")`);
|
|
150
|
-
this.emitH(`void ${this.sanitizeName(action.name)}();`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
this.emitH("");
|
|
154
|
-
for (const tl of composition.timelines || []) {
|
|
155
|
-
const name = this.sanitizeName(tl.name);
|
|
156
|
-
this.emitH(`UFUNCTION(BlueprintCallable, Category = "Timelines")`);
|
|
157
|
-
this.emitH(`void Play${name}();`);
|
|
158
|
-
}
|
|
159
|
-
this.emitH("");
|
|
160
|
-
for (const tr of composition.transitions || []) {
|
|
161
|
-
const name = this.sanitizeName(tr.name);
|
|
162
|
-
this.emitH(`UFUNCTION(BlueprintCallable, Category = "Transitions")`);
|
|
163
|
-
this.emitH(`void ${name}Transition();`);
|
|
164
|
-
}
|
|
165
|
-
if (composition.zones?.length) {
|
|
166
|
-
this.emitH("");
|
|
167
|
-
this.emitH("// === Zone Overlap Handlers ===");
|
|
168
|
-
for (const zone of composition.zones) {
|
|
169
|
-
const name = this.sanitizeName(zone.name);
|
|
170
|
-
this.emitH(`UFUNCTION()`);
|
|
171
|
-
this.emitH(
|
|
172
|
-
`void On${name}BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);`
|
|
173
|
-
);
|
|
174
|
-
this.emitH(`UFUNCTION()`);
|
|
175
|
-
this.emitH(
|
|
176
|
-
`void On${name}EndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);`
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
this.emitH("");
|
|
181
|
-
this.emitH("private:");
|
|
182
|
-
this.emitH("void SetupComponents();");
|
|
183
|
-
this.emitH("void SetupEnvironment();");
|
|
184
|
-
if (composition.zones?.length) {
|
|
185
|
-
this.emitH("void SetupZones();");
|
|
186
|
-
}
|
|
187
|
-
this.indentLevel--;
|
|
188
|
-
this.emitH("};");
|
|
189
|
-
return this.headerLines.join("\n");
|
|
190
|
-
}
|
|
191
|
-
generateSource(composition) {
|
|
192
|
-
this.sourceLines = [];
|
|
193
|
-
this.currentFile = "source";
|
|
194
|
-
this.indentLevel = 0;
|
|
195
|
-
const headerName = this.options.className.replace(/^A/, "");
|
|
196
|
-
this.emitS("// Auto-generated by HoloScript UnrealCompiler");
|
|
197
|
-
this.emitS(
|
|
198
|
-
`// Source: composition "${this.escapeStringValue(composition.name, "TypeScript")}"`
|
|
199
|
-
);
|
|
200
|
-
this.emitS("");
|
|
201
|
-
this.emitS(`#include "${headerName}.h"`);
|
|
202
|
-
this.emitS('#include "Net/UnrealNetwork.h"');
|
|
203
|
-
this.emitS('#include "Engine/StaticMesh.h"');
|
|
204
|
-
this.emitS('#include "Materials/MaterialInstanceDynamic.h"');
|
|
205
|
-
if (composition.audio?.length) {
|
|
206
|
-
this.emitS('#include "Sound/SoundBase.h"');
|
|
207
|
-
}
|
|
208
|
-
this.emitS("");
|
|
209
|
-
this.emitS(`${this.options.className}::${this.options.className}()`);
|
|
210
|
-
this.emitS("{");
|
|
211
|
-
this.indentLevel++;
|
|
212
|
-
this.emitS("PrimaryActorTick.bCanEverTick = true;");
|
|
213
|
-
this.emitS("bReplicates = true;");
|
|
214
|
-
this.emitS("");
|
|
215
|
-
this.emitS("// Root component");
|
|
216
|
-
this.emitS(
|
|
217
|
-
'RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));'
|
|
218
|
-
);
|
|
219
|
-
this.emitS("RootComponent = RootSceneComponent;");
|
|
220
|
-
this.emitS("");
|
|
221
|
-
this.emitS("SetupComponents();");
|
|
222
|
-
this.indentLevel--;
|
|
223
|
-
this.emitS("}");
|
|
224
|
-
this.emitS("");
|
|
225
|
-
this.emitS(`void ${this.options.className}::SetupComponents()`);
|
|
226
|
-
this.emitS("{");
|
|
227
|
-
this.indentLevel++;
|
|
228
|
-
for (const obj of composition.objects || []) {
|
|
229
|
-
this.compileObjectSetup(obj);
|
|
230
|
-
}
|
|
231
|
-
for (const light of composition.lights || []) {
|
|
232
|
-
this.compileLightSetup(light);
|
|
233
|
-
}
|
|
234
|
-
for (const audio of composition.audio || []) {
|
|
235
|
-
this.compileAudioSetup(audio);
|
|
236
|
-
}
|
|
237
|
-
this.compileUnrealDomainBlocks(composition);
|
|
238
|
-
this.indentLevel--;
|
|
239
|
-
this.emitS("}");
|
|
240
|
-
this.emitS("");
|
|
241
|
-
this.emitS(`void ${this.options.className}::SetupEnvironment()`);
|
|
242
|
-
this.emitS("{");
|
|
243
|
-
this.indentLevel++;
|
|
244
|
-
if (composition.environment) {
|
|
245
|
-
this.compileEnvironment(composition.environment);
|
|
246
|
-
} else {
|
|
247
|
-
this.emitS("// No environment configuration");
|
|
248
|
-
}
|
|
249
|
-
this.indentLevel--;
|
|
250
|
-
this.emitS("}");
|
|
251
|
-
this.emitS("");
|
|
252
|
-
if (composition.zones?.length) {
|
|
253
|
-
this.emitS(`void ${this.options.className}::SetupZones()`);
|
|
254
|
-
this.emitS("{");
|
|
255
|
-
this.indentLevel++;
|
|
256
|
-
for (const zone of composition.zones) {
|
|
257
|
-
this.compileZoneSetup(zone);
|
|
258
|
-
}
|
|
259
|
-
this.indentLevel--;
|
|
260
|
-
this.emitS("}");
|
|
261
|
-
this.emitS("");
|
|
262
|
-
for (const zone of composition.zones) {
|
|
263
|
-
this.compileZoneHandlers(zone);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
this.emitS(`void ${this.options.className}::BeginPlay()`);
|
|
267
|
-
this.emitS("{");
|
|
268
|
-
this.indentLevel++;
|
|
269
|
-
this.emitS("Super::BeginPlay();");
|
|
270
|
-
this.emitS("");
|
|
271
|
-
this.emitS("SetupEnvironment();");
|
|
272
|
-
if (composition.zones?.length) {
|
|
273
|
-
this.emitS("SetupZones();");
|
|
274
|
-
}
|
|
275
|
-
this.emitS("");
|
|
276
|
-
this.emitS(
|
|
277
|
-
`UE_LOG(LogTemp, Log, TEXT("HoloScript scene '${this.escapeStringValue(composition.name, "TypeScript")}' initialized"));`
|
|
278
|
-
);
|
|
279
|
-
for (const tl of composition.timelines || []) {
|
|
280
|
-
if (tl.autoplay) {
|
|
281
|
-
this.emitS(`Play${this.sanitizeName(tl.name)}();`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
this.indentLevel--;
|
|
285
|
-
this.emitS("}");
|
|
286
|
-
this.emitS("");
|
|
287
|
-
this.emitS(`void ${this.options.className}::Tick(float DeltaTime)`);
|
|
288
|
-
this.emitS("{");
|
|
289
|
-
this.indentLevel++;
|
|
290
|
-
this.emitS("Super::Tick(DeltaTime);");
|
|
291
|
-
this.indentLevel--;
|
|
292
|
-
this.emitS("}");
|
|
293
|
-
this.emitS("");
|
|
294
|
-
this.emitS(
|
|
295
|
-
`void ${this.options.className}::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const`
|
|
296
|
-
);
|
|
297
|
-
this.emitS("{");
|
|
298
|
-
this.indentLevel++;
|
|
299
|
-
this.emitS("Super::GetLifetimeReplicatedProps(OutLifetimeProps);");
|
|
300
|
-
if (composition.state) {
|
|
301
|
-
this.emitS("");
|
|
302
|
-
for (const prop of composition.state.properties) {
|
|
303
|
-
this.emitS(
|
|
304
|
-
`DOREPLIFETIME(${this.options.className}, ${this.escapeStringValue(prop.key, "TypeScript")});`
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
this.indentLevel--;
|
|
309
|
-
this.emitS("}");
|
|
310
|
-
this.emitS("");
|
|
311
|
-
for (const tl of composition.timelines || []) {
|
|
312
|
-
this.compileTimelineFunction(tl);
|
|
313
|
-
}
|
|
314
|
-
for (const tr of composition.transitions || []) {
|
|
315
|
-
this.compileTransitionFunction(tr);
|
|
316
|
-
}
|
|
317
|
-
if (composition.logic?.actions) {
|
|
318
|
-
for (const action of composition.logic.actions) {
|
|
319
|
-
this.compileActionFunction(action);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return this.sourceLines.join("\n");
|
|
323
|
-
}
|
|
324
|
-
compileObjectSetup(obj) {
|
|
325
|
-
const varName = this.sanitizeName(obj.name);
|
|
326
|
-
const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
|
|
327
|
-
const isModel = !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src");
|
|
328
|
-
this.emitS(`// Object: ${this.escapeStringValue(obj.name, "TypeScript")}`);
|
|
329
|
-
this.emitS(
|
|
330
|
-
`${varName} = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("${this.escapeStringValue(obj.name, "TypeScript")}"));`
|
|
331
|
-
);
|
|
332
|
-
this.emitS(`${varName}->SetupAttachment(RootComponent);`);
|
|
333
|
-
if (!isModel) {
|
|
334
|
-
const meshPath = this.getMeshPath(meshType);
|
|
335
|
-
if (meshPath) {
|
|
336
|
-
this.emitS(
|
|
337
|
-
`static ConstructorHelpers::FObjectFinder<UStaticMesh> ${varName}MeshAsset(TEXT("${meshPath}"));`
|
|
338
|
-
);
|
|
339
|
-
this.emitS(
|
|
340
|
-
`if (${varName}MeshAsset.Succeeded()) { ${varName}->SetStaticMesh(${varName}MeshAsset.Object); }`
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
const pos = this.findObjProp(obj, "position");
|
|
345
|
-
if (pos && Array.isArray(pos)) {
|
|
346
|
-
this.emitS(
|
|
347
|
-
`${varName}->SetRelativeLocation(FVector(${pos[0] * 100}f, ${pos[2] * 100}f, ${pos[1] * 100}f));`
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
const rot = this.findObjProp(obj, "rotation");
|
|
351
|
-
if (rot && Array.isArray(rot)) {
|
|
352
|
-
this.emitS(`${varName}->SetRelativeRotation(FRotator(${rot[0]}f, ${rot[1]}f, ${rot[2]}f));`);
|
|
353
|
-
}
|
|
354
|
-
const scale = this.findObjProp(obj, "scale");
|
|
355
|
-
if (scale) {
|
|
356
|
-
if (Array.isArray(scale)) {
|
|
357
|
-
this.emitS(
|
|
358
|
-
`${varName}->SetRelativeScale3D(FVector(${scale[0]}f, ${scale[1]}f, ${scale[2]}f));`
|
|
359
|
-
);
|
|
360
|
-
} else {
|
|
361
|
-
this.emitS(`${varName}->SetRelativeScale3D(FVector(${scale}f));`);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (obj.traits) {
|
|
365
|
-
for (const trait of obj.traits) {
|
|
366
|
-
this.compileTraitSetup(varName, trait);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
this.emitS("");
|
|
370
|
-
}
|
|
371
|
-
compileTraitSetup(varName, trait) {
|
|
372
|
-
switch (trait.name) {
|
|
373
|
-
case "physics":
|
|
374
|
-
this.emitS(`${varName}->SetSimulatePhysics(true);`);
|
|
375
|
-
if (trait.config?.mass) {
|
|
376
|
-
this.emitS(`${varName}->SetMassOverrideInKg(NAME_None, ${trait.config.mass}f, true);`);
|
|
377
|
-
}
|
|
378
|
-
break;
|
|
379
|
-
case "collidable":
|
|
380
|
-
this.emitS(`${varName}->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);`);
|
|
381
|
-
this.emitS(`${varName}->SetCollisionResponseToAllChannels(ECR_Block);`);
|
|
382
|
-
break;
|
|
383
|
-
case "grabbable":
|
|
384
|
-
this.emitS(`// @grabbable \u2014 implement via GrabComponent or VR interaction framework`);
|
|
385
|
-
break;
|
|
386
|
-
case "pointable":
|
|
387
|
-
case "hoverable":
|
|
388
|
-
this.emitS(
|
|
389
|
-
`// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 implement via line trace interaction`
|
|
390
|
-
);
|
|
391
|
-
break;
|
|
392
|
-
case "portal":
|
|
393
|
-
this.emitS(`// @portal \u2014 destination: "${trait.config?.destination || "unknown"}"`);
|
|
394
|
-
break;
|
|
395
|
-
case "emissive":
|
|
396
|
-
case "glowing":
|
|
397
|
-
this.emitS(
|
|
398
|
-
`// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 apply emissive material`
|
|
399
|
-
);
|
|
400
|
-
break;
|
|
401
|
-
case "transparent":
|
|
402
|
-
this.emitS(`// @transparent \u2014 set material blend mode`);
|
|
403
|
-
break;
|
|
404
|
-
default:
|
|
405
|
-
this.emitS(
|
|
406
|
-
`// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 custom trait implementation required`
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
compileLightSetup(light) {
|
|
411
|
-
const varName = this.sanitizeName(light.name);
|
|
412
|
-
const lightType = this.getLightComponentType(light.lightType);
|
|
413
|
-
this.emitS(`// Light: ${this.escapeStringValue(light.name, "TypeScript")}`);
|
|
414
|
-
this.emitS(
|
|
415
|
-
`${varName} = CreateDefaultSubobject<${lightType}>(TEXT("${this.escapeStringValue(light.name, "TypeScript")}"));`
|
|
416
|
-
);
|
|
417
|
-
this.emitS(`${varName}->SetupAttachment(RootComponent);`);
|
|
418
|
-
for (const prop of light.properties) {
|
|
419
|
-
if (prop.key === "color") {
|
|
420
|
-
this.emitS(`${varName}->SetLightColor(${this.toLinearColor(prop.value)});`);
|
|
421
|
-
} else if (prop.key === "intensity") {
|
|
422
|
-
const intensity = prop.value * 1e4;
|
|
423
|
-
this.emitS(`${varName}->SetIntensity(${intensity}f);`);
|
|
424
|
-
} else if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
425
|
-
const pos = prop.value;
|
|
426
|
-
this.emitS(
|
|
427
|
-
`${varName}->SetRelativeLocation(FVector(${pos[0] * 100}f, ${pos[2] * 100}f, ${pos[1] * 100}f));`
|
|
428
|
-
);
|
|
429
|
-
} else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
|
|
430
|
-
this.emitS(`${varName}->SetCastShadows(${prop.value ? "true" : "false"});`);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
this.emitS("");
|
|
434
|
-
}
|
|
435
|
-
compileAudioSetup(audio) {
|
|
436
|
-
const varName = this.sanitizeName(audio.name);
|
|
437
|
-
this.emitS(`// Audio: ${this.escapeStringValue(audio.name, "TypeScript")}`);
|
|
438
|
-
this.emitS(
|
|
439
|
-
`${varName} = CreateDefaultSubobject<UAudioComponent>(TEXT("${this.escapeStringValue(audio.name, "TypeScript")}"));`
|
|
440
|
-
);
|
|
441
|
-
this.emitS(`${varName}->SetupAttachment(RootComponent);`);
|
|
442
|
-
this.emitS(`${varName}->bAutoActivate = false;`);
|
|
443
|
-
this.emitS("");
|
|
444
|
-
}
|
|
445
|
-
compileEnvironment(env) {
|
|
446
|
-
for (const prop of env.properties) {
|
|
447
|
-
if (prop.key === "skybox" || prop.key === "preset") {
|
|
448
|
-
this.emitS(
|
|
449
|
-
`// Environment preset: "${prop.value}" \u2014 configure via BP_Sky_Sphere or SkyAtmosphere`
|
|
450
|
-
);
|
|
451
|
-
} else if (prop.key === "fog" && typeof prop.value === "object") {
|
|
452
|
-
this.emitS("// Fog settings \u2014 configure via ExponentialHeightFog actor");
|
|
453
|
-
} else if (prop.key === "ambient_light") {
|
|
454
|
-
this.emitS(`// Ambient light: ${prop.value} \u2014 configure via SkyLight`);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
compileZoneSetup(zone) {
|
|
459
|
-
const varName = this.sanitizeName(zone.name);
|
|
460
|
-
this.emitS(
|
|
461
|
-
`// Zone: ${this.escapeStringValue(zone.name, "TypeScript")} \u2014 bind overlap events`
|
|
462
|
-
);
|
|
463
|
-
this.emitS(
|
|
464
|
-
`// ${varName}Trigger->OnComponentBeginOverlap.AddDynamic(this, &${this.options.className}::On${varName}BeginOverlap);`
|
|
465
|
-
);
|
|
466
|
-
this.emitS(
|
|
467
|
-
`// ${varName}Trigger->OnComponentEndOverlap.AddDynamic(this, &${this.options.className}::On${varName}EndOverlap);`
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
compileZoneHandlers(zone) {
|
|
471
|
-
const varName = this.sanitizeName(zone.name);
|
|
472
|
-
this.emitS(
|
|
473
|
-
`void ${this.options.className}::On${varName}BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)`
|
|
474
|
-
);
|
|
475
|
-
this.emitS("{");
|
|
476
|
-
this.indentLevel++;
|
|
477
|
-
this.emitS(
|
|
478
|
-
`UE_LOG(LogTemp, Log, TEXT("Actor entered zone: ${this.escapeStringValue(zone.name, "TypeScript")}"));`
|
|
479
|
-
);
|
|
480
|
-
this.indentLevel--;
|
|
481
|
-
this.emitS("}");
|
|
482
|
-
this.emitS("");
|
|
483
|
-
this.emitS(
|
|
484
|
-
`void ${this.options.className}::On${varName}EndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)`
|
|
485
|
-
);
|
|
486
|
-
this.emitS("{");
|
|
487
|
-
this.indentLevel++;
|
|
488
|
-
this.emitS(
|
|
489
|
-
`UE_LOG(LogTemp, Log, TEXT("Actor exited zone: ${this.escapeStringValue(zone.name, "TypeScript")}"));`
|
|
490
|
-
);
|
|
491
|
-
this.indentLevel--;
|
|
492
|
-
this.emitS("}");
|
|
493
|
-
this.emitS("");
|
|
494
|
-
}
|
|
495
|
-
compileTimelineFunction(timeline) {
|
|
496
|
-
const name = this.sanitizeName(timeline.name);
|
|
497
|
-
this.emitS(`void ${this.options.className}::Play${name}()`);
|
|
498
|
-
this.emitS("{");
|
|
499
|
-
this.indentLevel++;
|
|
500
|
-
this.emitS(
|
|
501
|
-
`UE_LOG(LogTemp, Log, TEXT("Playing timeline: ${this.escapeStringValue(timeline.name, "TypeScript")}"));`
|
|
502
|
-
);
|
|
503
|
-
this.emitS("// Timeline implementation via FTimeline or native Sequencer");
|
|
504
|
-
for (const entry of timeline.entries) {
|
|
505
|
-
this.emitS(`// At ${entry.time}s: ${entry.action.kind}`);
|
|
506
|
-
}
|
|
507
|
-
this.indentLevel--;
|
|
508
|
-
this.emitS("}");
|
|
509
|
-
this.emitS("");
|
|
510
|
-
}
|
|
511
|
-
compileTransitionFunction(transition) {
|
|
512
|
-
const name = this.sanitizeName(transition.name);
|
|
513
|
-
this.emitS(`void ${this.options.className}::${name}Transition()`);
|
|
514
|
-
this.emitS("{");
|
|
515
|
-
this.indentLevel++;
|
|
516
|
-
const dest = transition.properties.find((p) => p.key === "destination" || p.key === "to");
|
|
517
|
-
if (dest) {
|
|
518
|
-
this.emitS(`UE_LOG(LogTemp, Log, TEXT("Transitioning to: ${dest.value}"));`);
|
|
519
|
-
this.emitS(`UGameplayStatics::OpenLevel(this, TEXT("${dest.value}"));`);
|
|
520
|
-
}
|
|
521
|
-
this.indentLevel--;
|
|
522
|
-
this.emitS("}");
|
|
523
|
-
this.emitS("");
|
|
524
|
-
}
|
|
525
|
-
compileActionFunction(action) {
|
|
526
|
-
const name = this.sanitizeName(action.name);
|
|
527
|
-
this.emitS(`void ${this.options.className}::${name}()`);
|
|
528
|
-
this.emitS("{");
|
|
529
|
-
this.indentLevel++;
|
|
530
|
-
this.emitS(
|
|
531
|
-
`UE_LOG(LogTemp, Log, TEXT("Action: ${this.escapeStringValue(action.name, "TypeScript")}"));`
|
|
532
|
-
);
|
|
533
|
-
this.emitS("// Action implementation");
|
|
534
|
-
this.indentLevel--;
|
|
535
|
-
this.emitS("}");
|
|
536
|
-
this.emitS("");
|
|
537
|
-
}
|
|
538
|
-
generateBlueprintJson(composition) {
|
|
539
|
-
return JSON.stringify(
|
|
540
|
-
{
|
|
541
|
-
type: "Blueprint",
|
|
542
|
-
class: this.options.className,
|
|
543
|
-
composition: composition.name,
|
|
544
|
-
objects: composition.objects?.map((o) => ({
|
|
545
|
-
name: o.name,
|
|
546
|
-
traits: o.traits?.map((t) => t.name) || []
|
|
547
|
-
})) || []
|
|
548
|
-
},
|
|
549
|
-
null,
|
|
550
|
-
2
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
// === Utility Methods ===
|
|
554
|
-
emitH(line) {
|
|
555
|
-
const indent = this.options.indent.repeat(this.indentLevel);
|
|
556
|
-
this.headerLines.push(indent + line);
|
|
557
|
-
}
|
|
558
|
-
emitS(line) {
|
|
559
|
-
const indent = this.options.indent.repeat(this.indentLevel);
|
|
560
|
-
this.sourceLines.push(indent + line);
|
|
561
|
-
}
|
|
562
|
-
sanitizeName(name) {
|
|
563
|
-
return name.replace(/[^a-zA-Z0-9_]/g, "_").replace(/^[0-9]/, "_$&");
|
|
564
|
-
}
|
|
565
|
-
getComponentType(obj) {
|
|
566
|
-
const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type");
|
|
567
|
-
if (meshType === "text") return "UTextRenderComponent";
|
|
568
|
-
return "UStaticMeshComponent";
|
|
569
|
-
}
|
|
570
|
-
getLightComponentType(lightType) {
|
|
571
|
-
const typeMap = {
|
|
572
|
-
directional: "UDirectionalLightComponent",
|
|
573
|
-
point: "UPointLightComponent",
|
|
574
|
-
spot: "USpotLightComponent",
|
|
575
|
-
area: "URectLightComponent"
|
|
576
|
-
};
|
|
577
|
-
return typeMap[lightType] || "UPointLightComponent";
|
|
578
|
-
}
|
|
579
|
-
getMeshPath(meshType) {
|
|
580
|
-
const meshPaths = {
|
|
581
|
-
cube: "/Engine/BasicShapes/Cube.Cube",
|
|
582
|
-
box: "/Engine/BasicShapes/Cube.Cube",
|
|
583
|
-
sphere: "/Engine/BasicShapes/Sphere.Sphere",
|
|
584
|
-
cylinder: "/Engine/BasicShapes/Cylinder.Cylinder",
|
|
585
|
-
cone: "/Engine/BasicShapes/Cone.Cone",
|
|
586
|
-
plane: "/Engine/BasicShapes/Plane.Plane"
|
|
587
|
-
};
|
|
588
|
-
return meshPaths[meshType] || null;
|
|
589
|
-
}
|
|
590
|
-
findObjProp(obj, key) {
|
|
591
|
-
return obj.properties?.find((p) => p.key === key)?.value;
|
|
592
|
-
}
|
|
593
|
-
toCppType(value) {
|
|
594
|
-
if (value === null) return "UObject*";
|
|
595
|
-
if (typeof value === "boolean") return "bool";
|
|
596
|
-
if (typeof value === "number") return Number.isInteger(value) ? "int32" : "float";
|
|
597
|
-
if (typeof value === "string") return "FString";
|
|
598
|
-
if (Array.isArray(value)) {
|
|
599
|
-
if (value.length === 3 && value.every((v) => typeof v === "number")) return "FVector";
|
|
600
|
-
if (value.length === 4 && value.every((v) => typeof v === "number")) return "FQuat";
|
|
601
|
-
return "TArray<float>";
|
|
602
|
-
}
|
|
603
|
-
return "UObject*";
|
|
604
|
-
}
|
|
605
|
-
compileUnrealDomainBlocks(composition) {
|
|
606
|
-
const domainBlocks = composition.domainBlocks ?? [];
|
|
607
|
-
if (domainBlocks.length === 0) return;
|
|
608
|
-
this.emitS("");
|
|
609
|
-
this.emitS("// === v4.2 Domain Blocks ===");
|
|
610
|
-
let blockIdx = 0;
|
|
611
|
-
const compiled = chunkLXJ4667L_cjs.compileDomainBlocks(
|
|
612
|
-
domainBlocks,
|
|
613
|
-
{
|
|
614
|
-
material: (block) => {
|
|
615
|
-
const mat = chunkLXJ4667L_cjs.compileMaterialBlock(block);
|
|
616
|
-
return chunkLXJ4667L_cjs.materialToUnreal(mat, `DB${blockIdx++}`);
|
|
617
|
-
},
|
|
618
|
-
physics: (block) => {
|
|
619
|
-
const phys = chunkLXJ4667L_cjs.compilePhysicsBlock(block);
|
|
620
|
-
return chunkLXJ4667L_cjs.physicsToUnreal(phys, `DB${blockIdx++}`);
|
|
621
|
-
},
|
|
622
|
-
vfx: (block) => {
|
|
623
|
-
const ps = chunkLXJ4667L_cjs.compileParticleBlock(block);
|
|
624
|
-
return chunkLXJ4667L_cjs.particlesToUnreal(ps, `DB${blockIdx++}`);
|
|
625
|
-
},
|
|
626
|
-
postfx: (block) => {
|
|
627
|
-
const pp = chunkLXJ4667L_cjs.compilePostProcessingBlock(block);
|
|
628
|
-
return chunkLXJ4667L_cjs.postProcessingToUnreal(pp, `DB${blockIdx++}`);
|
|
629
|
-
},
|
|
630
|
-
audio: (block) => {
|
|
631
|
-
const audio = chunkLXJ4667L_cjs.compileAudioSourceBlock(block);
|
|
632
|
-
return chunkLXJ4667L_cjs.audioSourceToUnreal(audio, `DB${blockIdx++}`);
|
|
633
|
-
},
|
|
634
|
-
weather: (block) => {
|
|
635
|
-
const weather = chunkLXJ4667L_cjs.compileWeatherBlock(block);
|
|
636
|
-
return chunkLXJ4667L_cjs.weatherToUnreal(weather);
|
|
637
|
-
}
|
|
638
|
-
},
|
|
639
|
-
(block) => `// Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "TypeScript")}"`
|
|
640
|
-
);
|
|
641
|
-
for (const line of compiled) {
|
|
642
|
-
for (const l of line.split("\n")) {
|
|
643
|
-
this.emitS(l);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
toLinearColor(value) {
|
|
648
|
-
if (typeof value === "string") {
|
|
649
|
-
if (value.startsWith("#")) {
|
|
650
|
-
const hex = value.slice(1);
|
|
651
|
-
if (hex.length === 6) {
|
|
652
|
-
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
653
|
-
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
654
|
-
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
655
|
-
return `FLinearColor(${r}f, ${g}f, ${b}f)`;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
const colors = {
|
|
659
|
-
red: "FLinearColor::Red",
|
|
660
|
-
green: "FLinearColor::Green",
|
|
661
|
-
blue: "FLinearColor::Blue",
|
|
662
|
-
white: "FLinearColor::White",
|
|
663
|
-
black: "FLinearColor::Black",
|
|
664
|
-
yellow: "FLinearColor::Yellow"
|
|
665
|
-
};
|
|
666
|
-
return colors[value.toLowerCase()] || "FLinearColor::White";
|
|
667
|
-
}
|
|
668
|
-
if (Array.isArray(value) && value.length >= 3) {
|
|
669
|
-
const [r, g, b, a = 1] = value;
|
|
670
|
-
return `FLinearColor(${r}f, ${g}f, ${b}f, ${a}f)`;
|
|
671
|
-
}
|
|
672
|
-
return "FLinearColor::White";
|
|
673
|
-
}
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
exports.UnrealCompiler_exports = UnrealCompiler_exports;
|
|
679
|
-
exports.compileToUnreal = compileToUnreal;
|
|
680
|
-
exports.init_UnrealCompiler = init_UnrealCompiler;
|
|
681
|
-
//# sourceMappingURL=chunk-5OEOHAAW.cjs.map
|
|
682
|
-
//# sourceMappingURL=chunk-5OEOHAAW.cjs.map
|