@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,633 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkLXJ4667L_cjs = require('./chunk-LXJ4667L.cjs');
4
- var chunkBF2235SI_cjs = require('./chunk-BF2235SI.cjs');
5
- var chunk3SAK5KFL_cjs = require('./chunk-3SAK5KFL.cjs');
6
- var platform = require('@holoscript/platform');
7
-
8
- // src/compiler/GodotCompiler.ts
9
- var GodotCompiler_exports = {};
10
- chunk3SAK5KFL_cjs.__export(GodotCompiler_exports, {
11
- GodotCompiler: () => exports.GodotCompiler
12
- });
13
- exports.GodotCompiler = void 0;
14
- var init_GodotCompiler = chunk3SAK5KFL_cjs.__esm({
15
- "src/compiler/GodotCompiler.ts"() {
16
- chunkBF2235SI_cjs.init_CompilerBase();
17
- chunkLXJ4667L_cjs.init_DomainBlockCompilerMixin();
18
- exports.GodotCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
19
- constructor(options = {}) {
20
- super();
21
- this.compilerName = "GodotCompiler";
22
- this.lines = [];
23
- this.indentLevel = 0;
24
- this.options = {
25
- className: options.className || "GeneratedScene",
26
- indent: options.indent || " ",
27
- godotVersion: options.godotVersion || "4.3"
28
- };
29
- }
30
- getRequiredCapability() {
31
- return platform.ANSCapabilityPath.GODOT;
32
- }
33
- compile(composition, agentToken, outputPath) {
34
- this.validateCompilerAccess(agentToken, outputPath);
35
- this.lines = [];
36
- this.indentLevel = 0;
37
- this.emit(`# Auto-generated by HoloScript GodotCompiler`);
38
- this.emit(
39
- `# Source: composition "${this.escapeStringValue(composition.name, "GDScript")}"`
40
- );
41
- this.emit(`# Target: Godot ${this.options.godotVersion}`);
42
- this.emit(`# Do not edit manually \u2014 regenerate from .holo source`);
43
- this.emit("");
44
- this.emit("extends Node3D");
45
- this.emit(`class_name ${this.options.className}`);
46
- this.emit("");
47
- if (composition.state) {
48
- this.emit("# === State ===");
49
- for (const prop of composition.state.properties) {
50
- const gdVal = this.toGDScriptValue(prop.value);
51
- this.emit(`var ${this.escapeStringValue(prop.key, "GDScript")} = ${gdVal}`);
52
- }
53
- this.emit("");
54
- }
55
- this.emit("func _ready():");
56
- this.indentLevel++;
57
- if (composition.environment) {
58
- this.compileEnvironment(composition.environment);
59
- }
60
- if (composition.lights) {
61
- for (const light of composition.lights) {
62
- this.compileLight(light);
63
- }
64
- }
65
- if (composition.camera) {
66
- this.compileCamera(composition.camera);
67
- }
68
- if (composition.objects) {
69
- for (const obj of composition.objects) {
70
- this.compileObject(obj, "self");
71
- }
72
- }
73
- if (composition.spatialGroups) {
74
- for (const group of composition.spatialGroups) {
75
- this.compileSpatialGroup(group, "self");
76
- }
77
- }
78
- if (composition.audio) {
79
- for (const audio of composition.audio) {
80
- this.compileAudio(audio);
81
- }
82
- }
83
- if (composition.zones) {
84
- for (const zone of composition.zones) {
85
- this.compileZone(zone);
86
- }
87
- }
88
- if (composition.timelines) {
89
- for (const tl of composition.timelines) {
90
- if (tl.autoplay) {
91
- this.emit(`_play_${this.sanitizeName(tl.name)}()`);
92
- }
93
- }
94
- }
95
- if (composition.ui) {
96
- this.compileUI(composition.ui);
97
- }
98
- this.indentLevel--;
99
- this.emit("");
100
- if (composition.timelines) {
101
- for (const tl of composition.timelines) {
102
- this.compileTimeline(tl);
103
- }
104
- }
105
- if (composition.transitions) {
106
- for (const tr of composition.transitions) {
107
- this.compileTransition(tr);
108
- }
109
- }
110
- if (composition.effects) {
111
- this.compileEffects(composition.effects);
112
- }
113
- this.compileGodotDomainBlocks(composition);
114
- return this.lines.join("\n");
115
- }
116
- compileGodotDomainBlocks(composition) {
117
- const domainBlocks = composition.domainBlocks ?? [];
118
- if (domainBlocks.length === 0) return;
119
- this.emit("");
120
- this.emit("# === v4.2 Domain Blocks ===");
121
- let blockIdx = 0;
122
- const compiled = chunkLXJ4667L_cjs.compileDomainBlocks(
123
- domainBlocks,
124
- {
125
- material: (block) => {
126
- const mat = chunkLXJ4667L_cjs.compileMaterialBlock(block);
127
- return chunkLXJ4667L_cjs.materialToGodot(mat, `db${blockIdx++}`);
128
- },
129
- physics: (block) => {
130
- const phys = chunkLXJ4667L_cjs.compilePhysicsBlock(block);
131
- return chunkLXJ4667L_cjs.physicsToGodot(phys, `db${blockIdx++}`);
132
- },
133
- vfx: (block) => {
134
- const ps = chunkLXJ4667L_cjs.compileParticleBlock(block);
135
- return chunkLXJ4667L_cjs.particlesToGodot(ps, `db${blockIdx++}`);
136
- },
137
- postfx: (block) => {
138
- const pp = chunkLXJ4667L_cjs.compilePostProcessingBlock(block);
139
- return chunkLXJ4667L_cjs.postProcessingToGodot(pp);
140
- },
141
- audio: (block) => {
142
- const audio = chunkLXJ4667L_cjs.compileAudioSourceBlock(block);
143
- return chunkLXJ4667L_cjs.audioSourceToGodot(audio, `db${blockIdx++}`);
144
- },
145
- weather: (block) => {
146
- const weather = chunkLXJ4667L_cjs.compileWeatherBlock(block);
147
- return chunkLXJ4667L_cjs.weatherToGodot(weather);
148
- },
149
- narrative: (block) => {
150
- const narr = chunkLXJ4667L_cjs.compileNarrativeBlock(block);
151
- return chunkLXJ4667L_cjs.narrativeToGodot(narr);
152
- },
153
- payment: (block) => {
154
- const pay = chunkLXJ4667L_cjs.compilePaymentBlock(block);
155
- return chunkLXJ4667L_cjs.paymentToGodot(pay);
156
- },
157
- healthcare: (block) => {
158
- const h = chunkLXJ4667L_cjs.compileHealthcareBlock(block);
159
- return chunkLXJ4667L_cjs.healthcareToGodot(h);
160
- },
161
- robotics: (block) => {
162
- const r = chunkLXJ4667L_cjs.compileRoboticsBlock(block);
163
- return chunkLXJ4667L_cjs.roboticsToGodot(r);
164
- },
165
- iot: (block) => chunkLXJ4667L_cjs.iotToGodot(chunkLXJ4667L_cjs.compileIoTBlock(block)),
166
- dataviz: (block) => chunkLXJ4667L_cjs.datavizToGodot(chunkLXJ4667L_cjs.compileDataVizBlock(block)),
167
- education: (block) => chunkLXJ4667L_cjs.educationToGodot(chunkLXJ4667L_cjs.compileEducationBlock(block)),
168
- music: (block) => chunkLXJ4667L_cjs.musicToGodot(chunkLXJ4667L_cjs.compileMusicBlock(block)),
169
- architecture: (block) => chunkLXJ4667L_cjs.architectureToGodot(chunkLXJ4667L_cjs.compileArchitectureBlock(block)),
170
- web3: (block) => chunkLXJ4667L_cjs.web3ToGodot(chunkLXJ4667L_cjs.compileWeb3Block(block)),
171
- procedural: (block) => chunkLXJ4667L_cjs.proceduralToGodot(chunkLXJ4667L_cjs.compileProceduralBlock(block)),
172
- rendering: (block) => chunkLXJ4667L_cjs.renderingToGodot(chunkLXJ4667L_cjs.compileRenderingBlock(block)),
173
- navigation: (block) => chunkLXJ4667L_cjs.navigationToGodot(chunkLXJ4667L_cjs.compileNavigationBlock(block)),
174
- input: (block) => chunkLXJ4667L_cjs.inputToGodot(chunkLXJ4667L_cjs.compileInputBlock(block))
175
- },
176
- (block) => `# Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "GDScript")}"`
177
- );
178
- for (const line of compiled) {
179
- for (const l of line.split("\n")) {
180
- this.emit(l);
181
- }
182
- }
183
- }
184
- compileEnvironment(env) {
185
- this.emit("# === Environment ===");
186
- for (const prop of env.properties) {
187
- if (prop.key === "preset" || prop.key === "skybox") {
188
- this.emit(`var env = WorldEnvironment.new()`);
189
- this.emit(`env.environment = Environment.new()`);
190
- this.emit(`env.environment.background_mode = Environment.BG_SKY`);
191
- this.emit(`add_child(env)`);
192
- } else if (prop.key === "fog" && typeof prop.value === "object") {
193
- const fog = prop.value;
194
- this.emit(`# Fog settings`);
195
- if (fog.color) this.emit(`# fog_color: ${fog.color}`);
196
- if (fog.near !== void 0) this.emit(`# fog_near: ${fog.near}`);
197
- if (fog.far !== void 0) this.emit(`# fog_far: ${fog.far}`);
198
- } else if (prop.key === "ambient_light") {
199
- this.emit(`# Ambient light intensity: ${prop.value}`);
200
- }
201
- }
202
- this.emit("");
203
- }
204
- compileLight(light) {
205
- const varName = this.sanitizeName(light.name);
206
- this.emit(`# Light: ${this.escapeStringValue(light.name, "GDScript")}`);
207
- const typeMap = {
208
- directional: "DirectionalLight3D",
209
- point: "OmniLight3D",
210
- spot: "SpotLight3D"
211
- };
212
- const gdType = typeMap[light.lightType] || "DirectionalLight3D";
213
- this.emit(`var ${varName} = ${gdType}.new()`);
214
- this.emit(`${varName}.name = "${this.escapeStringValue(light.name, "GDScript")}"`);
215
- for (const prop of light.properties) {
216
- if (prop.key === "color") {
217
- this.emit(`${varName}.light_color = ${this.toColor(prop.value)}`);
218
- } else if (prop.key === "intensity") {
219
- this.emit(`${varName}.light_energy = ${prop.value}`);
220
- } else if (prop.key === "position" && Array.isArray(prop.value)) {
221
- this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
222
- } else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
223
- this.emit(`${varName}.shadow_enabled = ${prop.value}`);
224
- } else if (prop.key === "distance") {
225
- this.emit(`${varName}.omni_range = ${prop.value}`);
226
- }
227
- }
228
- this.emit(`add_child(${varName})`);
229
- this.emit("");
230
- }
231
- compileCamera(camera) {
232
- this.emit("# === Camera ===");
233
- this.emit("var cam = Camera3D.new()");
234
- const fov = this.findProp(camera.properties, "fov");
235
- if (fov) this.emit(`cam.fov = ${fov}`);
236
- const pos = this.findProp(camera.properties, "position");
237
- if (pos) this.emit(`cam.position = ${this.toVector3(pos)}`);
238
- const lookAt = this.findProp(camera.properties, "look_at") || this.findProp(camera.properties, "lookAt");
239
- if (lookAt) this.emit(`cam.look_at(${this.toVector3(lookAt)})`);
240
- const near = this.findProp(camera.properties, "near");
241
- if (near) this.emit(`cam.near = ${near}`);
242
- const far = this.findProp(camera.properties, "far");
243
- if (far) this.emit(`cam.far = ${far}`);
244
- this.emit("cam.current = true");
245
- this.emit("add_child(cam)");
246
- this.emit("");
247
- }
248
- compileObject(obj, parentVar) {
249
- const varName = this.sanitizeName(obj.name);
250
- const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
251
- const isText = meshType === "text";
252
- const isModel = !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src");
253
- const isSparkles = meshType === "sparkles";
254
- const isLight = ["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(
255
- meshType
256
- );
257
- this.emit(`# Object: ${this.escapeStringValue(obj.name, "GDScript")}`);
258
- if (isLight) {
259
- const lightMap = {
260
- directional: "DirectionalLight3D",
261
- point: "OmniLight3D",
262
- spot: "SpotLight3D"
263
- };
264
- this.emit(`var ${varName} = ${lightMap[meshType] || "DirectionalLight3D"}.new()`);
265
- } else if (isText) {
266
- this.emit(`var ${varName} = Label3D.new()`);
267
- const text = this.findObjProp(obj, "text");
268
- if (text) this.emit(`${varName}.text = "${text}"`);
269
- const fontSize = this.findObjProp(obj, "font_size");
270
- if (fontSize) this.emit(`${varName}.font_size = ${Math.round(fontSize * 100)}`);
271
- const color = this.findObjProp(obj, "color");
272
- if (color) this.emit(`${varName}.modulate = ${this.toColor(color)}`);
273
- } else if (isModel) {
274
- const src = this.findObjProp(obj, "model") || this.findObjProp(obj, "src");
275
- this.emit(`var ${varName} = load("res://models/${src}.glb").instantiate()`);
276
- } else if (isSparkles) {
277
- this.emit(`var ${varName} = GPUParticles3D.new()`);
278
- } else {
279
- const hasPhysics2 = obj.traits?.some((t) => t.name === "physics" || t.name === "grabbable");
280
- if (hasPhysics2) {
281
- this.emit(`var ${varName}_body = RigidBody3D.new()`);
282
- this.emit(
283
- `${varName}_body.name = "${this.escapeStringValue(obj.name, "GDScript")}"`
284
- );
285
- }
286
- this.emit(`var ${varName} = MeshInstance3D.new()`);
287
- const meshMap = {
288
- sphere: "SphereMesh",
289
- box: "BoxMesh",
290
- cube: "BoxMesh",
291
- cylinder: "CylinderMesh",
292
- cone: "CylinderMesh",
293
- plane: "PlaneMesh",
294
- torus: "TorusMesh",
295
- capsule: "CapsuleMesh"
296
- };
297
- const gdMesh = meshMap[meshType] || "BoxMesh";
298
- this.emit(`${varName}.mesh = ${gdMesh}.new()`);
299
- const size = this.findObjProp(obj, "size");
300
- if (size && gdMesh === "BoxMesh" && Array.isArray(size)) {
301
- this.emit(`${varName}.mesh.size = ${this.toVector3(size)}`);
302
- } else if (typeof size === "number" && gdMesh === "PlaneMesh") {
303
- this.emit(`${varName}.mesh.size = Vector2(${size}, ${size})`);
304
- }
305
- const material = this.findObjProp(obj, "material");
306
- if (material && typeof material === "object") {
307
- const mat = material;
308
- this.emit(`var ${varName}_mat = StandardMaterial3D.new()`);
309
- if (mat.color) this.emit(`${varName}_mat.albedo_color = ${this.toColor(mat.color)}`);
310
- if (mat.roughness !== void 0) this.emit(`${varName}_mat.roughness = ${mat.roughness}`);
311
- if (mat.metalness !== void 0) this.emit(`${varName}_mat.metallic = ${mat.metalness}`);
312
- if (mat.emissive) {
313
- this.emit(`${varName}_mat.emission_enabled = true`);
314
- this.emit(`${varName}_mat.emission = ${this.toColor(mat.emissive)}`);
315
- }
316
- if (mat.transmission) {
317
- this.emit(`${varName}_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA`);
318
- }
319
- this.emit(`${varName}.material_override = ${varName}_mat`);
320
- }
321
- const hasCollider = obj.traits?.some(
322
- (t) => t.name === "collidable" || t.name === "physics" || t.name === "grabbable"
323
- );
324
- if (hasCollider && !hasPhysics2) {
325
- this.emit(`var ${varName}_static = StaticBody3D.new()`);
326
- this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
327
- this.emit(`${varName}_shape.shape = ${varName}.mesh.create_convex_shape()`);
328
- this.emit(`${varName}_static.add_child(${varName}_shape)`);
329
- this.emit(`${varName}_static.add_child(${varName})`);
330
- }
331
- if (hasPhysics2) {
332
- this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
333
- this.emit(`${varName}_shape.shape = ${varName}.mesh.create_convex_shape()`);
334
- this.emit(`${varName}_body.add_child(${varName}_shape)`);
335
- this.emit(`${varName}_body.add_child(${varName})`);
336
- }
337
- }
338
- this.emit(`${varName}.name = "${this.escapeStringValue(obj.name, "GDScript")}"`);
339
- const pos = this.findObjProp(obj, "position");
340
- if (pos) this.emit(`${varName}.position = ${this.toVector3(pos)}`);
341
- const rot = this.findObjProp(obj, "rotation");
342
- if (rot && Array.isArray(rot)) {
343
- this.emit(`${varName}.rotation_degrees = ${this.toVector3(rot)}`);
344
- }
345
- const scale = this.findObjProp(obj, "scale");
346
- if (scale) this.emit(`${varName}.scale = ${this.toVector3(scale)}`);
347
- const hasPhysics = obj.traits?.some((t) => t.name === "physics" || t.name === "grabbable");
348
- if (hasPhysics) {
349
- this.emit(`${parentVar}.add_child(${varName}_body)`);
350
- } else {
351
- this.emit(`${parentVar}.add_child(${varName})`);
352
- }
353
- if (obj.traits) {
354
- for (const trait of obj.traits) {
355
- const tn = trait.name;
356
- if (tn === "collidable" || tn === "physics" || tn === "grabbable") continue;
357
- if (tn === "plane_detection") {
358
- this.emit(`# @plane_detection \u2014 use XRServer plane detection`);
359
- } else if (tn === "mesh_detection") {
360
- this.emit(`# @mesh_detection \u2014 use XRServer mesh tracking`);
361
- } else if (tn === "anchor" || tn === "persistent_anchor" || tn === "shared_anchor") {
362
- this.emit(`# @${tn} \u2014 XRAnchor3D`);
363
- } else if (tn === "occlusion") {
364
- this.emit(`# @occlusion \u2014 Environment3D occlusion`);
365
- } else if (tn === "light_estimation") {
366
- this.emit(`# @light_estimation \u2014 XR light estimation`);
367
- } else if (tn === "cloth") {
368
- this.emit(`var ${varName}_soft = SoftBody3D.new()`);
369
- this.emit(
370
- `${varName}_soft.name = "${this.escapeStringValue(obj.name, "GDScript")}_cloth"`
371
- );
372
- this.emit(`# @cloth \u2014 configure SoftBody3D stiffness/damping`);
373
- } else if (tn === "wind") {
374
- this.emit(`# @wind \u2014 use GPUParticles3D attractor or custom force`);
375
- } else if (tn === "fluid") {
376
- this.emit(`# @fluid \u2014 custom SPH/particle fluid simulation`);
377
- } else if (tn === "destruction") {
378
- this.emit(`# @destruction \u2014 pre-fractured mesh swap on impact`);
379
- } else if (tn === "rope" || tn === "chain") {
380
- this.emit(`# @${tn} \u2014 use PinJoint3D chain or custom solver`);
381
- } else if (tn === "reverb_zone") {
382
- this.emit(`var ${varName}_reverb = AudioEffectReverb.new()`);
383
- this.emit(`# @reverb_zone \u2014 add to AudioBus`);
384
- } else if (tn === "ambisonics" || tn === "hrtf" || tn === "audio_occlusion" || tn === "audio_portal" || tn === "audio_material" || tn === "head_tracked_audio") {
385
- this.emit(`# @${tn} \u2014 spatial audio: ${JSON.stringify(trait.config || {})}`);
386
- } else if (tn === "gaussian_splat" || tn === "nerf" || tn === "volumetric_video" || tn === "point_cloud" || tn === "photogrammetry") {
387
- this.emit(`# @${tn} \u2014 volumetric renderer: ${JSON.stringify(trait.config || {})}`);
388
- } else if (tn === "accessible" || tn === "alt_text" || tn === "screen_reader" || tn === "high_contrast" || tn === "motion_reduced" || tn === "magnifiable") {
389
- this.emit(`# @${tn} \u2014 accessibility: ${JSON.stringify(trait.config || {})}`);
390
- } else if (tn === "eye_tracking" || tn === "hand_tracking" || tn === "body_tracking" || tn === "face_tracking" || tn === "controller") {
391
- this.emit(`# @${tn} \u2014 XR input: ${JSON.stringify(trait.config || {})}`);
392
- } else if (tn === "spatial_persona") {
393
- this.emit(`# @spatial_persona \u2014 visionOS-specific; use custom avatar scene for Godot`);
394
- } else if (tn === "shareplay") {
395
- this.emit(`# @shareplay \u2014 multiplayer via ENetMultiplayerPeer or WebSocketPeer`);
396
- } else if (tn === "object_tracking") {
397
- this.emit(`# @object_tracking \u2014 use XRTracker or custom vision-based tracker`);
398
- } else if (tn === "scene_reconstruction") {
399
- this.emit(`# @scene_reconstruction \u2014 use XRServer environment mesh`);
400
- } else if (tn === "eye_tracked" || tn === "eye_hand_fusion") {
401
- this.emit(`# @${tn} \u2014 use XRPositionalTracker for eye/hand data`);
402
- } else if (tn === "controlnet" || tn === "ai_texture_gen" || tn === "diffusion_realtime" || tn === "ai_upscaling" || tn === "ai_inpainting") {
403
- this.emit(`# @${tn} \u2014 AI generation: route to external inference or GDExtension`);
404
- } else if (tn === "neural_link" || tn === "neural_forge") {
405
- this.emit(`# @${tn} \u2014 neural interface: ${JSON.stringify(trait.config || {})}`);
406
- } else if (tn === "embedding_search" || tn === "ai_npc_brain" || tn === "vector_db") {
407
- this.emit(`# @${tn} \u2014 knowledge/AI: integrate via HTTP or GDExtension`);
408
- } else if (tn === "vision" || tn === "ai_vision" || tn === "spatial_awareness") {
409
- this.emit(`# @${tn} \u2014 computer vision: use OpenCV GDExtension or XRServer`);
410
- } else if (tn === "neural_animation") {
411
- this.emit(`# @neural_animation \u2014 motion matching via AnimationTree + custom solver`);
412
- } else {
413
- this.emit(`# @${tn}: ${JSON.stringify(trait.config || {})}`);
414
- }
415
- }
416
- }
417
- if (obj.children) {
418
- for (const child of obj.children) {
419
- this.compileObject(child, varName);
420
- }
421
- }
422
- this.emit("");
423
- }
424
- compileSpatialGroup(group, parentVar) {
425
- const varName = this.sanitizeName(group.name);
426
- this.emit(`# Spatial Group: ${this.escapeStringValue(group.name, "GDScript")}`);
427
- this.emit(`var ${varName} = Node3D.new()`);
428
- this.emit(`${varName}.name = "${this.escapeStringValue(group.name, "GDScript")}"`);
429
- for (const prop of group.properties) {
430
- if (prop.key === "position" && Array.isArray(prop.value)) {
431
- this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
432
- }
433
- }
434
- this.emit(`${parentVar}.add_child(${varName})`);
435
- for (const obj of group.objects) {
436
- this.compileObject(obj, varName);
437
- }
438
- if (group.groups) {
439
- for (const sub of group.groups) {
440
- this.compileSpatialGroup(sub, varName);
441
- }
442
- }
443
- this.emit("");
444
- }
445
- compileAudio(audio) {
446
- const varName = this.sanitizeName(audio.name);
447
- const spatial = audio.properties.find((p) => p.key === "spatial")?.value;
448
- this.emit(`# Audio: ${this.escapeStringValue(audio.name, "GDScript")}`);
449
- if (spatial) {
450
- this.emit(`var ${varName} = AudioStreamPlayer3D.new()`);
451
- } else {
452
- this.emit(`var ${varName} = AudioStreamPlayer.new()`);
453
- }
454
- this.emit(`${varName}.name = "${this.escapeStringValue(audio.name, "GDScript")}"`);
455
- for (const prop of audio.properties) {
456
- if (prop.key === "src" || prop.key === "source") {
457
- this.emit(`${varName}.stream = load("res://audio/${prop.value}")`);
458
- } else if (prop.key === "volume") {
459
- this.emit(`${varName}.volume_db = linear_to_db(${prop.value})`);
460
- } else if (prop.key === "position" && Array.isArray(prop.value)) {
461
- this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
462
- } else if (prop.key === "distance") {
463
- this.emit(`${varName}.max_distance = ${prop.value}`);
464
- }
465
- }
466
- const loop = audio.properties.find((p) => p.key === "loop")?.value;
467
- this.emit(`add_child(${varName})`);
468
- this.emit(`${varName}.play()`);
469
- if (loop) {
470
- this.emit(`${varName}.finished.connect(func(): ${varName}.play())`);
471
- }
472
- this.emit("");
473
- }
474
- compileZone(zone) {
475
- const varName = this.sanitizeName(zone.name);
476
- this.emit(`# Zone: ${this.escapeStringValue(zone.name, "GDScript")}`);
477
- this.emit(`var ${varName} = Area3D.new()`);
478
- this.emit(`${varName}.name = "${this.escapeStringValue(zone.name, "GDScript")}"`);
479
- const shape = zone.properties.find((p) => p.key === "shape")?.value;
480
- this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
481
- if (shape === "box") {
482
- this.emit(`${varName}_shape.shape = BoxShape3D.new()`);
483
- const size = zone.properties.find((p) => p.key === "size")?.value;
484
- if (size && Array.isArray(size)) {
485
- this.emit(`${varName}_shape.shape.size = ${this.toVector3(size)}`);
486
- }
487
- } else if (shape === "sphere") {
488
- this.emit(`${varName}_shape.shape = SphereShape3D.new()`);
489
- const radius = zone.properties.find((p) => p.key === "radius")?.value;
490
- if (radius) this.emit(`${varName}_shape.shape.radius = ${radius}`);
491
- }
492
- this.emit(`${varName}.add_child(${varName}_shape)`);
493
- const pos = zone.properties.find((p) => p.key === "position")?.value;
494
- if (pos) this.emit(`${varName}.position = ${this.toVector3(pos)}`);
495
- for (const handler of zone.handlers) {
496
- if (handler.event === "on_enter") {
497
- this.emit(
498
- `${varName}.body_entered.connect(func(body): print("${this.escapeStringValue(zone.name, "GDScript")}: enter"))`
499
- );
500
- } else if (handler.event === "on_exit") {
501
- this.emit(
502
- `${varName}.body_exited.connect(func(body): print("${this.escapeStringValue(zone.name, "GDScript")}: exit"))`
503
- );
504
- }
505
- }
506
- this.emit(`add_child(${varName})`);
507
- this.emit("");
508
- }
509
- compileTimeline(tl) {
510
- const varName = this.sanitizeName(tl.name);
511
- this.emit(`func _play_${varName}():`);
512
- this.indentLevel++;
513
- this.emit(`var tween = create_tween()`);
514
- if (tl.loop) {
515
- this.emit(`tween.set_loops()`);
516
- }
517
- for (const entry of tl.entries) {
518
- if (entry.action.kind === "animate") {
519
- this.emit(
520
- `tween.tween_callback(func(): pass) # animate "${entry.action.target}" at ${entry.time}s`
521
- );
522
- for (const [key, value] of Object.entries(entry.action.properties)) {
523
- this.emit(`# ${key}: ${JSON.stringify(value)}`);
524
- }
525
- } else if (entry.action.kind === "emit") {
526
- this.emit(
527
- `tween.tween_callback(func(): print("Event: ${entry.action.event}")).set_delay(${entry.time})`
528
- );
529
- } else if (entry.action.kind === "call") {
530
- this.emit(
531
- `tween.tween_callback(func(): ${entry.action.method}()).set_delay(${entry.time})`
532
- );
533
- }
534
- }
535
- this.indentLevel--;
536
- this.emit("");
537
- }
538
- compileTransition(tr) {
539
- const varName = this.sanitizeName(tr.name);
540
- this.emit(`func ${varName}():`);
541
- this.indentLevel++;
542
- const target = tr.properties.find((p) => p.key === "target")?.value;
543
- const effect = tr.properties.find((p) => p.key === "effect")?.value;
544
- const duration = tr.properties.find((p) => p.key === "duration")?.value;
545
- this.emit(`# Transition: ${effect} (${duration}s)`);
546
- if (target) {
547
- this.emit(`get_tree().change_scene_to_file("res://scenes/${target}.tscn")`);
548
- }
549
- this.indentLevel--;
550
- this.emit("");
551
- }
552
- compileEffects(effects) {
553
- this.emit("# === Post-Processing (configure via WorldEnvironment) ===");
554
- for (const effect of effects.effects) {
555
- this.emit(`# Effect: ${effect.effectType} \u2014 ${JSON.stringify(effect.properties)}`);
556
- }
557
- this.emit("");
558
- }
559
- compileUI(ui) {
560
- this.emit("# === UI Overlay ===");
561
- this.emit("var ui_layer = CanvasLayer.new()");
562
- this.emit('ui_layer.name = "HoloUI"');
563
- this.emit("add_child(ui_layer)");
564
- this.emit("");
565
- for (const el of ui.elements) {
566
- const varName = this.sanitizeName(el.name);
567
- const elType = el.properties.find((p) => p.key === "type")?.value;
568
- this.emit(`# UI: ${this.escapeStringValue(el.name, "GDScript")} (${elType})`);
569
- if (elType === "text") {
570
- this.emit(`var ${varName} = Label.new()`);
571
- const text = el.properties.find((p) => p.key === "text")?.value;
572
- if (text) this.emit(`${varName}.text = "${text}"`);
573
- } else if (elType === "progress") {
574
- this.emit(`var ${varName} = ProgressBar.new()`);
575
- } else if (elType === "panel") {
576
- this.emit(`var ${varName} = Panel.new()`);
577
- } else {
578
- this.emit(`var ${varName} = Control.new()`);
579
- }
580
- this.emit(`${varName}.name = "${this.escapeStringValue(el.name, "GDScript")}"`);
581
- const pos = el.properties.find((p) => p.key === "position")?.value;
582
- if (pos && Array.isArray(pos)) {
583
- this.emit(`${varName}.position = Vector2(${pos[0]}, ${pos[1]})`);
584
- }
585
- const size = el.properties.find((p) => p.key === "size")?.value;
586
- if (size && Array.isArray(size)) {
587
- this.emit(`${varName}.size = Vector2(${size[0]}, ${size[1]})`);
588
- }
589
- this.emit(`ui_layer.add_child(${varName})`);
590
- this.emit("");
591
- }
592
- }
593
- // ─── Helpers ───────────────────────────────────────────────────────────
594
- emit(line) {
595
- this.lines.push(this.options.indent.repeat(this.indentLevel) + line);
596
- }
597
- sanitizeName(name) {
598
- return name.replace(/[^a-zA-Z0-9_]/g, "_");
599
- }
600
- toVector3(arr) {
601
- if (Array.isArray(arr) && arr.length >= 3) {
602
- return `Vector3(${arr[0]}, ${arr[1]}, ${arr[2]})`;
603
- }
604
- return `Vector3(${arr}, ${arr}, ${arr})`;
605
- }
606
- toColor(value) {
607
- if (typeof value === "string" && value.startsWith("#")) {
608
- return `Color.html("${value}")`;
609
- }
610
- return `Color.WHITE`;
611
- }
612
- toGDScriptValue(value) {
613
- if (typeof value === "number") return `${value}`;
614
- if (typeof value === "boolean") return value ? "true" : "false";
615
- if (typeof value === "string") return `"${this.escapeStringValue(value, "GDScript")}"`;
616
- if (value === null) return "null";
617
- if (Array.isArray(value)) return `[${value.map((v) => this.toGDScriptValue(v)).join(", ")}]`;
618
- return "null";
619
- }
620
- findProp(props, key) {
621
- return props?.find((p) => p.key === key)?.value;
622
- }
623
- findObjProp(obj, key) {
624
- return obj.properties?.find((p) => p.key === key)?.value;
625
- }
626
- };
627
- }
628
- });
629
-
630
- exports.GodotCompiler_exports = GodotCompiler_exports;
631
- exports.init_GodotCompiler = init_GodotCompiler;
632
- //# sourceMappingURL=chunk-XXINBTZK.cjs.map
633
- //# sourceMappingURL=chunk-XXINBTZK.cjs.map