@holoscript/core 7.0.0 → 8.0.1
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/README.md +4 -4
- package/bin/holoscript.cjs +3 -0
- package/dist/GLTFPipeline-N6B6PJ6G.cjs +38 -0
- package/dist/GLTFPipeline-P3WMNYCN.js +17 -0
- package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
- package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
- package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
- package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
- package/dist/HoloScriptRuntime-CBYJX3LZ.js +10 -0
- package/dist/HoloScriptRuntime-VJ374RER.cjs +19 -0
- package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
- package/dist/USDZExporter-D2HQLQYK.js +1035 -0
- package/dist/agents/index.cjs +19 -0
- package/dist/agents/index.d.ts +100 -0
- package/dist/agents/index.js +17 -0
- package/dist/chunk-2BSMSUCE.js +1941 -0
- package/dist/chunk-2IWC4FP7.cjs +1189 -0
- package/dist/chunk-2M2DPHKB.js +762 -0
- package/dist/chunk-2X7NGX3M.js +2426 -0
- package/dist/chunk-2YSNA2F2.cjs +1274 -0
- package/dist/chunk-3FOKASKO.cjs +348 -0
- package/dist/chunk-3WZEJHUQ.cjs +116 -0
- package/dist/chunk-4C57PR42.js +468 -0
- package/dist/chunk-4GU5GCIY.js +1384 -0
- package/dist/chunk-4N4SXXWF.js +769 -0
- package/dist/chunk-4PDEPEQW.cjs +41 -0
- package/dist/chunk-4R6SBXDB.js +45 -0
- package/dist/chunk-4SDKXQ4C.js +811 -0
- package/dist/chunk-4V2E7U7Q.cjs +2015 -0
- package/dist/chunk-5FSKKMR7.cjs +2092 -0
- package/dist/chunk-5GLCTO44.js +161 -0
- package/dist/chunk-5H2G27PK.cjs +627 -0
- package/dist/chunk-5JEU52DW.js +382 -0
- package/dist/chunk-5NWINHR5.cjs +689 -0
- package/dist/chunk-5S7RKFGR.cjs +446 -0
- package/dist/chunk-5WUNN6ZN.cjs +428 -0
- package/dist/chunk-6CTRH7HT.cjs +1985 -0
- package/dist/chunk-6EX3I5P4.cjs +130 -0
- package/dist/chunk-6Q7RC2MK.cjs +1418 -0
- package/dist/chunk-7H33U5SM.cjs +413 -0
- package/dist/chunk-7M3PNU2M.cjs +672 -0
- package/dist/chunk-7T25IEZ2.js +449 -0
- package/dist/chunk-7V4JI5TB.cjs +6947 -0
- package/dist/chunk-A6KINLZJ.js +236 -0
- package/dist/chunk-ADADVMXY.js +404 -0
- package/dist/chunk-AIA52I7T.cjs +543 -0
- package/dist/chunk-ALC6K7GL.cjs +4402 -0
- package/dist/chunk-ANXZFVY2.js +113 -0
- package/dist/chunk-AOVGZ25K.cjs +56583 -0
- package/dist/chunk-AVJHHUC5.cjs +718 -0
- package/dist/chunk-BGY3SDG3.js +4396 -0
- package/dist/chunk-BOVPWH4H.js +3857 -0
- package/dist/chunk-BRQJKJGT.cjs +20 -0
- package/dist/chunk-C37BHB7N.cjs +636 -0
- package/dist/chunk-CBJY23VL.js +126 -0
- package/dist/chunk-CCATWPXM.js +778 -0
- package/dist/chunk-CIWWXYHZ.cjs +50 -0
- package/dist/chunk-CMT5NMMS.js +669 -0
- package/dist/chunk-CR4FMIWL.cjs +1049 -0
- package/dist/chunk-CR7XRXRN.cjs +639 -0
- package/dist/chunk-CSD27UNQ.js +2176 -0
- package/dist/chunk-D3STJ56J.js +714 -0
- package/dist/chunk-DAJXW4KX.js +725 -0
- package/dist/chunk-DHO2YRIM.js +756 -0
- package/dist/chunk-DTGBOSEM.cjs +319 -0
- package/dist/chunk-E6XXE66V.js +2252 -0
- package/dist/chunk-E7JP3BS3.cjs +61 -0
- package/dist/chunk-EKBKLK7P.js +1169 -0
- package/dist/chunk-EKYL4PE3.cjs +404 -0
- package/dist/chunk-EXKSFGSX.cjs +274 -0
- package/dist/chunk-EXUP2BUM.cjs +1173 -0
- package/dist/chunk-FDSGHPAK.js +130 -0
- package/dist/chunk-FEWUHQNM.cjs +144 -0
- package/dist/chunk-FFAOS5HQ.js +70 -0
- package/dist/chunk-FGGJQRLZ.js +270 -0
- package/dist/chunk-FHP6LXJS.js +415 -0
- package/dist/chunk-FJPADH77.cjs +666 -0
- package/dist/chunk-FL33V6U7.js +421 -0
- package/dist/chunk-FYSPZT4V.cjs +169 -0
- package/dist/chunk-GIOYPNTH.js +5575 -0
- package/dist/chunk-GJNCFRJU.cjs +125 -0
- package/dist/chunk-GMP623FG.cjs +1508 -0
- package/dist/chunk-GQHQOPXZ.cjs +5580 -0
- package/dist/chunk-GTU2Z2WW.cjs +262 -0
- package/dist/chunk-GYZE55MO.js +2007 -0
- package/dist/chunk-GZG4KA4E.js +529 -0
- package/dist/chunk-H652NHX5.js +600 -0
- package/dist/chunk-HCCQLAA4.cjs +74 -0
- package/dist/chunk-HKEXJUWS.cjs +4007 -0
- package/dist/chunk-HNDK4IQU.cjs +5737 -0
- package/dist/chunk-HR2OSYVQ.js +56165 -0
- package/dist/chunk-HYNTS5CP.js +422 -0
- package/dist/chunk-I6XZ5DZF.cjs +488 -0
- package/dist/chunk-ILRBGFVD.cjs +72 -0
- package/dist/chunk-IUDGEUDO.cjs +1409 -0
- package/dist/chunk-IUTY5WQ2.cjs +424 -0
- package/dist/chunk-IVY74O6C.js +247 -0
- package/dist/chunk-IWC5DM2M.cjs +611 -0
- package/dist/chunk-J32ZJZJH.js +554 -0
- package/dist/chunk-J52VSAQ7.js +6884 -0
- package/dist/chunk-J6M4FPK5.js +421 -0
- package/dist/chunk-J7XZV333.js +844 -0
- package/dist/chunk-JBNDTXXV.cjs +2433 -0
- package/dist/chunk-JC5YBPSF.cjs +984 -0
- package/dist/chunk-JD7CIZ33.js +1949 -0
- package/dist/chunk-JIBL5LRK.js +4287 -0
- package/dist/chunk-JIYN45TV.cjs +2525 -0
- package/dist/chunk-K574J76X.cjs +457 -0
- package/dist/chunk-KHDZJE5D.cjs +2196 -0
- package/dist/chunk-KKFZ3B6J.cjs +557 -0
- package/dist/chunk-KKP7JKN4.cjs +6002 -0
- package/dist/chunk-KPJL34Y7.cjs +186 -0
- package/dist/chunk-KQCN6AKJ.cjs +3042 -0
- package/dist/chunk-L5LKKENW.cjs +424 -0
- package/dist/chunk-LHAXPADA.js +882 -0
- package/dist/chunk-LM2VU56C.cjs +37 -0
- package/dist/chunk-M56JSP4A.js +400 -0
- package/dist/chunk-MBOOR7X4.js +18 -0
- package/dist/chunk-MQWAT42R.cjs +4310 -0
- package/dist/chunk-MXFUTKCO.js +56 -0
- package/dist/chunk-MYY4PMWX.cjs +264 -0
- package/dist/chunk-N75IH2HY.js +258 -0
- package/dist/chunk-NCWCUZNS.cjs +72 -0
- package/dist/chunk-NG77ATEW.cjs +778 -0
- package/dist/chunk-NW5G5FBQ.js +215 -0
- package/dist/chunk-OBIYPYYS.cjs +1993 -0
- package/dist/chunk-OH2FAIVU.js +608 -0
- package/dist/chunk-OIQYIIO3.cjs +473 -0
- package/dist/chunk-OL46QLBJ.js +61 -0
- package/dist/chunk-OMXII44L.js +5386 -0
- package/dist/chunk-OSYNRVOV.cjs +243 -0
- package/dist/chunk-PGANYCAG.cjs +220 -0
- package/dist/chunk-PHENW4MQ.js +65 -0
- package/dist/chunk-PY37LNDP.js +686 -0
- package/dist/chunk-Q56TT7IL.js +483 -0
- package/dist/chunk-QD32ADK6.js +1046 -0
- package/dist/chunk-QPOQ7VPI.js +1491 -0
- package/dist/chunk-QPSKHBJP.js +5963 -0
- package/dist/chunk-QXH7QDSZ.js +1989 -0
- package/dist/chunk-R24NNAEG.js +1399 -0
- package/dist/chunk-R75BSDH7.cjs +50 -0
- package/dist/chunk-RARB3MBR.js +207 -0
- package/dist/chunk-ROHLEP2W.cjs +847 -0
- package/dist/chunk-S3MDHNKB.cjs +490 -0
- package/dist/chunk-S6YWHCKV.cjs +410 -0
- package/dist/chunk-SIEXCILW.js +229 -0
- package/dist/chunk-SLU6UPJI.cjs +410 -0
- package/dist/chunk-SMIWS6DE.cjs +212 -0
- package/dist/chunk-T5J7ZKP3.cjs +4885 -0
- package/dist/chunk-TDCNJHWO.js +341 -0
- package/dist/chunk-TG7O4WBC.js +406 -0
- package/dist/chunk-THCK6ECW.js +2085 -0
- package/dist/chunk-TJHVSBP2.js +439 -0
- package/dist/chunk-TVHSPJ4N.cjs +606 -0
- package/dist/chunk-TWUXUCEW.cjs +781 -0
- package/dist/chunk-U44IKGG7.cjs +5390 -0
- package/dist/chunk-UFZZ7TSN.cjs +886 -0
- package/dist/chunk-UJXISJBN.js +487 -0
- package/dist/chunk-UOIGFQXC.cjs +9750 -0
- package/dist/chunk-URG2SJLK.js +2521 -0
- package/dist/chunk-UWJHCOH2.js +623 -0
- package/dist/chunk-V6MKC2FZ.js +979 -0
- package/dist/chunk-VJ3L7CHT.cjs +169 -0
- package/dist/chunk-VMLKSV26.js +1216 -0
- package/dist/chunk-VVKVQZI6.js +55 -0
- package/dist/chunk-W6RW64BB.cjs +1219 -0
- package/dist/chunk-WKX5AMOY.js +309 -0
- package/dist/chunk-WNNE3PO3.js +34 -0
- package/dist/chunk-WRKUDAZJ.js +3038 -0
- package/dist/chunk-WRLUBRKS.cjs +1943 -0
- package/dist/chunk-WRNEH5MO.js +3169 -0
- package/dist/chunk-WRWEX5ZF.js +658 -0
- package/dist/chunk-X3GJPRVK.cjs +3246 -0
- package/dist/chunk-X3UVCWNL.cjs +2257 -0
- package/dist/chunk-XB274MW5.cjs +814 -0
- package/dist/chunk-XHIV6326.cjs +793 -0
- package/dist/chunk-XIVIE43A.cjs +729 -0
- package/dist/chunk-XJAN7CZG.cjs +432 -0
- package/dist/chunk-XKTPFXGA.js +164 -0
- package/dist/chunk-XL6INWKT.js +121 -0
- package/dist/chunk-XSFNHP2E.js +632 -0
- package/dist/chunk-XT6JY5W5.js +9684 -0
- package/dist/chunk-XUILI4KB.cjs +430 -0
- package/dist/chunk-YF2I3MV3.js +46 -0
- package/dist/chunk-YIMN575O.js +4847 -0
- package/dist/chunk-YIVFJNYV.js +176 -0
- package/dist/chunk-YKGPCZEE.cjs +237 -0
- package/dist/chunk-YN2YWTXW.js +5731 -0
- package/dist/chunk-YN6V7R3L.cjs +327 -0
- package/dist/chunk-YQELFNJV.js +39 -0
- package/dist/chunk-YVD3CSO3.js +1183 -0
- package/dist/chunk-YVOAF4ML.js +623 -0
- package/dist/chunk-YWOBW2PV.cjs +759 -0
- package/dist/chunk-YYXH45E2.js +426 -0
- package/dist/chunk-ZDSYWBIE.cjs +69 -0
- package/dist/chunk-ZU7NIRT6.js +325 -0
- package/dist/chunk-ZZ7RO2UQ.js +1243 -0
- package/dist/cli/holoscript-runner.cjs +2255 -0
- package/dist/cli/holoscript-runner.js +2230 -0
- package/dist/codebase/index.cjs +336 -0
- package/dist/codebase/index.js +331 -0
- package/dist/compiler/agent-inference.cjs +31 -0
- package/dist/compiler/agent-inference.js +8 -0
- package/dist/compiler/android-xr.cjs +24 -0
- package/dist/compiler/android-xr.js +14 -0
- package/dist/compiler/android.cjs +24 -0
- package/dist/compiler/android.js +14 -0
- package/dist/compiler/ar.cjs +23 -0
- package/dist/compiler/ar.js +11 -0
- package/dist/compiler/babylon.cjs +21 -0
- package/dist/compiler/babylon.js +15 -0
- package/dist/compiler/business-quest.cjs +43 -0
- package/dist/compiler/business-quest.js +4 -0
- package/dist/compiler/coco.cjs +27 -0
- package/dist/compiler/coco.js +4 -0
- package/dist/compiler/context.cjs +25 -0
- package/dist/compiler/context.d.ts +28 -0
- package/dist/compiler/context.js +8 -0
- package/dist/compiler/domain-block-utils.cjs +609 -0
- package/dist/compiler/domain-block-utils.js +11 -0
- package/dist/compiler/dtdl.cjs +27 -0
- package/dist/compiler/dtdl.js +11 -0
- package/dist/compiler/gltf-pipeline.cjs +39 -0
- package/dist/compiler/gltf-pipeline.js +4 -0
- package/dist/compiler/godot.cjs +18 -0
- package/dist/compiler/godot.js +12 -0
- package/dist/compiler/incremental.cjs +34 -0
- package/dist/compiler/incremental.js +9 -0
- package/dist/compiler/index.cjs +5408 -0
- package/dist/compiler/index.d.ts +334 -21
- package/dist/compiler/index.js +5069 -0
- package/dist/compiler/ios.cjs +23 -0
- package/dist/compiler/ios.js +13 -0
- package/dist/compiler/llm-provider-capabilities.cjs +25 -0
- package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
- package/dist/compiler/llm-provider-capabilities.js +8 -0
- package/dist/compiler/multi-layer.cjs +24 -0
- package/dist/compiler/multi-layer.js +15 -0
- package/dist/compiler/nodetoy.cjs +23 -0
- package/dist/compiler/nodetoy.d.ts +69 -0
- package/dist/compiler/nodetoy.js +4 -0
- package/dist/compiler/openxr.cjs +19 -0
- package/dist/compiler/openxr.js +13 -0
- package/dist/compiler/playcanvas.cjs +19 -0
- package/dist/compiler/playcanvas.js +13 -0
- package/dist/compiler/r3f.cjs +39 -0
- package/dist/compiler/r3f.d.ts +22 -0
- package/dist/compiler/r3f.js +17 -0
- package/dist/compiler/remotion.cjs +23 -0
- package/dist/compiler/remotion.js +4 -0
- package/dist/compiler/reproducibility.cjs +39 -0
- package/dist/compiler/reproducibility.js +4 -0
- package/dist/compiler/sdf.cjs +24 -0
- package/dist/compiler/sdf.js +12 -0
- package/dist/compiler/semantic-scene.cjs +31 -0
- package/dist/compiler/semantic-scene.js +4 -0
- package/dist/compiler/state.cjs +21 -0
- package/dist/compiler/state.js +11 -0
- package/dist/compiler/trait-composition.cjs +30 -0
- package/dist/compiler/trait-composition.js +9 -0
- package/dist/compiler/unity.cjs +19 -0
- package/dist/compiler/unity.js +13 -0
- package/dist/compiler/unreal.cjs +23 -0
- package/dist/compiler/unreal.js +13 -0
- package/dist/compiler/urdf.cjs +52 -0
- package/dist/compiler/urdf.js +12 -0
- package/dist/compiler/usd-physics.cjs +26 -0
- package/dist/compiler/usd-physics.js +9 -0
- package/dist/compiler/visionos.cjs +19 -0
- package/dist/compiler/visionos.js +13 -0
- package/dist/compiler/vrchat.cjs +22 -0
- package/dist/compiler/vrchat.js +12 -0
- package/dist/compiler/vrr.cjs +24 -0
- package/dist/compiler/vrr.js +12 -0
- package/dist/compiler/wasm.cjs +36 -0
- package/dist/compiler/wasm.js +12 -0
- package/dist/compiler/webgpu.cjs +18 -0
- package/dist/compiler/webgpu.js +12 -0
- package/dist/coordinators/index.cjs +1266 -0
- package/dist/coordinators/index.d.ts +72 -1
- package/dist/coordinators/index.js +1259 -0
- package/dist/debugger.cjs +24 -0
- package/dist/debugger.js +11 -0
- package/dist/dist-ACXG6IH5.cjs +3113 -0
- package/dist/dist-VD4L6V7Q.js +3076 -0
- package/dist/entries/interop.cjs +64 -0
- package/dist/entries/interop.js +7 -0
- package/dist/entries/scripting.cjs +55 -0
- package/dist/entries/scripting.js +10 -0
- package/dist/hololand/index.cjs +146 -0
- package/dist/hololand/index.d.ts +70 -0
- package/dist/hololand/index.js +5 -0
- package/dist/index.cjs +44660 -0
- package/dist/index.d.ts +978 -21
- package/dist/index.js +41422 -0
- package/dist/math/tropical-spmv.cjs +45 -0
- package/dist/math/tropical-spmv.js +4 -0
- package/dist/math/vec3.cjs +57 -0
- package/dist/math/vec3.js +4 -0
- package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
- package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
- package/dist/paper-0c-spike/index.cjs +150 -0
- package/dist/paper-0c-spike/index.js +141 -0
- package/dist/parser.cjs +61 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.js +12 -0
- package/dist/playwright-3AT3AKTV.cjs +98673 -0
- package/dist/playwright-VZPDVUEQ.js +98660 -0
- package/dist/reconstruction/index.cjs +153 -0
- package/dist/reconstruction/index.d.ts +29 -2
- package/dist/reconstruction/index.js +8 -0
- package/dist/runtime.cjs +316 -0
- package/dist/runtime.d.ts +61 -0
- package/dist/runtime.js +31 -0
- package/dist/self-improvement/index.cjs +563 -0
- package/dist/self-improvement/index.js +545 -0
- package/dist/src-4ROC227P.cjs +2094 -0
- package/dist/src-HCCCSYP7.js +2073 -0
- package/dist/storage/index.cjs +38 -0
- package/dist/storage/index.js +5 -0
- package/dist/testing.cjs +25 -0
- package/dist/testing.d.ts +70 -0
- package/dist/testing.js +4 -0
- package/dist/traitDocs/traitDocs.cjs +33 -0
- package/dist/traitDocs/traitDocs.js +7 -0
- package/dist/traits/botanical-lotus.cjs +177 -0
- package/dist/traits/botanical-lotus.d.ts +502 -0
- package/dist/traits/botanical-lotus.js +7 -0
- package/dist/traits/engines/index.cjs +520 -0
- package/dist/traits/engines/index.js +380 -0
- package/dist/traits/index.cjs +24548 -0
- package/dist/traits/index.d.ts +171 -35
- package/dist/traits/index.js +21638 -0
- package/dist/traits/simulation-solver-factory.cjs +13 -0
- package/dist/traits/simulation-solver-factory.d.ts +23 -0
- package/dist/traits/simulation-solver-factory.js +4 -0
- package/dist/traits/webcam-gaze.cjs +35 -0
- package/dist/traits/webcam-gaze.d.ts +17 -0
- package/dist/traits/webcam-gaze.js +4 -0
- package/dist/type-checker.cjs +19 -0
- package/dist/type-checker.js +6 -0
- package/dist/world/index.cjs +947 -0
- package/dist/world/index.d.ts +147 -0
- package/dist/world/index.js +939 -0
- package/dist/world-model/index.cjs +1446 -0
- package/dist/world-model/index.d.ts +119 -0
- package/dist/world-model/index.js +1414 -0
- package/dist/wot/index.cjs +29 -0
- package/dist/wot/index.js +4 -0
- package/package.json +93 -49
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkAIA52I7T_cjs = require('./chunk-AIA52I7T.cjs');
|
|
4
|
+
var chunkHKEXJUWS_cjs = require('./chunk-HKEXJUWS.cjs');
|
|
5
|
+
var chunkKKP7JKN4_cjs = require('./chunk-KKP7JKN4.cjs');
|
|
6
|
+
var chunkHCCQLAA4_cjs = require('./chunk-HCCQLAA4.cjs');
|
|
7
|
+
var ans = require('@holoscript/core-types/ans');
|
|
8
|
+
|
|
9
|
+
// src/compiler/UnrealCompiler.ts
|
|
10
|
+
var UnrealCompiler_exports = {};
|
|
11
|
+
chunkHCCQLAA4_cjs.__export(UnrealCompiler_exports, {
|
|
12
|
+
UnrealCompiler: () => exports.UnrealCompiler,
|
|
13
|
+
compileToUnreal: () => compileToUnreal
|
|
14
|
+
});
|
|
15
|
+
function compileToUnreal(composition, options) {
|
|
16
|
+
const compiler = new exports.UnrealCompiler(options);
|
|
17
|
+
return compiler.compile(composition, chunkKKP7JKN4_cjs.createTestCompilerToken());
|
|
18
|
+
}
|
|
19
|
+
exports.UnrealCompiler = void 0;
|
|
20
|
+
var init_UnrealCompiler = chunkHCCQLAA4_cjs.__esm({
|
|
21
|
+
"src/compiler/UnrealCompiler.ts"() {
|
|
22
|
+
chunkKKP7JKN4_cjs.init_CompilerBase();
|
|
23
|
+
chunkHKEXJUWS_cjs.init_DomainBlockCompilerMixin();
|
|
24
|
+
chunkAIA52I7T_cjs.init_PlatformConditionalCompilerMixin();
|
|
25
|
+
exports.UnrealCompiler = class extends chunkKKP7JKN4_cjs.CompilerBase {
|
|
26
|
+
constructor(options = {}) {
|
|
27
|
+
super();
|
|
28
|
+
this.compilerName = "UnrealCompiler";
|
|
29
|
+
this.headerLines = [];
|
|
30
|
+
this.sourceLines = [];
|
|
31
|
+
this.indentLevel = 0;
|
|
32
|
+
this.currentFile = "header";
|
|
33
|
+
this.options = {
|
|
34
|
+
moduleName: options.moduleName || "HoloWorld",
|
|
35
|
+
className: options.className || "AGeneratedScene",
|
|
36
|
+
indent: options.indent || " ",
|
|
37
|
+
engineVersion: options.engineVersion || "5.4",
|
|
38
|
+
useEnhancedInput: options.useEnhancedInput ?? true,
|
|
39
|
+
generateBlueprints: options.generateBlueprints ?? false,
|
|
40
|
+
provenanceHash: options.provenanceHash ?? "",
|
|
41
|
+
platformTarget: options.platformTarget ?? ""
|
|
42
|
+
};
|
|
43
|
+
if (options.platformTarget) {
|
|
44
|
+
this._platformTarget = typeof options.platformTarget === "string" ? chunkAIA52I7T_cjs.createPlatformTarget(options.platformTarget) : options.platformTarget;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
getRequiredCapability() {
|
|
48
|
+
return ans.ANSCapabilityPath.UNREAL;
|
|
49
|
+
}
|
|
50
|
+
compile(composition, agentToken, outputPath) {
|
|
51
|
+
this.validateCompilerAccess(agentToken, outputPath);
|
|
52
|
+
if (this._platformTarget) {
|
|
53
|
+
const platformMixin = new chunkAIA52I7T_cjs.PlatformConditionalCompilerMixin();
|
|
54
|
+
composition = platformMixin.filterForPlatform(composition, this._platformTarget);
|
|
55
|
+
}
|
|
56
|
+
this.headerLines = [];
|
|
57
|
+
this.sourceLines = [];
|
|
58
|
+
this.indentLevel = 0;
|
|
59
|
+
const headerFile = this.generateHeader(composition);
|
|
60
|
+
const sourceFile = this.generateSource(composition);
|
|
61
|
+
const result = {
|
|
62
|
+
headerFile,
|
|
63
|
+
sourceFile
|
|
64
|
+
};
|
|
65
|
+
if (this.options.generateBlueprints) {
|
|
66
|
+
result.blueprintJson = this.generateBlueprintJson(composition);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
generateHeader(composition) {
|
|
71
|
+
this.headerLines = [];
|
|
72
|
+
this.currentFile = "header";
|
|
73
|
+
this.indentLevel = 0;
|
|
74
|
+
this.emitH("// Auto-generated by HoloScript UnrealCompiler");
|
|
75
|
+
this.emitH(
|
|
76
|
+
`// Source: composition "${this.escapeStringValue(composition.name, "TypeScript")}"`
|
|
77
|
+
);
|
|
78
|
+
this.emitH(`// Unreal Engine: ${this.options.engineVersion}`);
|
|
79
|
+
this.emitH("// Do not edit manually \u2014 regenerate from .holo source");
|
|
80
|
+
if (this.options.provenanceHash) {
|
|
81
|
+
this.emitH(`// Provenance Hash: ${this.options.provenanceHash}`);
|
|
82
|
+
}
|
|
83
|
+
this.emitH("");
|
|
84
|
+
this.emitH("#pragma once");
|
|
85
|
+
this.emitH("");
|
|
86
|
+
this.emitH('#include "CoreMinimal.h"');
|
|
87
|
+
this.emitH('#include "GameFramework/Actor.h"');
|
|
88
|
+
this.emitH('#include "Components/StaticMeshComponent.h"');
|
|
89
|
+
this.emitH('#include "Components/PointLightComponent.h"');
|
|
90
|
+
this.emitH('#include "Components/SpotLightComponent.h"');
|
|
91
|
+
this.emitH('#include "Components/DirectionalLightComponent.h"');
|
|
92
|
+
this.emitH('#include "Components/AudioComponent.h"');
|
|
93
|
+
this.emitH('#include "Components/BoxComponent.h"');
|
|
94
|
+
this.emitH('#include "Components/SphereComponent.h"');
|
|
95
|
+
if (composition.objects?.some((o) => o.traits?.some((t) => t.name === "physics"))) {
|
|
96
|
+
this.emitH('#include "PhysicsEngine/PhysicsConstraintComponent.h"');
|
|
97
|
+
}
|
|
98
|
+
if (this.options.useEnhancedInput) {
|
|
99
|
+
this.emitH('#include "EnhancedInputComponent.h"');
|
|
100
|
+
this.emitH('#include "EnhancedInputSubsystems.h"');
|
|
101
|
+
}
|
|
102
|
+
this.emitH(`#include "${this.options.className.replace(/^A/, "")}.generated.h"`);
|
|
103
|
+
this.emitH("");
|
|
104
|
+
this.emitH("// Forward declarations");
|
|
105
|
+
this.emitH("class UNiagaraComponent;");
|
|
106
|
+
this.emitH("class UWidgetComponent;");
|
|
107
|
+
this.emitH("");
|
|
108
|
+
this.emitH("UCLASS(Blueprintable, BlueprintType)");
|
|
109
|
+
this.emitH(
|
|
110
|
+
`class ${this.options.moduleName.toUpperCase()}_API ${this.options.className} : public AActor`
|
|
111
|
+
);
|
|
112
|
+
this.emitH("{");
|
|
113
|
+
this.indentLevel++;
|
|
114
|
+
this.emitH("GENERATED_BODY()");
|
|
115
|
+
this.emitH("");
|
|
116
|
+
this.emitH("public:");
|
|
117
|
+
this.emitH(`${this.options.className}();`);
|
|
118
|
+
this.emitH("");
|
|
119
|
+
this.emitH("// === Scene Components ===");
|
|
120
|
+
this.emitH('UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "HoloScript")');
|
|
121
|
+
this.emitH("USceneComponent* RootSceneComponent;");
|
|
122
|
+
this.emitH("");
|
|
123
|
+
for (const obj of this.flattenObjects(composition.objects || [])) {
|
|
124
|
+
const varName = this.sanitizeName(obj.name);
|
|
125
|
+
const compType = this.getComponentType(obj);
|
|
126
|
+
this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Objects")`);
|
|
127
|
+
this.emitH(`${compType}* ${varName};`);
|
|
128
|
+
}
|
|
129
|
+
this.emitH("");
|
|
130
|
+
for (const light of composition.lights || []) {
|
|
131
|
+
const varName = this.sanitizeName(light.name);
|
|
132
|
+
const lightType = this.getLightComponentType(light.lightType);
|
|
133
|
+
this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lighting")`);
|
|
134
|
+
this.emitH(`${lightType}* ${varName};`);
|
|
135
|
+
}
|
|
136
|
+
this.emitH("");
|
|
137
|
+
for (const audio of composition.audio || []) {
|
|
138
|
+
const varName = this.sanitizeName(audio.name);
|
|
139
|
+
this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Audio")`);
|
|
140
|
+
this.emitH(`UAudioComponent* ${varName};`);
|
|
141
|
+
}
|
|
142
|
+
this.emitH("");
|
|
143
|
+
if (composition.state) {
|
|
144
|
+
this.emitH("// === State Properties ===");
|
|
145
|
+
for (const prop of composition.state.properties) {
|
|
146
|
+
const cppType = this.toCppType(prop.value);
|
|
147
|
+
this.emitH(`UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "State")`);
|
|
148
|
+
this.emitH(`${cppType} ${this.escapeStringValue(prop.key, "TypeScript")};`);
|
|
149
|
+
}
|
|
150
|
+
this.emitH("");
|
|
151
|
+
}
|
|
152
|
+
this.emitH("protected:");
|
|
153
|
+
this.emitH("virtual void BeginPlay() override;");
|
|
154
|
+
this.emitH("virtual void Tick(float DeltaTime) override;");
|
|
155
|
+
this.emitH(
|
|
156
|
+
"virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;"
|
|
157
|
+
);
|
|
158
|
+
this.emitH("");
|
|
159
|
+
this.emitH("public:");
|
|
160
|
+
this.emitH("// === Blueprint Callable Functions ===");
|
|
161
|
+
if (composition.logic?.actions) {
|
|
162
|
+
for (const action of composition.logic.actions) {
|
|
163
|
+
this.emitH(`UFUNCTION(BlueprintCallable, Category = "HoloScript")`);
|
|
164
|
+
this.emitH(`void ${this.sanitizeName(action.name)}();`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
this.emitH("");
|
|
168
|
+
for (const tl of composition.timelines || []) {
|
|
169
|
+
const name = this.sanitizeName(tl.name);
|
|
170
|
+
this.emitH(`UFUNCTION(BlueprintCallable, Category = "Timelines")`);
|
|
171
|
+
this.emitH(`void Play${name}();`);
|
|
172
|
+
}
|
|
173
|
+
this.emitH("");
|
|
174
|
+
for (const tr of composition.transitions || []) {
|
|
175
|
+
const name = this.sanitizeName(tr.name);
|
|
176
|
+
this.emitH(`UFUNCTION(BlueprintCallable, Category = "Transitions")`);
|
|
177
|
+
this.emitH(`void ${name}Transition();`);
|
|
178
|
+
}
|
|
179
|
+
if (composition.zones?.length) {
|
|
180
|
+
this.emitH("");
|
|
181
|
+
this.emitH("// === Zone Overlap Handlers ===");
|
|
182
|
+
for (const zone of composition.zones) {
|
|
183
|
+
const name = this.sanitizeName(zone.name);
|
|
184
|
+
this.emitH(`UFUNCTION()`);
|
|
185
|
+
this.emitH(
|
|
186
|
+
`void On${name}BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);`
|
|
187
|
+
);
|
|
188
|
+
this.emitH(`UFUNCTION()`);
|
|
189
|
+
this.emitH(
|
|
190
|
+
`void On${name}EndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);`
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
this.emitH("");
|
|
195
|
+
this.emitH("private:");
|
|
196
|
+
this.emitH("void SetupComponents();");
|
|
197
|
+
this.emitH("void SetupEnvironment();");
|
|
198
|
+
if (composition.zones?.length) {
|
|
199
|
+
this.emitH("void SetupZones();");
|
|
200
|
+
}
|
|
201
|
+
this.indentLevel--;
|
|
202
|
+
this.emitH("};");
|
|
203
|
+
return this.headerLines.join("\n");
|
|
204
|
+
}
|
|
205
|
+
generateSource(composition) {
|
|
206
|
+
this.sourceLines = [];
|
|
207
|
+
this.currentFile = "source";
|
|
208
|
+
this.indentLevel = 0;
|
|
209
|
+
const headerName = this.options.className.replace(/^A/, "");
|
|
210
|
+
this.emitS("// Auto-generated by HoloScript UnrealCompiler");
|
|
211
|
+
this.emitS(
|
|
212
|
+
`// Source: composition "${this.escapeStringValue(composition.name, "TypeScript")}"`
|
|
213
|
+
);
|
|
214
|
+
this.emitS("");
|
|
215
|
+
this.emitS(`#include "${headerName}.h"`);
|
|
216
|
+
this.emitS('#include "Net/UnrealNetwork.h"');
|
|
217
|
+
this.emitS('#include "Engine/StaticMesh.h"');
|
|
218
|
+
this.emitS('#include "Materials/MaterialInstanceDynamic.h"');
|
|
219
|
+
if (composition.audio?.length) {
|
|
220
|
+
this.emitS('#include "Sound/SoundBase.h"');
|
|
221
|
+
}
|
|
222
|
+
this.emitS("");
|
|
223
|
+
this.emitS(`${this.options.className}::${this.options.className}()`);
|
|
224
|
+
this.emitS("{");
|
|
225
|
+
this.indentLevel++;
|
|
226
|
+
this.emitS("PrimaryActorTick.bCanEverTick = true;");
|
|
227
|
+
this.emitS("bReplicates = true;");
|
|
228
|
+
this.emitS("");
|
|
229
|
+
this.emitS("// Root component");
|
|
230
|
+
this.emitS(
|
|
231
|
+
'RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));'
|
|
232
|
+
);
|
|
233
|
+
this.emitS("RootComponent = RootSceneComponent;");
|
|
234
|
+
this.emitS("");
|
|
235
|
+
this.emitS("SetupComponents();");
|
|
236
|
+
this.indentLevel--;
|
|
237
|
+
this.emitS("}");
|
|
238
|
+
this.emitS("");
|
|
239
|
+
this.emitS(`void ${this.options.className}::SetupComponents()`);
|
|
240
|
+
this.emitS("{");
|
|
241
|
+
this.indentLevel++;
|
|
242
|
+
for (const obj of composition.objects || []) {
|
|
243
|
+
this.compileObjectSetup(obj);
|
|
244
|
+
}
|
|
245
|
+
for (const light of composition.lights || []) {
|
|
246
|
+
this.compileLightSetup(light);
|
|
247
|
+
}
|
|
248
|
+
for (const audio of composition.audio || []) {
|
|
249
|
+
this.compileAudioSetup(audio);
|
|
250
|
+
}
|
|
251
|
+
this.compileUnrealDomainBlocks(composition);
|
|
252
|
+
this.indentLevel--;
|
|
253
|
+
this.emitS("}");
|
|
254
|
+
this.emitS("");
|
|
255
|
+
this.emitS(`void ${this.options.className}::SetupEnvironment()`);
|
|
256
|
+
this.emitS("{");
|
|
257
|
+
this.indentLevel++;
|
|
258
|
+
if (composition.environment) {
|
|
259
|
+
this.compileEnvironment(composition.environment);
|
|
260
|
+
} else {
|
|
261
|
+
this.emitS("// No environment configuration");
|
|
262
|
+
}
|
|
263
|
+
this.indentLevel--;
|
|
264
|
+
this.emitS("}");
|
|
265
|
+
this.emitS("");
|
|
266
|
+
if (composition.zones?.length) {
|
|
267
|
+
this.emitS(`void ${this.options.className}::SetupZones()`);
|
|
268
|
+
this.emitS("{");
|
|
269
|
+
this.indentLevel++;
|
|
270
|
+
for (const zone of composition.zones) {
|
|
271
|
+
this.compileZoneSetup(zone);
|
|
272
|
+
}
|
|
273
|
+
this.indentLevel--;
|
|
274
|
+
this.emitS("}");
|
|
275
|
+
this.emitS("");
|
|
276
|
+
for (const zone of composition.zones) {
|
|
277
|
+
this.compileZoneHandlers(zone);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
this.emitS(`void ${this.options.className}::BeginPlay()`);
|
|
281
|
+
this.emitS("{");
|
|
282
|
+
this.indentLevel++;
|
|
283
|
+
this.emitS("Super::BeginPlay();");
|
|
284
|
+
this.emitS("");
|
|
285
|
+
this.emitS("SetupEnvironment();");
|
|
286
|
+
if (composition.zones?.length) {
|
|
287
|
+
this.emitS("SetupZones();");
|
|
288
|
+
}
|
|
289
|
+
this.emitS("");
|
|
290
|
+
this.emitS(
|
|
291
|
+
`UE_LOG(LogTemp, Log, TEXT("HoloScript scene '${this.escapeStringValue(composition.name, "TypeScript")}' initialized"));`
|
|
292
|
+
);
|
|
293
|
+
for (const tl of composition.timelines || []) {
|
|
294
|
+
if (tl.autoplay) {
|
|
295
|
+
this.emitS(`Play${this.sanitizeName(tl.name)}();`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
this.indentLevel--;
|
|
299
|
+
this.emitS("}");
|
|
300
|
+
this.emitS("");
|
|
301
|
+
this.emitS(`void ${this.options.className}::Tick(float DeltaTime)`);
|
|
302
|
+
this.emitS("{");
|
|
303
|
+
this.indentLevel++;
|
|
304
|
+
this.emitS("Super::Tick(DeltaTime);");
|
|
305
|
+
this.indentLevel--;
|
|
306
|
+
this.emitS("}");
|
|
307
|
+
this.emitS("");
|
|
308
|
+
this.emitS(
|
|
309
|
+
`void ${this.options.className}::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const`
|
|
310
|
+
);
|
|
311
|
+
this.emitS("{");
|
|
312
|
+
this.indentLevel++;
|
|
313
|
+
this.emitS("Super::GetLifetimeReplicatedProps(OutLifetimeProps);");
|
|
314
|
+
if (composition.state) {
|
|
315
|
+
this.emitS("");
|
|
316
|
+
for (const prop of composition.state.properties) {
|
|
317
|
+
this.emitS(
|
|
318
|
+
`DOREPLIFETIME(${this.options.className}, ${this.escapeStringValue(prop.key, "TypeScript")});`
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
this.indentLevel--;
|
|
323
|
+
this.emitS("}");
|
|
324
|
+
this.emitS("");
|
|
325
|
+
for (const tl of composition.timelines || []) {
|
|
326
|
+
this.compileTimelineFunction(tl);
|
|
327
|
+
}
|
|
328
|
+
for (const tr of composition.transitions || []) {
|
|
329
|
+
this.compileTransitionFunction(tr);
|
|
330
|
+
}
|
|
331
|
+
if (composition.logic?.actions) {
|
|
332
|
+
for (const action of composition.logic.actions) {
|
|
333
|
+
this.compileActionFunction(action);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return this.sourceLines.join("\n");
|
|
337
|
+
}
|
|
338
|
+
compileObjectSetup(obj) {
|
|
339
|
+
const varName = this.sanitizeName(obj.name);
|
|
340
|
+
const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
|
|
341
|
+
const isModel = !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src");
|
|
342
|
+
this.emitS(`// Object: ${this.escapeStringValue(obj.name, "TypeScript")}`);
|
|
343
|
+
this.emitS(
|
|
344
|
+
`${varName} = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("${this.escapeStringValue(obj.name, "TypeScript")}"));`
|
|
345
|
+
);
|
|
346
|
+
this.emitS(`${varName}->SetupAttachment(RootComponent);`);
|
|
347
|
+
if (!isModel) {
|
|
348
|
+
const meshPath = this.getMeshPath(meshType);
|
|
349
|
+
if (meshPath) {
|
|
350
|
+
this.emitS(
|
|
351
|
+
`static ConstructorHelpers::FObjectFinder<UStaticMesh> ${varName}MeshAsset(TEXT("${meshPath}"));`
|
|
352
|
+
);
|
|
353
|
+
this.emitS(
|
|
354
|
+
`if (${varName}MeshAsset.Succeeded()) { ${varName}->SetStaticMesh(${varName}MeshAsset.Object); }`
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const pos = this.findObjProp(obj, "position");
|
|
359
|
+
if (pos && Array.isArray(pos)) {
|
|
360
|
+
this.emitS(
|
|
361
|
+
`${varName}->SetRelativeLocation(FVector(${pos[0] * 100}f, ${pos[2] * 100}f, ${pos[1] * 100}f));`
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
const rot = this.findObjProp(obj, "rotation");
|
|
365
|
+
if (rot && Array.isArray(rot)) {
|
|
366
|
+
this.emitS(`${varName}->SetRelativeRotation(FRotator(${rot[0]}f, ${rot[1]}f, ${rot[2]}f));`);
|
|
367
|
+
}
|
|
368
|
+
const scale = this.findObjProp(obj, "scale");
|
|
369
|
+
if (scale) {
|
|
370
|
+
if (Array.isArray(scale)) {
|
|
371
|
+
this.emitS(
|
|
372
|
+
`${varName}->SetRelativeScale3D(FVector(${scale[0]}f, ${scale[1]}f, ${scale[2]}f));`
|
|
373
|
+
);
|
|
374
|
+
} else {
|
|
375
|
+
this.emitS(`${varName}->SetRelativeScale3D(FVector(${scale}f));`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (obj.traits) {
|
|
379
|
+
for (const trait of obj.traits) {
|
|
380
|
+
this.compileTraitSetup(varName, trait);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (obj.children && obj.children.length > 0) {
|
|
384
|
+
for (const child of obj.children) {
|
|
385
|
+
this.compileObjectSetup(child);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
this.emitS("");
|
|
389
|
+
}
|
|
390
|
+
compileTraitSetup(varName, trait) {
|
|
391
|
+
switch (trait.name) {
|
|
392
|
+
case "physics":
|
|
393
|
+
this.emitS(`${varName}->SetSimulatePhysics(true);`);
|
|
394
|
+
if (trait.config?.mass) {
|
|
395
|
+
this.emitS(`${varName}->SetMassOverrideInKg(NAME_None, ${trait.config.mass}f, true);`);
|
|
396
|
+
}
|
|
397
|
+
break;
|
|
398
|
+
case "collidable":
|
|
399
|
+
this.emitS(`${varName}->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);`);
|
|
400
|
+
this.emitS(`${varName}->SetCollisionResponseToAllChannels(ECR_Block);`);
|
|
401
|
+
break;
|
|
402
|
+
case "grabbable":
|
|
403
|
+
this.emitS(`// @grabbable \u2014 implement via GrabComponent or VR interaction framework`);
|
|
404
|
+
this.emitS(`UE_LOG(LogTemp, Warning, TEXT("@grabbable on %s \u2014 trait stubbed, needs GrabComponent implementation"), *GetName());`);
|
|
405
|
+
break;
|
|
406
|
+
case "pointable":
|
|
407
|
+
case "hoverable":
|
|
408
|
+
this.emitS(
|
|
409
|
+
`// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 implement via line trace interaction`
|
|
410
|
+
);
|
|
411
|
+
this.emitS(`UE_LOG(LogTemp, Warning, TEXT("@%s on %s \u2014 trait stubbed, needs line trace interaction"), TEXT("${this.escapeStringValue(trait.name, "TypeScript")}"), *GetName());`);
|
|
412
|
+
break;
|
|
413
|
+
case "portal":
|
|
414
|
+
this.emitS(`// @portal \u2014 destination: "${trait.config?.destination || "unknown"}"`);
|
|
415
|
+
this.emitS(`UE_LOG(LogTemp, Warning, TEXT("@portal on %s \u2014 trait stubbed, needs level streaming/teleport implementation"), *GetName());`);
|
|
416
|
+
break;
|
|
417
|
+
case "emissive":
|
|
418
|
+
case "glowing":
|
|
419
|
+
this.emitS(
|
|
420
|
+
`// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 apply emissive material`
|
|
421
|
+
);
|
|
422
|
+
this.emitS(`UE_LOG(LogTemp, Warning, TEXT("@%s on %s \u2014 trait stubbed, needs emissive material"), TEXT("${this.escapeStringValue(trait.name, "TypeScript")}"), *GetName());`);
|
|
423
|
+
break;
|
|
424
|
+
case "transparent":
|
|
425
|
+
this.emitS(`// @transparent \u2014 set material blend mode`);
|
|
426
|
+
this.emitS(`UE_LOG(LogTemp, Warning, TEXT("@transparent on %s \u2014 trait stubbed, needs translucent material"), *GetName());`);
|
|
427
|
+
break;
|
|
428
|
+
default:
|
|
429
|
+
this.emitS(
|
|
430
|
+
`// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 custom trait implementation required`
|
|
431
|
+
);
|
|
432
|
+
this.emitS(`UE_LOG(LogTemp, Warning, TEXT("@%s on %s \u2014 unhandled trait, needs custom implementation"), TEXT("${this.escapeStringValue(trait.name, "TypeScript")}"), *GetName());`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
compileLightSetup(light) {
|
|
436
|
+
const varName = this.sanitizeName(light.name);
|
|
437
|
+
const lightType = this.getLightComponentType(light.lightType);
|
|
438
|
+
this.emitS(`// Light: ${this.escapeStringValue(light.name, "TypeScript")}`);
|
|
439
|
+
this.emitS(
|
|
440
|
+
`${varName} = CreateDefaultSubobject<${lightType}>(TEXT("${this.escapeStringValue(light.name, "TypeScript")}"));`
|
|
441
|
+
);
|
|
442
|
+
this.emitS(`${varName}->SetupAttachment(RootComponent);`);
|
|
443
|
+
for (const prop of light.properties) {
|
|
444
|
+
if (prop.key === "color") {
|
|
445
|
+
this.emitS(`${varName}->SetLightColor(${this.toLinearColor(prop.value)});`);
|
|
446
|
+
} else if (prop.key === "intensity") {
|
|
447
|
+
const intensity = prop.value * 1e4;
|
|
448
|
+
this.emitS(`${varName}->SetIntensity(${intensity}f);`);
|
|
449
|
+
} else if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
450
|
+
const pos = prop.value;
|
|
451
|
+
this.emitS(
|
|
452
|
+
`${varName}->SetRelativeLocation(FVector(${pos[0] * 100}f, ${pos[2] * 100}f, ${pos[1] * 100}f));`
|
|
453
|
+
);
|
|
454
|
+
} else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
|
|
455
|
+
this.emitS(`${varName}->SetCastShadows(${prop.value ? "true" : "false"});`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
this.emitS("");
|
|
459
|
+
}
|
|
460
|
+
compileAudioSetup(audio) {
|
|
461
|
+
const varName = this.sanitizeName(audio.name);
|
|
462
|
+
this.emitS(`// Audio: ${this.escapeStringValue(audio.name, "TypeScript")}`);
|
|
463
|
+
this.emitS(
|
|
464
|
+
`${varName} = CreateDefaultSubobject<UAudioComponent>(TEXT("${this.escapeStringValue(audio.name, "TypeScript")}"));`
|
|
465
|
+
);
|
|
466
|
+
this.emitS(`${varName}->SetupAttachment(RootComponent);`);
|
|
467
|
+
this.emitS(`${varName}->bAutoActivate = false;`);
|
|
468
|
+
this.emitS("");
|
|
469
|
+
}
|
|
470
|
+
compileEnvironment(env) {
|
|
471
|
+
for (const prop of env.properties) {
|
|
472
|
+
if (prop.key === "skybox" || prop.key === "preset") {
|
|
473
|
+
this.emitS(
|
|
474
|
+
`// Environment preset: "${prop.value}" \u2014 configure via BP_Sky_Sphere or SkyAtmosphere`
|
|
475
|
+
);
|
|
476
|
+
} else if (prop.key === "fog" && typeof prop.value === "object") {
|
|
477
|
+
this.emitS("// Fog settings \u2014 configure via ExponentialHeightFog actor");
|
|
478
|
+
} else if (prop.key === "ambient_light") {
|
|
479
|
+
this.emitS(`// Ambient light: ${prop.value} \u2014 configure via SkyLight`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
compileZoneSetup(zone) {
|
|
484
|
+
const varName = this.sanitizeName(zone.name);
|
|
485
|
+
this.emitS(
|
|
486
|
+
`// Zone: ${this.escapeStringValue(zone.name, "TypeScript")} \u2014 bind overlap events`
|
|
487
|
+
);
|
|
488
|
+
this.emitS(
|
|
489
|
+
`// ${varName}Trigger->OnComponentBeginOverlap.AddDynamic(this, &${this.options.className}::On${varName}BeginOverlap);`
|
|
490
|
+
);
|
|
491
|
+
this.emitS(
|
|
492
|
+
`// ${varName}Trigger->OnComponentEndOverlap.AddDynamic(this, &${this.options.className}::On${varName}EndOverlap);`
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
compileZoneHandlers(zone) {
|
|
496
|
+
const varName = this.sanitizeName(zone.name);
|
|
497
|
+
this.emitS(
|
|
498
|
+
`void ${this.options.className}::On${varName}BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)`
|
|
499
|
+
);
|
|
500
|
+
this.emitS("{");
|
|
501
|
+
this.indentLevel++;
|
|
502
|
+
this.emitS(
|
|
503
|
+
`UE_LOG(LogTemp, Log, TEXT("Actor entered zone: ${this.escapeStringValue(zone.name, "TypeScript")}"));`
|
|
504
|
+
);
|
|
505
|
+
this.indentLevel--;
|
|
506
|
+
this.emitS("}");
|
|
507
|
+
this.emitS("");
|
|
508
|
+
this.emitS(
|
|
509
|
+
`void ${this.options.className}::On${varName}EndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)`
|
|
510
|
+
);
|
|
511
|
+
this.emitS("{");
|
|
512
|
+
this.indentLevel++;
|
|
513
|
+
this.emitS(
|
|
514
|
+
`UE_LOG(LogTemp, Log, TEXT("Actor exited zone: ${this.escapeStringValue(zone.name, "TypeScript")}"));`
|
|
515
|
+
);
|
|
516
|
+
this.indentLevel--;
|
|
517
|
+
this.emitS("}");
|
|
518
|
+
this.emitS("");
|
|
519
|
+
}
|
|
520
|
+
compileTimelineFunction(timeline) {
|
|
521
|
+
const name = this.sanitizeName(timeline.name);
|
|
522
|
+
this.emitS(`void ${this.options.className}::Play${name}()`);
|
|
523
|
+
this.emitS("{");
|
|
524
|
+
this.indentLevel++;
|
|
525
|
+
this.emitS(
|
|
526
|
+
`UE_LOG(LogTemp, Log, TEXT("Playing timeline: ${this.escapeStringValue(timeline.name, "TypeScript")}"));`
|
|
527
|
+
);
|
|
528
|
+
this.emitS("// Timeline implementation via FTimeline or native Sequencer");
|
|
529
|
+
for (const entry of timeline.entries) {
|
|
530
|
+
this.emitS(`// At ${entry.time}s: ${entry.action.kind}`);
|
|
531
|
+
}
|
|
532
|
+
this.indentLevel--;
|
|
533
|
+
this.emitS("}");
|
|
534
|
+
this.emitS("");
|
|
535
|
+
}
|
|
536
|
+
compileTransitionFunction(transition) {
|
|
537
|
+
const name = this.sanitizeName(transition.name);
|
|
538
|
+
this.emitS(`void ${this.options.className}::${name}Transition()`);
|
|
539
|
+
this.emitS("{");
|
|
540
|
+
this.indentLevel++;
|
|
541
|
+
const dest = transition.properties.find((p) => p.key === "destination" || p.key === "to");
|
|
542
|
+
if (dest) {
|
|
543
|
+
this.emitS(`UE_LOG(LogTemp, Log, TEXT("Transitioning to: ${dest.value}"));`);
|
|
544
|
+
this.emitS(`UGameplayStatics::OpenLevel(this, TEXT("${dest.value}"));`);
|
|
545
|
+
}
|
|
546
|
+
this.indentLevel--;
|
|
547
|
+
this.emitS("}");
|
|
548
|
+
this.emitS("");
|
|
549
|
+
}
|
|
550
|
+
compileActionFunction(action) {
|
|
551
|
+
const name = this.sanitizeName(action.name);
|
|
552
|
+
this.emitS(`void ${this.options.className}::${name}()`);
|
|
553
|
+
this.emitS("{");
|
|
554
|
+
this.indentLevel++;
|
|
555
|
+
this.emitS(
|
|
556
|
+
`UE_LOG(LogTemp, Log, TEXT("Action: ${this.escapeStringValue(action.name, "TypeScript")}"));`
|
|
557
|
+
);
|
|
558
|
+
this.emitS("// Action implementation");
|
|
559
|
+
this.indentLevel--;
|
|
560
|
+
this.emitS("}");
|
|
561
|
+
this.emitS("");
|
|
562
|
+
}
|
|
563
|
+
generateBlueprintJson(composition) {
|
|
564
|
+
return JSON.stringify(
|
|
565
|
+
{
|
|
566
|
+
type: "Blueprint",
|
|
567
|
+
class: this.options.className,
|
|
568
|
+
composition: composition.name,
|
|
569
|
+
objects: composition.objects?.map((o) => ({
|
|
570
|
+
name: o.name,
|
|
571
|
+
traits: o.traits?.map((t) => t.name) || []
|
|
572
|
+
})) || []
|
|
573
|
+
},
|
|
574
|
+
null,
|
|
575
|
+
2
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
// === Utility Methods ===
|
|
579
|
+
emitH(line) {
|
|
580
|
+
const indent = this.options.indent.repeat(this.indentLevel);
|
|
581
|
+
this.headerLines.push(indent + line);
|
|
582
|
+
}
|
|
583
|
+
emitS(line) {
|
|
584
|
+
const indent = this.options.indent.repeat(this.indentLevel);
|
|
585
|
+
this.sourceLines.push(indent + line);
|
|
586
|
+
}
|
|
587
|
+
sanitizeName(name) {
|
|
588
|
+
return name.replace(/[^a-zA-Z0-9_]/g, "_").replace(/^[0-9]/, "_$&");
|
|
589
|
+
}
|
|
590
|
+
getComponentType(obj) {
|
|
591
|
+
const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type");
|
|
592
|
+
if (meshType === "text") return "UTextRenderComponent";
|
|
593
|
+
return "UStaticMeshComponent";
|
|
594
|
+
}
|
|
595
|
+
/** Recursively collect all objects (including children) from a list. */
|
|
596
|
+
flattenObjects(objects) {
|
|
597
|
+
const result = [];
|
|
598
|
+
for (const obj of objects) {
|
|
599
|
+
result.push(obj);
|
|
600
|
+
if (obj.children && obj.children.length > 0) {
|
|
601
|
+
result.push(...this.flattenObjects(obj.children));
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return result;
|
|
605
|
+
}
|
|
606
|
+
getLightComponentType(lightType) {
|
|
607
|
+
const typeMap = {
|
|
608
|
+
directional: "UDirectionalLightComponent",
|
|
609
|
+
point: "UPointLightComponent",
|
|
610
|
+
spot: "USpotLightComponent",
|
|
611
|
+
area: "URectLightComponent"
|
|
612
|
+
};
|
|
613
|
+
return typeMap[lightType] || "UPointLightComponent";
|
|
614
|
+
}
|
|
615
|
+
getMeshPath(meshType) {
|
|
616
|
+
const meshPaths = {
|
|
617
|
+
cube: "/Engine/BasicShapes/Cube.Cube",
|
|
618
|
+
box: "/Engine/BasicShapes/Cube.Cube",
|
|
619
|
+
sphere: "/Engine/BasicShapes/Sphere.Sphere",
|
|
620
|
+
cylinder: "/Engine/BasicShapes/Cylinder.Cylinder",
|
|
621
|
+
cone: "/Engine/BasicShapes/Cone.Cone",
|
|
622
|
+
plane: "/Engine/BasicShapes/Plane.Plane"
|
|
623
|
+
};
|
|
624
|
+
return meshPaths[meshType] || null;
|
|
625
|
+
}
|
|
626
|
+
findObjProp(obj, key) {
|
|
627
|
+
return obj.properties?.find((p) => p.key === key)?.value;
|
|
628
|
+
}
|
|
629
|
+
toCppType(value) {
|
|
630
|
+
if (value === null) return "UObject*";
|
|
631
|
+
if (typeof value === "boolean") return "bool";
|
|
632
|
+
if (typeof value === "number") return Number.isInteger(value) ? "int32" : "float";
|
|
633
|
+
if (typeof value === "string") return "FString";
|
|
634
|
+
if (Array.isArray(value)) {
|
|
635
|
+
if (value.length === 3 && value.every((v) => typeof v === "number")) return "FVector";
|
|
636
|
+
if (value.length === 4 && value.every((v) => typeof v === "number")) return "FQuat";
|
|
637
|
+
return "TArray<float>";
|
|
638
|
+
}
|
|
639
|
+
return "UObject*";
|
|
640
|
+
}
|
|
641
|
+
compileUnrealDomainBlocks(composition) {
|
|
642
|
+
const domainBlocks = composition.domainBlocks ?? [];
|
|
643
|
+
if (domainBlocks.length === 0) return;
|
|
644
|
+
this.emitS("");
|
|
645
|
+
this.emitS("// === v4.2 Domain Blocks ===");
|
|
646
|
+
let blockIdx = 0;
|
|
647
|
+
const compiled = chunkHKEXJUWS_cjs.compileDomainBlocks(
|
|
648
|
+
domainBlocks,
|
|
649
|
+
{
|
|
650
|
+
material: (block) => {
|
|
651
|
+
const mat = chunkHKEXJUWS_cjs.compileMaterialBlock(block);
|
|
652
|
+
return chunkHKEXJUWS_cjs.materialToUnreal(mat, `DB${blockIdx++}`);
|
|
653
|
+
},
|
|
654
|
+
physics: (block) => {
|
|
655
|
+
const phys = chunkHKEXJUWS_cjs.compilePhysicsBlock(block);
|
|
656
|
+
return chunkHKEXJUWS_cjs.physicsToUnreal(phys, `DB${blockIdx++}`);
|
|
657
|
+
},
|
|
658
|
+
vfx: (block) => {
|
|
659
|
+
const ps = chunkHKEXJUWS_cjs.compileParticleBlock(block);
|
|
660
|
+
return chunkHKEXJUWS_cjs.particlesToUnreal(ps, `DB${blockIdx++}`);
|
|
661
|
+
},
|
|
662
|
+
postfx: (block) => {
|
|
663
|
+
const pp = chunkHKEXJUWS_cjs.compilePostProcessingBlock(block);
|
|
664
|
+
return chunkHKEXJUWS_cjs.postProcessingToUnreal(pp, `DB${blockIdx++}`);
|
|
665
|
+
},
|
|
666
|
+
audio: (block) => {
|
|
667
|
+
const audio = chunkHKEXJUWS_cjs.compileAudioSourceBlock(block);
|
|
668
|
+
return chunkHKEXJUWS_cjs.audioSourceToUnreal(audio, `DB${blockIdx++}`);
|
|
669
|
+
},
|
|
670
|
+
weather: (block) => {
|
|
671
|
+
const weather = chunkHKEXJUWS_cjs.compileWeatherBlock(block);
|
|
672
|
+
return chunkHKEXJUWS_cjs.weatherToUnreal(weather);
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
(block) => `// Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "TypeScript")}"`
|
|
676
|
+
);
|
|
677
|
+
for (const line of compiled) {
|
|
678
|
+
for (const l of line.split("\n")) {
|
|
679
|
+
this.emitS(l);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
toLinearColor(value) {
|
|
684
|
+
if (typeof value === "string") {
|
|
685
|
+
if (value.startsWith("#")) {
|
|
686
|
+
const hex = value.slice(1);
|
|
687
|
+
if (hex.length === 6) {
|
|
688
|
+
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
689
|
+
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
690
|
+
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
691
|
+
return `FLinearColor(${r}f, ${g}f, ${b}f)`;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
const colors = {
|
|
695
|
+
red: "FLinearColor::Red",
|
|
696
|
+
green: "FLinearColor::Green",
|
|
697
|
+
blue: "FLinearColor::Blue",
|
|
698
|
+
white: "FLinearColor::White",
|
|
699
|
+
black: "FLinearColor::Black",
|
|
700
|
+
yellow: "FLinearColor::Yellow"
|
|
701
|
+
};
|
|
702
|
+
return colors[value.toLowerCase()] || "FLinearColor::White";
|
|
703
|
+
}
|
|
704
|
+
if (Array.isArray(value) && value.length >= 3) {
|
|
705
|
+
const [r, g, b, a = 1] = value;
|
|
706
|
+
return `FLinearColor(${r}f, ${g}f, ${b}f, ${a}f)`;
|
|
707
|
+
}
|
|
708
|
+
return "FLinearColor::White";
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
exports.UnrealCompiler_exports = UnrealCompiler_exports;
|
|
715
|
+
exports.compileToUnreal = compileToUnreal;
|
|
716
|
+
exports.init_UnrealCompiler = init_UnrealCompiler;
|
|
717
|
+
//# sourceMappingURL=chunk-AVJHHUC5.cjs.map
|
|
718
|
+
//# sourceMappingURL=chunk-AVJHHUC5.cjs.map
|