@holoscript/core 6.0.3 → 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.
Files changed (244) hide show
  1. package/README.md +40 -40
  2. package/dist/codebase/index.d.ts +25 -0
  3. package/dist/compiler/index.d.ts +82 -0
  4. package/dist/constants.d.ts +4 -0
  5. package/dist/coordinators/index.d.ts +189 -0
  6. package/dist/entries/interop.d.ts +9 -0
  7. package/dist/entries/scripting.d.ts +7 -0
  8. package/dist/index.d.ts +520 -19
  9. package/dist/paper-0c-spike/index.d.ts +29 -0
  10. package/dist/reconstruction/index.d.ts +78 -0
  11. package/dist/self-improvement/index.d.ts +0 -48
  12. package/dist/storage/index.d.ts +24 -0
  13. package/dist/tools/index.d.ts +33 -0
  14. package/dist/traitDocs/traitDocs.d.ts +69 -0
  15. package/dist/traits/index.d.ts +61 -0
  16. package/package.json +102 -19
  17. package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
  18. package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
  19. package/dist/HoloScriptPlusParser-BZR5DELQ.js +0 -692
  20. package/dist/HoloScriptPlusParser-SBMYDNXO.cjs +0 -697
  21. package/dist/USDZExporter-MHEHXZB4.cjs +0 -709
  22. package/dist/USDZExporter-YA55ZS35.js +0 -707
  23. package/dist/chunk-26TLYBFD.js +0 -309
  24. package/dist/chunk-27LWW5FU.cjs +0 -410
  25. package/dist/chunk-2UX5LRAP.cjs +0 -833
  26. package/dist/chunk-32TWR3HE.js +0 -70
  27. package/dist/chunk-3FXV5S25.cjs +0 -633
  28. package/dist/chunk-3FYZOR7S.cjs +0 -69
  29. package/dist/chunk-3KEU5QYY.cjs +0 -175
  30. package/dist/chunk-4FCZDTD5.js +0 -610
  31. package/dist/chunk-4KJ2R7VP.cjs +0 -507
  32. package/dist/chunk-4SMUJFHL.js +0 -1213
  33. package/dist/chunk-54FHG2MX.js +0 -655
  34. package/dist/chunk-56IF4NTA.js +0 -56
  35. package/dist/chunk-5GLCTO44.js +0 -161
  36. package/dist/chunk-5TOFIR6L.js +0 -407
  37. package/dist/chunk-65RFOWZI.js +0 -765
  38. package/dist/chunk-6OQBLABR.js +0 -5240
  39. package/dist/chunk-6WNCRE6F.js +0 -126
  40. package/dist/chunk-74YCHHTE.js +0 -1872
  41. package/dist/chunk-7H5UNJZD.cjs +0 -1973
  42. package/dist/chunk-7KPI4EKH.cjs +0 -701
  43. package/dist/chunk-7LCYLPW2.cjs +0 -663
  44. package/dist/chunk-7N3JIJMT.js +0 -1395
  45. package/dist/chunk-7X2IEJIE.cjs +0 -2526
  46. package/dist/chunk-A6GO3DPZ.cjs +0 -1002
  47. package/dist/chunk-AC4BSHFV.js +0 -765
  48. package/dist/chunk-AIUXRS74.cjs +0 -3681
  49. package/dist/chunk-ARNKA274.cjs +0 -130
  50. package/dist/chunk-AW7WAELW.js +0 -975
  51. package/dist/chunk-BKIGPPVM.js +0 -629
  52. package/dist/chunk-BO2OKHIY.js +0 -6055
  53. package/dist/chunk-BU5ZAFMC.js +0 -115
  54. package/dist/chunk-BY3B7ZYV.cjs +0 -457
  55. package/dist/chunk-C2QHVHZF.js +0 -4066
  56. package/dist/chunk-C7BNX4XJ.js +0 -1043
  57. package/dist/chunk-CLYEIWA5.cjs +0 -408
  58. package/dist/chunk-CMYAWUX3.js +0 -4455
  59. package/dist/chunk-CN4NOESF.cjs +0 -416
  60. package/dist/chunk-CNVM7J3M.js +0 -883
  61. package/dist/chunk-CO2VM2DK.js +0 -1965
  62. package/dist/chunk-CQDOF3G7.cjs +0 -1404
  63. package/dist/chunk-DH5G2JUA.cjs +0 -614
  64. package/dist/chunk-DIEDKX5B.cjs +0 -660
  65. package/dist/chunk-DN7UFU63.cjs +0 -172
  66. package/dist/chunk-DXVCEFZB.js +0 -2027
  67. package/dist/chunk-EGIZHYJP.cjs +0 -85
  68. package/dist/chunk-EJA7G2C4.cjs +0 -428
  69. package/dist/chunk-ELLQPFAF.js +0 -830
  70. package/dist/chunk-EMO7HAKJ.cjs +0 -1875
  71. package/dist/chunk-ENV7K6XA.js +0 -282
  72. package/dist/chunk-EPWRXL6S.js +0 -2522
  73. package/dist/chunk-EUFLX2PI.js +0 -56956
  74. package/dist/chunk-F5LVGHNT.js +0 -449
  75. package/dist/chunk-FEFHPUEM.cjs +0 -6122
  76. package/dist/chunk-FF3Q7ADR.js +0 -380
  77. package/dist/chunk-GC3YU46J.js +0 -762
  78. package/dist/chunk-H6WMMLQK.cjs +0 -4492
  79. package/dist/chunk-H7XMORZI.js +0 -2731
  80. package/dist/chunk-HAN4V3PF.cjs +0 -2037
  81. package/dist/chunk-HBZYCASG.js +0 -4208
  82. package/dist/chunk-HF4OFY25.cjs +0 -4097
  83. package/dist/chunk-HHS6FMOU.cjs +0 -3813
  84. package/dist/chunk-HJJLD366.js +0 -1169
  85. package/dist/chunk-HKCVM6OK.cjs +0 -2237
  86. package/dist/chunk-HUFNKFA6.js +0 -698
  87. package/dist/chunk-I3XGTIHM.cjs +0 -1505
  88. package/dist/chunk-I6XZ5DZF.cjs +0 -488
  89. package/dist/chunk-IHOUYQIA.js +0 -406
  90. package/dist/chunk-ILRBGFVD.cjs +0 -72
  91. package/dist/chunk-KDB6BUMB.js +0 -3666
  92. package/dist/chunk-KUJRR4FJ.js +0 -657
  93. package/dist/chunk-KYM4XRFG.js +0 -421
  94. package/dist/chunk-L3Z2HIWJ.cjs +0 -793
  95. package/dist/chunk-LBPEZQAF.js +0 -2232
  96. package/dist/chunk-LER4WXW5.cjs +0 -286
  97. package/dist/chunk-LK5IAVH6.cjs +0 -1173
  98. package/dist/chunk-M6FU6S22.js +0 -2911
  99. package/dist/chunk-MWEFR6YQ.js +0 -1857
  100. package/dist/chunk-N5FTS757.cjs +0 -415
  101. package/dist/chunk-NCUHGRTZ.js +0 -752
  102. package/dist/chunk-NKRKT6V2.js +0 -69
  103. package/dist/chunk-NLPSZT4C.js +0 -630
  104. package/dist/chunk-NRUB55IT.cjs +0 -771
  105. package/dist/chunk-NTMZSDXM.cjs +0 -633
  106. package/dist/chunk-ODGMVILH.js +0 -9662
  107. package/dist/chunk-PBA6NXCT.cjs +0 -1216
  108. package/dist/chunk-PHENW4MQ.js +0 -65
  109. package/dist/chunk-PJMOXFPR.cjs +0 -1861
  110. package/dist/chunk-PLMYCCA4.js +0 -504
  111. package/dist/chunk-PPULB4GG.cjs +0 -9728
  112. package/dist/chunk-PQLGZKMC.cjs +0 -755
  113. package/dist/chunk-Q56TT7IL.js +0 -483
  114. package/dist/chunk-QHVVVN47.cjs +0 -2033
  115. package/dist/chunk-QWKUKVRE.js +0 -2026
  116. package/dist/chunk-RE3OKSYF.cjs +0 -424
  117. package/dist/chunk-RT7LJRSF.cjs +0 -57378
  118. package/dist/chunk-SPDELRRV.cjs +0 -319
  119. package/dist/chunk-SUCBB66F.js +0 -229
  120. package/dist/chunk-TSWTWZ42.cjs +0 -4214
  121. package/dist/chunk-UITWA6DV.cjs +0 -2829
  122. package/dist/chunk-UQW6SLM5.js +0 -172
  123. package/dist/chunk-V2ILLPHK.cjs +0 -237
  124. package/dist/chunk-V42NTCFH.js +0 -3645
  125. package/dist/chunk-VJ3L7CHT.cjs +0 -169
  126. package/dist/chunk-VJVCD5T5.cjs +0 -769
  127. package/dist/chunk-VK5AXKO3.js +0 -746
  128. package/dist/chunk-VSXOIUCF.cjs +0 -473
  129. package/dist/chunk-VZNKJZTT.cjs +0 -749
  130. package/dist/chunk-W76ETJTI.js +0 -678
  131. package/dist/chunk-WFJIDI2N.cjs +0 -424
  132. package/dist/chunk-WN3YF33G.cjs +0 -118
  133. package/dist/chunk-WUXIRGZP.cjs +0 -2915
  134. package/dist/chunk-WYH4GVZ5.js +0 -1488
  135. package/dist/chunk-X4YVN7H3.cjs +0 -888
  136. package/dist/chunk-X67XRI2T.js +0 -410
  137. package/dist/chunk-XDXZM3ZP.cjs +0 -1046
  138. package/dist/chunk-XH7SE4HH.cjs +0 -72
  139. package/dist/chunk-XNMEH2BI.js +0 -126
  140. package/dist/chunk-XSF76QRU.js +0 -468
  141. package/dist/chunk-XSUZMPVQ.cjs +0 -682
  142. package/dist/chunk-XUILI4KB.cjs +0 -430
  143. package/dist/chunk-Y5MUAYTO.js +0 -167
  144. package/dist/chunk-Y7VK5TH3.cjs +0 -129
  145. package/dist/chunk-YCMQQQ5U.cjs +0 -5244
  146. package/dist/chunk-YYXH45E2.js +0 -426
  147. package/dist/chunk-ZGTGVSTZ.js +0 -422
  148. package/dist/chunk-ZL6VJ6SN.js +0 -421
  149. package/dist/cli/holoscript-runner.cjs +0 -2258
  150. package/dist/cli/holoscript-runner.js +0 -2233
  151. package/dist/codebase/index.cjs +0 -336
  152. package/dist/codebase/index.js +0 -331
  153. package/dist/compiler/agent-inference.cjs +0 -29
  154. package/dist/compiler/agent-inference.js +0 -6
  155. package/dist/compiler/android-xr.cjs +0 -20
  156. package/dist/compiler/android-xr.js +0 -10
  157. package/dist/compiler/android.cjs +0 -21
  158. package/dist/compiler/android.js +0 -11
  159. package/dist/compiler/ar.cjs +0 -21
  160. package/dist/compiler/ar.js +0 -9
  161. package/dist/compiler/babylon.cjs +0 -18
  162. package/dist/compiler/babylon.js +0 -12
  163. package/dist/compiler/coco.cjs +0 -27
  164. package/dist/compiler/coco.js +0 -4
  165. package/dist/compiler/domain-block-utils.cjs +0 -595
  166. package/dist/compiler/domain-block-utils.js +0 -9
  167. package/dist/compiler/dtdl.cjs +0 -25
  168. package/dist/compiler/dtdl.js +0 -9
  169. package/dist/compiler/gltf-pipeline.cjs +0 -39
  170. package/dist/compiler/gltf-pipeline.js +0 -4
  171. package/dist/compiler/godot.cjs +0 -16
  172. package/dist/compiler/godot.js +0 -10
  173. package/dist/compiler/incremental.cjs +0 -30
  174. package/dist/compiler/incremental.js +0 -5
  175. package/dist/compiler/index.cjs +0 -1522
  176. package/dist/compiler/index.js +0 -1321
  177. package/dist/compiler/ios.cjs +0 -21
  178. package/dist/compiler/ios.js +0 -11
  179. package/dist/compiler/multi-layer.cjs +0 -27
  180. package/dist/compiler/multi-layer.js +0 -12
  181. package/dist/compiler/nodetoy.cjs +0 -23
  182. package/dist/compiler/nodetoy.js +0 -4
  183. package/dist/compiler/openxr.cjs +0 -16
  184. package/dist/compiler/openxr.js +0 -10
  185. package/dist/compiler/playcanvas.cjs +0 -17
  186. package/dist/compiler/playcanvas.js +0 -11
  187. package/dist/compiler/r3f.cjs +0 -35
  188. package/dist/compiler/r3f.js +0 -13
  189. package/dist/compiler/remotion.cjs +0 -23
  190. package/dist/compiler/remotion.js +0 -4
  191. package/dist/compiler/reproducibility.cjs +0 -39
  192. package/dist/compiler/reproducibility.js +0 -4
  193. package/dist/compiler/sdf.cjs +0 -22
  194. package/dist/compiler/sdf.js +0 -10
  195. package/dist/compiler/semantic-scene.cjs +0 -31
  196. package/dist/compiler/semantic-scene.js +0 -4
  197. package/dist/compiler/state.cjs +0 -18
  198. package/dist/compiler/state.js +0 -8
  199. package/dist/compiler/trait-composition.cjs +0 -27
  200. package/dist/compiler/trait-composition.js +0 -6
  201. package/dist/compiler/unity.cjs +0 -16
  202. package/dist/compiler/unity.js +0 -10
  203. package/dist/compiler/unreal.cjs +0 -20
  204. package/dist/compiler/unreal.js +0 -10
  205. package/dist/compiler/urdf.cjs +0 -46
  206. package/dist/compiler/urdf.js +0 -10
  207. package/dist/compiler/usd-physics.cjs +0 -24
  208. package/dist/compiler/usd-physics.js +0 -7
  209. package/dist/compiler/visionos.cjs +0 -16
  210. package/dist/compiler/visionos.js +0 -10
  211. package/dist/compiler/vrchat.cjs +0 -20
  212. package/dist/compiler/vrchat.js +0 -10
  213. package/dist/compiler/vrr.cjs +0 -22
  214. package/dist/compiler/vrr.js +0 -10
  215. package/dist/compiler/wasm.cjs +0 -34
  216. package/dist/compiler/wasm.js +0 -10
  217. package/dist/compiler/webgpu.cjs +0 -16
  218. package/dist/compiler/webgpu.js +0 -10
  219. package/dist/debugger.cjs +0 -21
  220. package/dist/debugger.js +0 -8
  221. package/dist/entries/interop.cjs +0 -62
  222. package/dist/entries/interop.js +0 -5
  223. package/dist/entries/scripting.cjs +0 -67
  224. package/dist/entries/scripting.js +0 -10
  225. package/dist/index.cjs +0 -61703
  226. package/dist/index.js +0 -58652
  227. package/dist/math/vec3.cjs +0 -57
  228. package/dist/math/vec3.js +0 -4
  229. package/dist/parser.cjs +0 -26
  230. package/dist/parser.js +0 -9
  231. package/dist/playwright-7DTEQCBD.cjs +0 -98673
  232. package/dist/playwright-BIZXMLD2.js +0 -98660
  233. package/dist/post-quantum-JTTAAGO3.cjs +0 -6
  234. package/dist/post-quantum-RVPVDEPI.js +0 -4
  235. package/dist/runtime.cjs +0 -16
  236. package/dist/runtime.js +0 -7
  237. package/dist/storage/index.cjs +0 -37
  238. package/dist/storage/index.js +0 -4
  239. package/dist/traits/index.cjs +0 -14331
  240. package/dist/traits/index.js +0 -12126
  241. package/dist/type-checker.cjs +0 -18
  242. package/dist/type-checker.js +0 -5
  243. package/dist/wot/index.cjs +0 -29
  244. package/dist/wot/index.js +0 -4
@@ -1,678 +0,0 @@
1
- import { init_DomainBlockCompilerMixin, compileDomainBlocks, compileWeatherBlock, weatherToUnreal, compileAudioSourceBlock, audioSourceToUnreal, compilePostProcessingBlock, postProcessingToUnreal, compileParticleBlock, particlesToUnreal, compilePhysicsBlock, physicsToUnreal, compileMaterialBlock, materialToUnreal } from './chunk-KDB6BUMB.js';
2
- import { createTestCompilerToken, init_CompilerBase, init_ANSNamespace, CompilerBase, ANSCapabilityPath } from './chunk-QWKUKVRE.js';
3
- import { __export, __esm } from './chunk-32TWR3HE.js';
4
-
5
- // src/compiler/UnrealCompiler.ts
6
- var UnrealCompiler_exports = {};
7
- __export(UnrealCompiler_exports, {
8
- UnrealCompiler: () => UnrealCompiler,
9
- compileToUnreal: () => compileToUnreal
10
- });
11
- function compileToUnreal(composition, options) {
12
- const compiler = new UnrealCompiler(options);
13
- return compiler.compile(composition, createTestCompilerToken());
14
- }
15
- var UnrealCompiler;
16
- var init_UnrealCompiler = __esm({
17
- "src/compiler/UnrealCompiler.ts"() {
18
- init_CompilerBase();
19
- init_ANSNamespace();
20
- init_DomainBlockCompilerMixin();
21
- UnrealCompiler = class extends CompilerBase {
22
- constructor(options = {}) {
23
- super();
24
- this.compilerName = "UnrealCompiler";
25
- this.headerLines = [];
26
- this.sourceLines = [];
27
- this.indentLevel = 0;
28
- this.currentFile = "header";
29
- this.options = {
30
- moduleName: options.moduleName || "HoloWorld",
31
- className: options.className || "AGeneratedScene",
32
- indent: options.indent || " ",
33
- engineVersion: options.engineVersion || "5.4",
34
- useEnhancedInput: options.useEnhancedInput ?? true,
35
- generateBlueprints: options.generateBlueprints ?? false
36
- };
37
- }
38
- getRequiredCapability() {
39
- return ANSCapabilityPath.UNREAL;
40
- }
41
- compile(composition, agentToken, outputPath) {
42
- this.validateCompilerAccess(agentToken, outputPath);
43
- this.headerLines = [];
44
- this.sourceLines = [];
45
- this.indentLevel = 0;
46
- const headerFile = this.generateHeader(composition);
47
- const sourceFile = this.generateSource(composition);
48
- const result = {
49
- headerFile,
50
- sourceFile
51
- };
52
- if (this.options.generateBlueprints) {
53
- result.blueprintJson = this.generateBlueprintJson(composition);
54
- }
55
- return result;
56
- }
57
- generateHeader(composition) {
58
- this.headerLines = [];
59
- this.currentFile = "header";
60
- this.indentLevel = 0;
61
- this.emitH("// Auto-generated by HoloScript UnrealCompiler");
62
- this.emitH(
63
- `// Source: composition "${this.escapeStringValue(composition.name, "TypeScript")}"`
64
- );
65
- this.emitH(`// Unreal Engine: ${this.options.engineVersion}`);
66
- this.emitH("// Do not edit manually \u2014 regenerate from .holo source");
67
- this.emitH("");
68
- this.emitH("#pragma once");
69
- this.emitH("");
70
- this.emitH('#include "CoreMinimal.h"');
71
- this.emitH('#include "GameFramework/Actor.h"');
72
- this.emitH('#include "Components/StaticMeshComponent.h"');
73
- this.emitH('#include "Components/PointLightComponent.h"');
74
- this.emitH('#include "Components/SpotLightComponent.h"');
75
- this.emitH('#include "Components/DirectionalLightComponent.h"');
76
- this.emitH('#include "Components/AudioComponent.h"');
77
- this.emitH('#include "Components/BoxComponent.h"');
78
- this.emitH('#include "Components/SphereComponent.h"');
79
- if (composition.objects?.some((o) => o.traits?.some((t) => t.name === "physics"))) {
80
- this.emitH('#include "PhysicsEngine/PhysicsConstraintComponent.h"');
81
- }
82
- if (this.options.useEnhancedInput) {
83
- this.emitH('#include "EnhancedInputComponent.h"');
84
- this.emitH('#include "EnhancedInputSubsystems.h"');
85
- }
86
- this.emitH(`#include "${this.options.className.replace(/^A/, "")}.generated.h"`);
87
- this.emitH("");
88
- this.emitH("// Forward declarations");
89
- this.emitH("class UNiagaraComponent;");
90
- this.emitH("class UWidgetComponent;");
91
- this.emitH("");
92
- this.emitH("UCLASS(Blueprintable, BlueprintType)");
93
- this.emitH(
94
- `class ${this.options.moduleName.toUpperCase()}_API ${this.options.className} : public AActor`
95
- );
96
- this.emitH("{");
97
- this.indentLevel++;
98
- this.emitH("GENERATED_BODY()");
99
- this.emitH("");
100
- this.emitH("public:");
101
- this.emitH(`${this.options.className}();`);
102
- this.emitH("");
103
- this.emitH("// === Scene Components ===");
104
- this.emitH('UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "HoloScript")');
105
- this.emitH("USceneComponent* RootSceneComponent;");
106
- this.emitH("");
107
- for (const obj of composition.objects || []) {
108
- const varName = this.sanitizeName(obj.name);
109
- const compType = this.getComponentType(obj);
110
- this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Objects")`);
111
- this.emitH(`${compType}* ${varName};`);
112
- }
113
- this.emitH("");
114
- for (const light of composition.lights || []) {
115
- const varName = this.sanitizeName(light.name);
116
- const lightType = this.getLightComponentType(light.lightType);
117
- this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lighting")`);
118
- this.emitH(`${lightType}* ${varName};`);
119
- }
120
- this.emitH("");
121
- for (const audio of composition.audio || []) {
122
- const varName = this.sanitizeName(audio.name);
123
- this.emitH(`UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Audio")`);
124
- this.emitH(`UAudioComponent* ${varName};`);
125
- }
126
- this.emitH("");
127
- if (composition.state) {
128
- this.emitH("// === State Properties ===");
129
- for (const prop of composition.state.properties) {
130
- const cppType = this.toCppType(prop.value);
131
- this.emitH(`UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "State")`);
132
- this.emitH(`${cppType} ${this.escapeStringValue(prop.key, "TypeScript")};`);
133
- }
134
- this.emitH("");
135
- }
136
- this.emitH("protected:");
137
- this.emitH("virtual void BeginPlay() override;");
138
- this.emitH("virtual void Tick(float DeltaTime) override;");
139
- this.emitH(
140
- "virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;"
141
- );
142
- this.emitH("");
143
- this.emitH("public:");
144
- this.emitH("// === Blueprint Callable Functions ===");
145
- if (composition.logic?.actions) {
146
- for (const action of composition.logic.actions) {
147
- this.emitH(`UFUNCTION(BlueprintCallable, Category = "HoloScript")`);
148
- this.emitH(`void ${this.sanitizeName(action.name)}();`);
149
- }
150
- }
151
- this.emitH("");
152
- for (const tl of composition.timelines || []) {
153
- const name = this.sanitizeName(tl.name);
154
- this.emitH(`UFUNCTION(BlueprintCallable, Category = "Timelines")`);
155
- this.emitH(`void Play${name}();`);
156
- }
157
- this.emitH("");
158
- for (const tr of composition.transitions || []) {
159
- const name = this.sanitizeName(tr.name);
160
- this.emitH(`UFUNCTION(BlueprintCallable, Category = "Transitions")`);
161
- this.emitH(`void ${name}Transition();`);
162
- }
163
- if (composition.zones?.length) {
164
- this.emitH("");
165
- this.emitH("// === Zone Overlap Handlers ===");
166
- for (const zone of composition.zones) {
167
- const name = this.sanitizeName(zone.name);
168
- this.emitH(`UFUNCTION()`);
169
- this.emitH(
170
- `void On${name}BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);`
171
- );
172
- this.emitH(`UFUNCTION()`);
173
- this.emitH(
174
- `void On${name}EndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);`
175
- );
176
- }
177
- }
178
- this.emitH("");
179
- this.emitH("private:");
180
- this.emitH("void SetupComponents();");
181
- this.emitH("void SetupEnvironment();");
182
- if (composition.zones?.length) {
183
- this.emitH("void SetupZones();");
184
- }
185
- this.indentLevel--;
186
- this.emitH("};");
187
- return this.headerLines.join("\n");
188
- }
189
- generateSource(composition) {
190
- this.sourceLines = [];
191
- this.currentFile = "source";
192
- this.indentLevel = 0;
193
- const headerName = this.options.className.replace(/^A/, "");
194
- this.emitS("// Auto-generated by HoloScript UnrealCompiler");
195
- this.emitS(
196
- `// Source: composition "${this.escapeStringValue(composition.name, "TypeScript")}"`
197
- );
198
- this.emitS("");
199
- this.emitS(`#include "${headerName}.h"`);
200
- this.emitS('#include "Net/UnrealNetwork.h"');
201
- this.emitS('#include "Engine/StaticMesh.h"');
202
- this.emitS('#include "Materials/MaterialInstanceDynamic.h"');
203
- if (composition.audio?.length) {
204
- this.emitS('#include "Sound/SoundBase.h"');
205
- }
206
- this.emitS("");
207
- this.emitS(`${this.options.className}::${this.options.className}()`);
208
- this.emitS("{");
209
- this.indentLevel++;
210
- this.emitS("PrimaryActorTick.bCanEverTick = true;");
211
- this.emitS("bReplicates = true;");
212
- this.emitS("");
213
- this.emitS("// Root component");
214
- this.emitS(
215
- 'RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));'
216
- );
217
- this.emitS("RootComponent = RootSceneComponent;");
218
- this.emitS("");
219
- this.emitS("SetupComponents();");
220
- this.indentLevel--;
221
- this.emitS("}");
222
- this.emitS("");
223
- this.emitS(`void ${this.options.className}::SetupComponents()`);
224
- this.emitS("{");
225
- this.indentLevel++;
226
- for (const obj of composition.objects || []) {
227
- this.compileObjectSetup(obj);
228
- }
229
- for (const light of composition.lights || []) {
230
- this.compileLightSetup(light);
231
- }
232
- for (const audio of composition.audio || []) {
233
- this.compileAudioSetup(audio);
234
- }
235
- this.compileUnrealDomainBlocks(composition);
236
- this.indentLevel--;
237
- this.emitS("}");
238
- this.emitS("");
239
- this.emitS(`void ${this.options.className}::SetupEnvironment()`);
240
- this.emitS("{");
241
- this.indentLevel++;
242
- if (composition.environment) {
243
- this.compileEnvironment(composition.environment);
244
- } else {
245
- this.emitS("// No environment configuration");
246
- }
247
- this.indentLevel--;
248
- this.emitS("}");
249
- this.emitS("");
250
- if (composition.zones?.length) {
251
- this.emitS(`void ${this.options.className}::SetupZones()`);
252
- this.emitS("{");
253
- this.indentLevel++;
254
- for (const zone of composition.zones) {
255
- this.compileZoneSetup(zone);
256
- }
257
- this.indentLevel--;
258
- this.emitS("}");
259
- this.emitS("");
260
- for (const zone of composition.zones) {
261
- this.compileZoneHandlers(zone);
262
- }
263
- }
264
- this.emitS(`void ${this.options.className}::BeginPlay()`);
265
- this.emitS("{");
266
- this.indentLevel++;
267
- this.emitS("Super::BeginPlay();");
268
- this.emitS("");
269
- this.emitS("SetupEnvironment();");
270
- if (composition.zones?.length) {
271
- this.emitS("SetupZones();");
272
- }
273
- this.emitS("");
274
- this.emitS(
275
- `UE_LOG(LogTemp, Log, TEXT("HoloScript scene '${this.escapeStringValue(composition.name, "TypeScript")}' initialized"));`
276
- );
277
- for (const tl of composition.timelines || []) {
278
- if (tl.autoplay) {
279
- this.emitS(`Play${this.sanitizeName(tl.name)}();`);
280
- }
281
- }
282
- this.indentLevel--;
283
- this.emitS("}");
284
- this.emitS("");
285
- this.emitS(`void ${this.options.className}::Tick(float DeltaTime)`);
286
- this.emitS("{");
287
- this.indentLevel++;
288
- this.emitS("Super::Tick(DeltaTime);");
289
- this.indentLevel--;
290
- this.emitS("}");
291
- this.emitS("");
292
- this.emitS(
293
- `void ${this.options.className}::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const`
294
- );
295
- this.emitS("{");
296
- this.indentLevel++;
297
- this.emitS("Super::GetLifetimeReplicatedProps(OutLifetimeProps);");
298
- if (composition.state) {
299
- this.emitS("");
300
- for (const prop of composition.state.properties) {
301
- this.emitS(
302
- `DOREPLIFETIME(${this.options.className}, ${this.escapeStringValue(prop.key, "TypeScript")});`
303
- );
304
- }
305
- }
306
- this.indentLevel--;
307
- this.emitS("}");
308
- this.emitS("");
309
- for (const tl of composition.timelines || []) {
310
- this.compileTimelineFunction(tl);
311
- }
312
- for (const tr of composition.transitions || []) {
313
- this.compileTransitionFunction(tr);
314
- }
315
- if (composition.logic?.actions) {
316
- for (const action of composition.logic.actions) {
317
- this.compileActionFunction(action);
318
- }
319
- }
320
- return this.sourceLines.join("\n");
321
- }
322
- compileObjectSetup(obj) {
323
- const varName = this.sanitizeName(obj.name);
324
- const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
325
- const isModel = !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src");
326
- this.emitS(`// Object: ${this.escapeStringValue(obj.name, "TypeScript")}`);
327
- this.emitS(
328
- `${varName} = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("${this.escapeStringValue(obj.name, "TypeScript")}"));`
329
- );
330
- this.emitS(`${varName}->SetupAttachment(RootComponent);`);
331
- if (!isModel) {
332
- const meshPath = this.getMeshPath(meshType);
333
- if (meshPath) {
334
- this.emitS(
335
- `static ConstructorHelpers::FObjectFinder<UStaticMesh> ${varName}MeshAsset(TEXT("${meshPath}"));`
336
- );
337
- this.emitS(
338
- `if (${varName}MeshAsset.Succeeded()) { ${varName}->SetStaticMesh(${varName}MeshAsset.Object); }`
339
- );
340
- }
341
- }
342
- const pos = this.findObjProp(obj, "position");
343
- if (pos && Array.isArray(pos)) {
344
- this.emitS(
345
- `${varName}->SetRelativeLocation(FVector(${pos[0] * 100}f, ${pos[2] * 100}f, ${pos[1] * 100}f));`
346
- );
347
- }
348
- const rot = this.findObjProp(obj, "rotation");
349
- if (rot && Array.isArray(rot)) {
350
- this.emitS(`${varName}->SetRelativeRotation(FRotator(${rot[0]}f, ${rot[1]}f, ${rot[2]}f));`);
351
- }
352
- const scale = this.findObjProp(obj, "scale");
353
- if (scale) {
354
- if (Array.isArray(scale)) {
355
- this.emitS(
356
- `${varName}->SetRelativeScale3D(FVector(${scale[0]}f, ${scale[1]}f, ${scale[2]}f));`
357
- );
358
- } else {
359
- this.emitS(`${varName}->SetRelativeScale3D(FVector(${scale}f));`);
360
- }
361
- }
362
- if (obj.traits) {
363
- for (const trait of obj.traits) {
364
- this.compileTraitSetup(varName, trait);
365
- }
366
- }
367
- this.emitS("");
368
- }
369
- compileTraitSetup(varName, trait) {
370
- switch (trait.name) {
371
- case "physics":
372
- this.emitS(`${varName}->SetSimulatePhysics(true);`);
373
- if (trait.config?.mass) {
374
- this.emitS(`${varName}->SetMassOverrideInKg(NAME_None, ${trait.config.mass}f, true);`);
375
- }
376
- break;
377
- case "collidable":
378
- this.emitS(`${varName}->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);`);
379
- this.emitS(`${varName}->SetCollisionResponseToAllChannels(ECR_Block);`);
380
- break;
381
- case "grabbable":
382
- this.emitS(`// @grabbable \u2014 implement via GrabComponent or VR interaction framework`);
383
- break;
384
- case "pointable":
385
- case "hoverable":
386
- this.emitS(
387
- `// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 implement via line trace interaction`
388
- );
389
- break;
390
- case "portal":
391
- this.emitS(`// @portal \u2014 destination: "${trait.config?.destination || "unknown"}"`);
392
- break;
393
- case "emissive":
394
- case "glowing":
395
- this.emitS(
396
- `// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 apply emissive material`
397
- );
398
- break;
399
- case "transparent":
400
- this.emitS(`// @transparent \u2014 set material blend mode`);
401
- break;
402
- default:
403
- this.emitS(
404
- `// @${this.escapeStringValue(trait.name, "TypeScript")} \u2014 custom trait implementation required`
405
- );
406
- }
407
- }
408
- compileLightSetup(light) {
409
- const varName = this.sanitizeName(light.name);
410
- const lightType = this.getLightComponentType(light.lightType);
411
- this.emitS(`// Light: ${this.escapeStringValue(light.name, "TypeScript")}`);
412
- this.emitS(
413
- `${varName} = CreateDefaultSubobject<${lightType}>(TEXT("${this.escapeStringValue(light.name, "TypeScript")}"));`
414
- );
415
- this.emitS(`${varName}->SetupAttachment(RootComponent);`);
416
- for (const prop of light.properties) {
417
- if (prop.key === "color") {
418
- this.emitS(`${varName}->SetLightColor(${this.toLinearColor(prop.value)});`);
419
- } else if (prop.key === "intensity") {
420
- const intensity = prop.value * 1e4;
421
- this.emitS(`${varName}->SetIntensity(${intensity}f);`);
422
- } else if (prop.key === "position" && Array.isArray(prop.value)) {
423
- const pos = prop.value;
424
- this.emitS(
425
- `${varName}->SetRelativeLocation(FVector(${pos[0] * 100}f, ${pos[2] * 100}f, ${pos[1] * 100}f));`
426
- );
427
- } else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
428
- this.emitS(`${varName}->SetCastShadows(${prop.value ? "true" : "false"});`);
429
- }
430
- }
431
- this.emitS("");
432
- }
433
- compileAudioSetup(audio) {
434
- const varName = this.sanitizeName(audio.name);
435
- this.emitS(`// Audio: ${this.escapeStringValue(audio.name, "TypeScript")}`);
436
- this.emitS(
437
- `${varName} = CreateDefaultSubobject<UAudioComponent>(TEXT("${this.escapeStringValue(audio.name, "TypeScript")}"));`
438
- );
439
- this.emitS(`${varName}->SetupAttachment(RootComponent);`);
440
- this.emitS(`${varName}->bAutoActivate = false;`);
441
- this.emitS("");
442
- }
443
- compileEnvironment(env) {
444
- for (const prop of env.properties) {
445
- if (prop.key === "skybox" || prop.key === "preset") {
446
- this.emitS(
447
- `// Environment preset: "${prop.value}" \u2014 configure via BP_Sky_Sphere or SkyAtmosphere`
448
- );
449
- } else if (prop.key === "fog" && typeof prop.value === "object") {
450
- this.emitS("// Fog settings \u2014 configure via ExponentialHeightFog actor");
451
- } else if (prop.key === "ambient_light") {
452
- this.emitS(`// Ambient light: ${prop.value} \u2014 configure via SkyLight`);
453
- }
454
- }
455
- }
456
- compileZoneSetup(zone) {
457
- const varName = this.sanitizeName(zone.name);
458
- this.emitS(
459
- `// Zone: ${this.escapeStringValue(zone.name, "TypeScript")} \u2014 bind overlap events`
460
- );
461
- this.emitS(
462
- `// ${varName}Trigger->OnComponentBeginOverlap.AddDynamic(this, &${this.options.className}::On${varName}BeginOverlap);`
463
- );
464
- this.emitS(
465
- `// ${varName}Trigger->OnComponentEndOverlap.AddDynamic(this, &${this.options.className}::On${varName}EndOverlap);`
466
- );
467
- }
468
- compileZoneHandlers(zone) {
469
- const varName = this.sanitizeName(zone.name);
470
- this.emitS(
471
- `void ${this.options.className}::On${varName}BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)`
472
- );
473
- this.emitS("{");
474
- this.indentLevel++;
475
- this.emitS(
476
- `UE_LOG(LogTemp, Log, TEXT("Actor entered zone: ${this.escapeStringValue(zone.name, "TypeScript")}"));`
477
- );
478
- this.indentLevel--;
479
- this.emitS("}");
480
- this.emitS("");
481
- this.emitS(
482
- `void ${this.options.className}::On${varName}EndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)`
483
- );
484
- this.emitS("{");
485
- this.indentLevel++;
486
- this.emitS(
487
- `UE_LOG(LogTemp, Log, TEXT("Actor exited zone: ${this.escapeStringValue(zone.name, "TypeScript")}"));`
488
- );
489
- this.indentLevel--;
490
- this.emitS("}");
491
- this.emitS("");
492
- }
493
- compileTimelineFunction(timeline) {
494
- const name = this.sanitizeName(timeline.name);
495
- this.emitS(`void ${this.options.className}::Play${name}()`);
496
- this.emitS("{");
497
- this.indentLevel++;
498
- this.emitS(
499
- `UE_LOG(LogTemp, Log, TEXT("Playing timeline: ${this.escapeStringValue(timeline.name, "TypeScript")}"));`
500
- );
501
- this.emitS("// Timeline implementation via FTimeline or native Sequencer");
502
- for (const entry of timeline.entries) {
503
- this.emitS(`// At ${entry.time}s: ${entry.action.kind}`);
504
- }
505
- this.indentLevel--;
506
- this.emitS("}");
507
- this.emitS("");
508
- }
509
- compileTransitionFunction(transition) {
510
- const name = this.sanitizeName(transition.name);
511
- this.emitS(`void ${this.options.className}::${name}Transition()`);
512
- this.emitS("{");
513
- this.indentLevel++;
514
- const dest = transition.properties.find((p) => p.key === "destination" || p.key === "to");
515
- if (dest) {
516
- this.emitS(`UE_LOG(LogTemp, Log, TEXT("Transitioning to: ${dest.value}"));`);
517
- this.emitS(`UGameplayStatics::OpenLevel(this, TEXT("${dest.value}"));`);
518
- }
519
- this.indentLevel--;
520
- this.emitS("}");
521
- this.emitS("");
522
- }
523
- compileActionFunction(action) {
524
- const name = this.sanitizeName(action.name);
525
- this.emitS(`void ${this.options.className}::${name}()`);
526
- this.emitS("{");
527
- this.indentLevel++;
528
- this.emitS(
529
- `UE_LOG(LogTemp, Log, TEXT("Action: ${this.escapeStringValue(action.name, "TypeScript")}"));`
530
- );
531
- this.emitS("// Action implementation");
532
- this.indentLevel--;
533
- this.emitS("}");
534
- this.emitS("");
535
- }
536
- generateBlueprintJson(composition) {
537
- return JSON.stringify(
538
- {
539
- type: "Blueprint",
540
- class: this.options.className,
541
- composition: composition.name,
542
- objects: composition.objects?.map((o) => ({
543
- name: o.name,
544
- traits: o.traits?.map((t) => t.name) || []
545
- })) || []
546
- },
547
- null,
548
- 2
549
- );
550
- }
551
- // === Utility Methods ===
552
- emitH(line) {
553
- const indent = this.options.indent.repeat(this.indentLevel);
554
- this.headerLines.push(indent + line);
555
- }
556
- emitS(line) {
557
- const indent = this.options.indent.repeat(this.indentLevel);
558
- this.sourceLines.push(indent + line);
559
- }
560
- sanitizeName(name) {
561
- return name.replace(/[^a-zA-Z0-9_]/g, "_").replace(/^[0-9]/, "_$&");
562
- }
563
- getComponentType(obj) {
564
- const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type");
565
- if (meshType === "text") return "UTextRenderComponent";
566
- return "UStaticMeshComponent";
567
- }
568
- getLightComponentType(lightType) {
569
- const typeMap = {
570
- directional: "UDirectionalLightComponent",
571
- point: "UPointLightComponent",
572
- spot: "USpotLightComponent",
573
- area: "URectLightComponent"
574
- };
575
- return typeMap[lightType] || "UPointLightComponent";
576
- }
577
- getMeshPath(meshType) {
578
- const meshPaths = {
579
- cube: "/Engine/BasicShapes/Cube.Cube",
580
- box: "/Engine/BasicShapes/Cube.Cube",
581
- sphere: "/Engine/BasicShapes/Sphere.Sphere",
582
- cylinder: "/Engine/BasicShapes/Cylinder.Cylinder",
583
- cone: "/Engine/BasicShapes/Cone.Cone",
584
- plane: "/Engine/BasicShapes/Plane.Plane"
585
- };
586
- return meshPaths[meshType] || null;
587
- }
588
- findObjProp(obj, key) {
589
- return obj.properties?.find((p) => p.key === key)?.value;
590
- }
591
- toCppType(value) {
592
- if (value === null) return "UObject*";
593
- if (typeof value === "boolean") return "bool";
594
- if (typeof value === "number") return Number.isInteger(value) ? "int32" : "float";
595
- if (typeof value === "string") return "FString";
596
- if (Array.isArray(value)) {
597
- if (value.length === 3 && value.every((v) => typeof v === "number")) return "FVector";
598
- if (value.length === 4 && value.every((v) => typeof v === "number")) return "FQuat";
599
- return "TArray<float>";
600
- }
601
- return "UObject*";
602
- }
603
- compileUnrealDomainBlocks(composition) {
604
- const domainBlocks = composition.domainBlocks ?? [];
605
- if (domainBlocks.length === 0) return;
606
- this.emitS("");
607
- this.emitS("// === v4.2 Domain Blocks ===");
608
- let blockIdx = 0;
609
- const compiled = compileDomainBlocks(
610
- domainBlocks,
611
- {
612
- material: (block) => {
613
- const mat = compileMaterialBlock(block);
614
- return materialToUnreal(mat, `DB${blockIdx++}`);
615
- },
616
- physics: (block) => {
617
- const phys = compilePhysicsBlock(block);
618
- return physicsToUnreal(phys, `DB${blockIdx++}`);
619
- },
620
- vfx: (block) => {
621
- const ps = compileParticleBlock(block);
622
- return particlesToUnreal(ps, `DB${blockIdx++}`);
623
- },
624
- postfx: (block) => {
625
- const pp = compilePostProcessingBlock(block);
626
- return postProcessingToUnreal(pp, `DB${blockIdx++}`);
627
- },
628
- audio: (block) => {
629
- const audio = compileAudioSourceBlock(block);
630
- return audioSourceToUnreal(audio, `DB${blockIdx++}`);
631
- },
632
- weather: (block) => {
633
- const weather = compileWeatherBlock(block);
634
- return weatherToUnreal(weather);
635
- }
636
- },
637
- (block) => `// Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "TypeScript")}"`
638
- );
639
- for (const line of compiled) {
640
- for (const l of line.split("\n")) {
641
- this.emitS(l);
642
- }
643
- }
644
- }
645
- toLinearColor(value) {
646
- if (typeof value === "string") {
647
- if (value.startsWith("#")) {
648
- const hex = value.slice(1);
649
- if (hex.length === 6) {
650
- const r = parseInt(hex.slice(0, 2), 16) / 255;
651
- const g = parseInt(hex.slice(2, 4), 16) / 255;
652
- const b = parseInt(hex.slice(4, 6), 16) / 255;
653
- return `FLinearColor(${r}f, ${g}f, ${b}f)`;
654
- }
655
- }
656
- const colors = {
657
- red: "FLinearColor::Red",
658
- green: "FLinearColor::Green",
659
- blue: "FLinearColor::Blue",
660
- white: "FLinearColor::White",
661
- black: "FLinearColor::Black",
662
- yellow: "FLinearColor::Yellow"
663
- };
664
- return colors[value.toLowerCase()] || "FLinearColor::White";
665
- }
666
- if (Array.isArray(value) && value.length >= 3) {
667
- const [r, g, b, a = 1] = value;
668
- return `FLinearColor(${r}f, ${g}f, ${b}f, ${a}f)`;
669
- }
670
- return "FLinearColor::White";
671
- }
672
- };
673
- }
674
- });
675
-
676
- export { UnrealCompiler, UnrealCompiler_exports, compileToUnreal, init_UnrealCompiler };
677
- //# sourceMappingURL=chunk-W76ETJTI.js.map
678
- //# sourceMappingURL=chunk-W76ETJTI.js.map