@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.
Files changed (236) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/compiler/index.d.ts +82 -0
  4. package/dist/constants.d.ts +3 -2
  5. package/dist/coordinators/index.d.ts +189 -0
  6. package/dist/index.d.ts +501 -19
  7. package/dist/paper-0c-spike/index.d.ts +29 -0
  8. package/dist/reconstruction/index.d.ts +78 -0
  9. package/dist/tools/index.d.ts +22 -1
  10. package/dist/traitDocs/traitDocs.d.ts +69 -0
  11. package/dist/traits/index.d.ts +61 -0
  12. package/package.json +105 -57
  13. package/dist/GLTFPipeline-DEN36VNK.js +0 -12
  14. package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
  15. package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
  16. package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
  17. package/dist/USDZExporter-NTMBNTDB.js +0 -707
  18. package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
  19. package/dist/chunk-27LWW5FU.cjs +0 -410
  20. package/dist/chunk-2CWOLHTE.js +0 -69
  21. package/dist/chunk-33LSUQDD.cjs +0 -835
  22. package/dist/chunk-3FJCK5XA.js +0 -2232
  23. package/dist/chunk-3FXV5S25.cjs +0 -633
  24. package/dist/chunk-3FYZOR7S.cjs +0 -69
  25. package/dist/chunk-3SAK5KFL.cjs +0 -83
  26. package/dist/chunk-4XSNJCLC.cjs +0 -1859
  27. package/dist/chunk-54FHG2MX.js +0 -655
  28. package/dist/chunk-56IF4NTA.js +0 -56
  29. package/dist/chunk-5BGSECRJ.cjs +0 -2237
  30. package/dist/chunk-5GLCTO44.js +0 -161
  31. package/dist/chunk-5O6TQC6M.cjs +0 -1871
  32. package/dist/chunk-5OEOHAAW.cjs +0 -682
  33. package/dist/chunk-5TOFIR6L.js +0 -407
  34. package/dist/chunk-5WUNN6ZN.cjs +0 -428
  35. package/dist/chunk-6TZPZCOJ.cjs +0 -1404
  36. package/dist/chunk-6UEHYZ7V.cjs +0 -773
  37. package/dist/chunk-6XSERL6L.js +0 -5678
  38. package/dist/chunk-72EQECGT.cjs +0 -908
  39. package/dist/chunk-7AGYRWKW.cjs +0 -507
  40. package/dist/chunk-7LCYLPW2.cjs +0 -663
  41. package/dist/chunk-A7PIMZGU.js +0 -263
  42. package/dist/chunk-ATSKSYVE.cjs +0 -51683
  43. package/dist/chunk-B5TCIAPQ.cjs +0 -117
  44. package/dist/chunk-BF2235SI.cjs +0 -5714
  45. package/dist/chunk-BKIGPPVM.js +0 -629
  46. package/dist/chunk-BND3ST2K.cjs +0 -662
  47. package/dist/chunk-BU7VWW2K.js +0 -2522
  48. package/dist/chunk-BWFJEM5A.js +0 -5419
  49. package/dist/chunk-CAUCGUEA.cjs +0 -130
  50. package/dist/chunk-CBJSLA2E.cjs +0 -5423
  51. package/dist/chunk-CDPGV4DN.js +0 -114
  52. package/dist/chunk-CLYEIWA5.cjs +0 -408
  53. package/dist/chunk-CS2EMTGF.js +0 -1966
  54. package/dist/chunk-DMG7C4H2.js +0 -975
  55. package/dist/chunk-DXJQDCFL.js +0 -468
  56. package/dist/chunk-E3FWRT3Z.js +0 -608
  57. package/dist/chunk-E3UALNFA.js +0 -421
  58. package/dist/chunk-EONILVMF.js +0 -762
  59. package/dist/chunk-EQV4R3EV.cjs +0 -769
  60. package/dist/chunk-F3HH56EB.cjs +0 -5538
  61. package/dist/chunk-F4IULT7N.js +0 -1488
  62. package/dist/chunk-FF3Q7ADR.js +0 -380
  63. package/dist/chunk-FFKU7BTK.cjs +0 -1046
  64. package/dist/chunk-FHQVYCH2.js +0 -70
  65. package/dist/chunk-FSF7EQVA.cjs +0 -1974
  66. package/dist/chunk-G4VZTCIB.js +0 -659
  67. package/dist/chunk-G7CT3EMP.cjs +0 -1002
  68. package/dist/chunk-GGHSW2NN.js +0 -51334
  69. package/dist/chunk-GVUR45UF.cjs +0 -777
  70. package/dist/chunk-H5Z7NASB.js +0 -9662
  71. package/dist/chunk-HE7ULERA.cjs +0 -697
  72. package/dist/chunk-HJJLD366.js +0 -1169
  73. package/dist/chunk-HPS76H7Q.js +0 -309
  74. package/dist/chunk-HQUEA5R6.cjs +0 -424
  75. package/dist/chunk-HYNTS5CP.js +0 -422
  76. package/dist/chunk-I6XZ5DZF.cjs +0 -488
  77. package/dist/chunk-IBDG74G2.cjs +0 -1219
  78. package/dist/chunk-IFNQFCTM.js +0 -3098
  79. package/dist/chunk-IHOUYQIA.js +0 -406
  80. package/dist/chunk-ILRBGFVD.cjs +0 -72
  81. package/dist/chunk-IWI6J7FX.js +0 -421
  82. package/dist/chunk-K3JDKWGI.cjs +0 -270
  83. package/dist/chunk-K6EKD26I.js +0 -630
  84. package/dist/chunk-KCQ5NDYC.cjs +0 -3172
  85. package/dist/chunk-KED34ILP.js +0 -832
  86. package/dist/chunk-KSGXLT74.cjs +0 -457
  87. package/dist/chunk-L4G4RLXX.js +0 -767
  88. package/dist/chunk-LDP5OK6G.js +0 -1216
  89. package/dist/chunk-LGGRPKTV.cjs +0 -735
  90. package/dist/chunk-LK5IAVH6.cjs +0 -1173
  91. package/dist/chunk-LSW7P7ML.js +0 -3675
  92. package/dist/chunk-LXJ4667L.cjs +0 -3874
  93. package/dist/chunk-LZ266PCM.cjs +0 -4499
  94. package/dist/chunk-MD6KDHVE.cjs +0 -237
  95. package/dist/chunk-MEASWI2Y.js +0 -126
  96. package/dist/chunk-MPXBVFHQ.js +0 -768
  97. package/dist/chunk-N5FTS757.cjs +0 -415
  98. package/dist/chunk-NCUKG4SK.cjs +0 -3075
  99. package/dist/chunk-NDQNIJEH.js +0 -1715
  100. package/dist/chunk-NOZZ46QU.js +0 -168
  101. package/dist/chunk-OFKWH2IP.js +0 -449
  102. package/dist/chunk-PHENW4MQ.js +0 -65
  103. package/dist/chunk-PMGODDJA.cjs +0 -319
  104. package/dist/chunk-Q4QX3AET.cjs +0 -1505
  105. package/dist/chunk-Q56TT7IL.js +0 -483
  106. package/dist/chunk-Q5JT3YML.cjs +0 -129
  107. package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
  108. package/dist/chunk-QGKNANZ3.js +0 -3071
  109. package/dist/chunk-QLEAOI3Q.cjs +0 -424
  110. package/dist/chunk-R7MA7QWV.js +0 -732
  111. package/dist/chunk-RVYPEYPX.js +0 -678
  112. package/dist/chunk-S2N5TNMA.js +0 -1855
  113. package/dist/chunk-S565K7NK.js +0 -752
  114. package/dist/chunk-SDAMZIRE.js +0 -765
  115. package/dist/chunk-T36DDXSF.js +0 -4250
  116. package/dist/chunk-T4NKMBDL.js +0 -5474
  117. package/dist/chunk-T7LEXZUZ.cjs +0 -2526
  118. package/dist/chunk-TEWCN33Y.js +0 -694
  119. package/dist/chunk-TQSZUOW5.cjs +0 -793
  120. package/dist/chunk-TSH3MSQU.cjs +0 -129
  121. package/dist/chunk-UERJ3YJV.js +0 -504
  122. package/dist/chunk-UPJBDCVF.js +0 -1395
  123. package/dist/chunk-V3NN3HPP.js +0 -4462
  124. package/dist/chunk-VJ3L7CHT.cjs +0 -169
  125. package/dist/chunk-WB4Z63GG.js +0 -229
  126. package/dist/chunk-WDW67DZB.cjs +0 -9728
  127. package/dist/chunk-WGMEAYBG.js +0 -126
  128. package/dist/chunk-X4ZF6CNE.cjs +0 -473
  129. package/dist/chunk-X6SEAXAX.cjs +0 -3681
  130. package/dist/chunk-XCWFGZAA.js +0 -1043
  131. package/dist/chunk-XD6IYDUX.js +0 -903
  132. package/dist/chunk-XG23EUQX.cjs +0 -1717
  133. package/dist/chunk-XRKWN5PL.cjs +0 -173
  134. package/dist/chunk-XUILI4KB.cjs +0 -430
  135. package/dist/chunk-XUTX5CBW.js +0 -126
  136. package/dist/chunk-XWPNTWDN.cjs +0 -755
  137. package/dist/chunk-XXINBTZK.cjs +0 -633
  138. package/dist/chunk-YCXFCXDS.js +0 -1868
  139. package/dist/chunk-YQK5JNFK.js +0 -3725
  140. package/dist/chunk-YYXH45E2.js +0 -426
  141. package/dist/chunk-Z34RLXRA.cjs +0 -612
  142. package/dist/chunk-ZP4D3CSX.cjs +0 -72
  143. package/dist/cli/holoscript-runner.cjs +0 -2259
  144. package/dist/cli/holoscript-runner.js +0 -2234
  145. package/dist/codebase/index.cjs +0 -336
  146. package/dist/codebase/index.js +0 -331
  147. package/dist/compiler/agent-inference.cjs +0 -28
  148. package/dist/compiler/agent-inference.js +0 -5
  149. package/dist/compiler/android-xr.cjs +0 -19
  150. package/dist/compiler/android-xr.js +0 -9
  151. package/dist/compiler/android.cjs +0 -20
  152. package/dist/compiler/android.js +0 -10
  153. package/dist/compiler/ar.cjs +0 -20
  154. package/dist/compiler/ar.js +0 -8
  155. package/dist/compiler/babylon.cjs +0 -17
  156. package/dist/compiler/babylon.js +0 -11
  157. package/dist/compiler/coco.cjs +0 -27
  158. package/dist/compiler/coco.js +0 -4
  159. package/dist/compiler/domain-block-utils.cjs +0 -602
  160. package/dist/compiler/domain-block-utils.js +0 -8
  161. package/dist/compiler/dtdl.cjs +0 -24
  162. package/dist/compiler/dtdl.js +0 -8
  163. package/dist/compiler/gltf-pipeline.cjs +0 -39
  164. package/dist/compiler/gltf-pipeline.js +0 -4
  165. package/dist/compiler/godot.cjs +0 -15
  166. package/dist/compiler/godot.js +0 -9
  167. package/dist/compiler/incremental.cjs +0 -29
  168. package/dist/compiler/incremental.js +0 -4
  169. package/dist/compiler/index.cjs +0 -2578
  170. package/dist/compiler/index.js +0 -2383
  171. package/dist/compiler/ios.cjs +0 -20
  172. package/dist/compiler/ios.js +0 -10
  173. package/dist/compiler/multi-layer.cjs +0 -20
  174. package/dist/compiler/multi-layer.js +0 -11
  175. package/dist/compiler/nodetoy.cjs +0 -23
  176. package/dist/compiler/nodetoy.js +0 -4
  177. package/dist/compiler/openxr.cjs +0 -15
  178. package/dist/compiler/openxr.js +0 -9
  179. package/dist/compiler/playcanvas.cjs +0 -16
  180. package/dist/compiler/playcanvas.js +0 -10
  181. package/dist/compiler/r3f.cjs +0 -34
  182. package/dist/compiler/r3f.js +0 -12
  183. package/dist/compiler/remotion.cjs +0 -23
  184. package/dist/compiler/remotion.js +0 -4
  185. package/dist/compiler/reproducibility.cjs +0 -39
  186. package/dist/compiler/reproducibility.js +0 -4
  187. package/dist/compiler/sdf.cjs +0 -21
  188. package/dist/compiler/sdf.js +0 -9
  189. package/dist/compiler/semantic-scene.cjs +0 -31
  190. package/dist/compiler/semantic-scene.js +0 -4
  191. package/dist/compiler/state.cjs +0 -17
  192. package/dist/compiler/state.js +0 -7
  193. package/dist/compiler/trait-composition.cjs +0 -26
  194. package/dist/compiler/trait-composition.js +0 -5
  195. package/dist/compiler/unity.cjs +0 -15
  196. package/dist/compiler/unity.js +0 -9
  197. package/dist/compiler/unreal.cjs +0 -19
  198. package/dist/compiler/unreal.js +0 -9
  199. package/dist/compiler/urdf.cjs +0 -45
  200. package/dist/compiler/urdf.js +0 -9
  201. package/dist/compiler/usd-physics.cjs +0 -23
  202. package/dist/compiler/usd-physics.js +0 -6
  203. package/dist/compiler/visionos.cjs +0 -15
  204. package/dist/compiler/visionos.js +0 -9
  205. package/dist/compiler/vrchat.cjs +0 -19
  206. package/dist/compiler/vrchat.js +0 -9
  207. package/dist/compiler/vrr.cjs +0 -21
  208. package/dist/compiler/vrr.js +0 -9
  209. package/dist/compiler/wasm.cjs +0 -33
  210. package/dist/compiler/wasm.js +0 -9
  211. package/dist/compiler/webgpu.cjs +0 -15
  212. package/dist/compiler/webgpu.js +0 -9
  213. package/dist/debugger.cjs +0 -21
  214. package/dist/debugger.js +0 -8
  215. package/dist/entries/interop.cjs +0 -62
  216. package/dist/entries/interop.js +0 -5
  217. package/dist/entries/scripting.cjs +0 -68
  218. package/dist/entries/scripting.js +0 -11
  219. package/dist/index.cjs +0 -40921
  220. package/dist/index.js +0 -37763
  221. package/dist/math/vec3.cjs +0 -57
  222. package/dist/math/vec3.js +0 -4
  223. package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
  224. package/dist/ml-dsa-WYLJHJO6.js +0 -1178
  225. package/dist/parser.cjs +0 -27
  226. package/dist/parser.js +0 -10
  227. package/dist/playwright-5OSAPTNH.js +0 -98660
  228. package/dist/playwright-RL6GY4F7.cjs +0 -98673
  229. package/dist/runtime.cjs +0 -16
  230. package/dist/runtime.js +0 -7
  231. package/dist/storage/index.cjs +0 -37
  232. package/dist/storage/index.js +0 -4
  233. package/dist/traits/index.cjs +0 -14649
  234. package/dist/traits/index.js +0 -12243
  235. package/dist/type-checker.cjs +0 -18
  236. package/dist/type-checker.js +0 -5
@@ -1,678 +0,0 @@
1
- import { init_DomainBlockCompilerMixin, compileDomainBlocks, compileWeatherBlock, weatherToUnreal, compileAudioSourceBlock, audioSourceToUnreal, compilePostProcessingBlock, postProcessingToUnreal, compileParticleBlock, particlesToUnreal, compilePhysicsBlock, physicsToUnreal, compileMaterialBlock, materialToUnreal } from './chunk-YQK5JNFK.js';
2
- import { createTestCompilerToken, init_CompilerBase, CompilerBase } from './chunk-6XSERL6L.js';
3
- import { __export, __esm } from './chunk-2CWOLHTE.js';
4
- import { ANSCapabilityPath } from '@holoscript/platform';
5
-
6
- // src/compiler/UnrealCompiler.ts
7
- var UnrealCompiler_exports = {};
8
- __export(UnrealCompiler_exports, {
9
- UnrealCompiler: () => UnrealCompiler,
10
- compileToUnreal: () => compileToUnreal
11
- });
12
- function compileToUnreal(composition, options) {
13
- const compiler = new UnrealCompiler(options);
14
- return compiler.compile(composition, createTestCompilerToken());
15
- }
16
- var UnrealCompiler;
17
- var init_UnrealCompiler = __esm({
18
- "src/compiler/UnrealCompiler.ts"() {
19
- init_CompilerBase();
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-RVYPEYPX.js.map
678
- //# sourceMappingURL=chunk-RVYPEYPX.js.map