@holoscript/core 6.0.4 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +3 -2
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/index.d.ts +501 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/tools/index.d.ts +22 -1
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +105 -57
- package/dist/GLTFPipeline-DEN36VNK.js +0 -12
- package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
- package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
- package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
- package/dist/USDZExporter-NTMBNTDB.js +0 -707
- package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2CWOLHTE.js +0 -69
- package/dist/chunk-33LSUQDD.cjs +0 -835
- package/dist/chunk-3FJCK5XA.js +0 -2232
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3SAK5KFL.cjs +0 -83
- package/dist/chunk-4XSNJCLC.cjs +0 -1859
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5BGSECRJ.cjs +0 -2237
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5O6TQC6M.cjs +0 -1871
- package/dist/chunk-5OEOHAAW.cjs +0 -682
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-5WUNN6ZN.cjs +0 -428
- package/dist/chunk-6TZPZCOJ.cjs +0 -1404
- package/dist/chunk-6UEHYZ7V.cjs +0 -773
- package/dist/chunk-6XSERL6L.js +0 -5678
- package/dist/chunk-72EQECGT.cjs +0 -908
- package/dist/chunk-7AGYRWKW.cjs +0 -507
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-A7PIMZGU.js +0 -263
- package/dist/chunk-ATSKSYVE.cjs +0 -51683
- package/dist/chunk-B5TCIAPQ.cjs +0 -117
- package/dist/chunk-BF2235SI.cjs +0 -5714
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BND3ST2K.cjs +0 -662
- package/dist/chunk-BU7VWW2K.js +0 -2522
- package/dist/chunk-BWFJEM5A.js +0 -5419
- package/dist/chunk-CAUCGUEA.cjs +0 -130
- package/dist/chunk-CBJSLA2E.cjs +0 -5423
- package/dist/chunk-CDPGV4DN.js +0 -114
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CS2EMTGF.js +0 -1966
- package/dist/chunk-DMG7C4H2.js +0 -975
- package/dist/chunk-DXJQDCFL.js +0 -468
- package/dist/chunk-E3FWRT3Z.js +0 -608
- package/dist/chunk-E3UALNFA.js +0 -421
- package/dist/chunk-EONILVMF.js +0 -762
- package/dist/chunk-EQV4R3EV.cjs +0 -769
- package/dist/chunk-F3HH56EB.cjs +0 -5538
- package/dist/chunk-F4IULT7N.js +0 -1488
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-FFKU7BTK.cjs +0 -1046
- package/dist/chunk-FHQVYCH2.js +0 -70
- package/dist/chunk-FSF7EQVA.cjs +0 -1974
- package/dist/chunk-G4VZTCIB.js +0 -659
- package/dist/chunk-G7CT3EMP.cjs +0 -1002
- package/dist/chunk-GGHSW2NN.js +0 -51334
- package/dist/chunk-GVUR45UF.cjs +0 -777
- package/dist/chunk-H5Z7NASB.js +0 -9662
- package/dist/chunk-HE7ULERA.cjs +0 -697
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HPS76H7Q.js +0 -309
- package/dist/chunk-HQUEA5R6.cjs +0 -424
- package/dist/chunk-HYNTS5CP.js +0 -422
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IBDG74G2.cjs +0 -1219
- package/dist/chunk-IFNQFCTM.js +0 -3098
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-IWI6J7FX.js +0 -421
- package/dist/chunk-K3JDKWGI.cjs +0 -270
- package/dist/chunk-K6EKD26I.js +0 -630
- package/dist/chunk-KCQ5NDYC.cjs +0 -3172
- package/dist/chunk-KED34ILP.js +0 -832
- package/dist/chunk-KSGXLT74.cjs +0 -457
- package/dist/chunk-L4G4RLXX.js +0 -767
- package/dist/chunk-LDP5OK6G.js +0 -1216
- package/dist/chunk-LGGRPKTV.cjs +0 -735
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-LSW7P7ML.js +0 -3675
- package/dist/chunk-LXJ4667L.cjs +0 -3874
- package/dist/chunk-LZ266PCM.cjs +0 -4499
- package/dist/chunk-MD6KDHVE.cjs +0 -237
- package/dist/chunk-MEASWI2Y.js +0 -126
- package/dist/chunk-MPXBVFHQ.js +0 -768
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUKG4SK.cjs +0 -3075
- package/dist/chunk-NDQNIJEH.js +0 -1715
- package/dist/chunk-NOZZ46QU.js +0 -168
- package/dist/chunk-OFKWH2IP.js +0 -449
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PMGODDJA.cjs +0 -319
- package/dist/chunk-Q4QX3AET.cjs +0 -1505
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-Q5JT3YML.cjs +0 -129
- package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
- package/dist/chunk-QGKNANZ3.js +0 -3071
- package/dist/chunk-QLEAOI3Q.cjs +0 -424
- package/dist/chunk-R7MA7QWV.js +0 -732
- package/dist/chunk-RVYPEYPX.js +0 -678
- package/dist/chunk-S2N5TNMA.js +0 -1855
- package/dist/chunk-S565K7NK.js +0 -752
- package/dist/chunk-SDAMZIRE.js +0 -765
- package/dist/chunk-T36DDXSF.js +0 -4250
- package/dist/chunk-T4NKMBDL.js +0 -5474
- package/dist/chunk-T7LEXZUZ.cjs +0 -2526
- package/dist/chunk-TEWCN33Y.js +0 -694
- package/dist/chunk-TQSZUOW5.cjs +0 -793
- package/dist/chunk-TSH3MSQU.cjs +0 -129
- package/dist/chunk-UERJ3YJV.js +0 -504
- package/dist/chunk-UPJBDCVF.js +0 -1395
- package/dist/chunk-V3NN3HPP.js +0 -4462
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-WB4Z63GG.js +0 -229
- package/dist/chunk-WDW67DZB.cjs +0 -9728
- package/dist/chunk-WGMEAYBG.js +0 -126
- package/dist/chunk-X4ZF6CNE.cjs +0 -473
- package/dist/chunk-X6SEAXAX.cjs +0 -3681
- package/dist/chunk-XCWFGZAA.js +0 -1043
- package/dist/chunk-XD6IYDUX.js +0 -903
- package/dist/chunk-XG23EUQX.cjs +0 -1717
- package/dist/chunk-XRKWN5PL.cjs +0 -173
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-XUTX5CBW.js +0 -126
- package/dist/chunk-XWPNTWDN.cjs +0 -755
- package/dist/chunk-XXINBTZK.cjs +0 -633
- package/dist/chunk-YCXFCXDS.js +0 -1868
- package/dist/chunk-YQK5JNFK.js +0 -3725
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-Z34RLXRA.cjs +0 -612
- package/dist/chunk-ZP4D3CSX.cjs +0 -72
- package/dist/cli/holoscript-runner.cjs +0 -2259
- package/dist/cli/holoscript-runner.js +0 -2234
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -28
- package/dist/compiler/agent-inference.js +0 -5
- package/dist/compiler/android-xr.cjs +0 -19
- package/dist/compiler/android-xr.js +0 -9
- package/dist/compiler/android.cjs +0 -20
- package/dist/compiler/android.js +0 -10
- package/dist/compiler/ar.cjs +0 -20
- package/dist/compiler/ar.js +0 -8
- package/dist/compiler/babylon.cjs +0 -17
- package/dist/compiler/babylon.js +0 -11
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -602
- package/dist/compiler/domain-block-utils.js +0 -8
- package/dist/compiler/dtdl.cjs +0 -24
- package/dist/compiler/dtdl.js +0 -8
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -15
- package/dist/compiler/godot.js +0 -9
- package/dist/compiler/incremental.cjs +0 -29
- package/dist/compiler/incremental.js +0 -4
- package/dist/compiler/index.cjs +0 -2578
- package/dist/compiler/index.js +0 -2383
- package/dist/compiler/ios.cjs +0 -20
- package/dist/compiler/ios.js +0 -10
- package/dist/compiler/multi-layer.cjs +0 -20
- package/dist/compiler/multi-layer.js +0 -11
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -15
- package/dist/compiler/openxr.js +0 -9
- package/dist/compiler/playcanvas.cjs +0 -16
- package/dist/compiler/playcanvas.js +0 -10
- package/dist/compiler/r3f.cjs +0 -34
- package/dist/compiler/r3f.js +0 -12
- package/dist/compiler/remotion.cjs +0 -23
- package/dist/compiler/remotion.js +0 -4
- package/dist/compiler/reproducibility.cjs +0 -39
- package/dist/compiler/reproducibility.js +0 -4
- package/dist/compiler/sdf.cjs +0 -21
- package/dist/compiler/sdf.js +0 -9
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -17
- package/dist/compiler/state.js +0 -7
- package/dist/compiler/trait-composition.cjs +0 -26
- package/dist/compiler/trait-composition.js +0 -5
- package/dist/compiler/unity.cjs +0 -15
- package/dist/compiler/unity.js +0 -9
- package/dist/compiler/unreal.cjs +0 -19
- package/dist/compiler/unreal.js +0 -9
- package/dist/compiler/urdf.cjs +0 -45
- package/dist/compiler/urdf.js +0 -9
- package/dist/compiler/usd-physics.cjs +0 -23
- package/dist/compiler/usd-physics.js +0 -6
- package/dist/compiler/visionos.cjs +0 -15
- package/dist/compiler/visionos.js +0 -9
- package/dist/compiler/vrchat.cjs +0 -19
- package/dist/compiler/vrchat.js +0 -9
- package/dist/compiler/vrr.cjs +0 -21
- package/dist/compiler/vrr.js +0 -9
- package/dist/compiler/wasm.cjs +0 -33
- package/dist/compiler/wasm.js +0 -9
- package/dist/compiler/webgpu.cjs +0 -15
- package/dist/compiler/webgpu.js +0 -9
- package/dist/debugger.cjs +0 -21
- package/dist/debugger.js +0 -8
- package/dist/entries/interop.cjs +0 -62
- package/dist/entries/interop.js +0 -5
- package/dist/entries/scripting.cjs +0 -68
- package/dist/entries/scripting.js +0 -11
- package/dist/index.cjs +0 -40921
- package/dist/index.js +0 -37763
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
- package/dist/ml-dsa-WYLJHJO6.js +0 -1178
- package/dist/parser.cjs +0 -27
- package/dist/parser.js +0 -10
- package/dist/playwright-5OSAPTNH.js +0 -98660
- package/dist/playwright-RL6GY4F7.cjs +0 -98673
- package/dist/runtime.cjs +0 -16
- package/dist/runtime.js +0 -7
- package/dist/storage/index.cjs +0 -37
- package/dist/storage/index.js +0 -4
- package/dist/traits/index.cjs +0 -14649
- package/dist/traits/index.js +0 -12243
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
package/dist/chunk-K6EKD26I.js
DELETED
|
@@ -1,630 +0,0 @@
|
|
|
1
|
-
import { init_DomainBlockCompilerMixin, compileDomainBlocks, inputToGodot, compileInputBlock, navigationToGodot, compileNavigationBlock, renderingToGodot, compileRenderingBlock, proceduralToGodot, compileProceduralBlock, web3ToGodot, compileWeb3Block, architectureToGodot, compileArchitectureBlock, musicToGodot, compileMusicBlock, educationToGodot, compileEducationBlock, datavizToGodot, compileDataVizBlock, iotToGodot, compileIoTBlock, compileRoboticsBlock, roboticsToGodot, compileHealthcareBlock, healthcareToGodot, compilePaymentBlock, paymentToGodot, compileNarrativeBlock, narrativeToGodot, compileWeatherBlock, weatherToGodot, compileAudioSourceBlock, audioSourceToGodot, compilePostProcessingBlock, postProcessingToGodot, compileParticleBlock, particlesToGodot, compilePhysicsBlock, physicsToGodot, compileMaterialBlock, materialToGodot } from './chunk-YQK5JNFK.js';
|
|
2
|
-
import { 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/GodotCompiler.ts
|
|
7
|
-
var GodotCompiler_exports = {};
|
|
8
|
-
__export(GodotCompiler_exports, {
|
|
9
|
-
GodotCompiler: () => GodotCompiler
|
|
10
|
-
});
|
|
11
|
-
var GodotCompiler;
|
|
12
|
-
var init_GodotCompiler = __esm({
|
|
13
|
-
"src/compiler/GodotCompiler.ts"() {
|
|
14
|
-
init_CompilerBase();
|
|
15
|
-
init_DomainBlockCompilerMixin();
|
|
16
|
-
GodotCompiler = class extends CompilerBase {
|
|
17
|
-
constructor(options = {}) {
|
|
18
|
-
super();
|
|
19
|
-
this.compilerName = "GodotCompiler";
|
|
20
|
-
this.lines = [];
|
|
21
|
-
this.indentLevel = 0;
|
|
22
|
-
this.options = {
|
|
23
|
-
className: options.className || "GeneratedScene",
|
|
24
|
-
indent: options.indent || " ",
|
|
25
|
-
godotVersion: options.godotVersion || "4.3"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
getRequiredCapability() {
|
|
29
|
-
return ANSCapabilityPath.GODOT;
|
|
30
|
-
}
|
|
31
|
-
compile(composition, agentToken, outputPath) {
|
|
32
|
-
this.validateCompilerAccess(agentToken, outputPath);
|
|
33
|
-
this.lines = [];
|
|
34
|
-
this.indentLevel = 0;
|
|
35
|
-
this.emit(`# Auto-generated by HoloScript GodotCompiler`);
|
|
36
|
-
this.emit(
|
|
37
|
-
`# Source: composition "${this.escapeStringValue(composition.name, "GDScript")}"`
|
|
38
|
-
);
|
|
39
|
-
this.emit(`# Target: Godot ${this.options.godotVersion}`);
|
|
40
|
-
this.emit(`# Do not edit manually \u2014 regenerate from .holo source`);
|
|
41
|
-
this.emit("");
|
|
42
|
-
this.emit("extends Node3D");
|
|
43
|
-
this.emit(`class_name ${this.options.className}`);
|
|
44
|
-
this.emit("");
|
|
45
|
-
if (composition.state) {
|
|
46
|
-
this.emit("# === State ===");
|
|
47
|
-
for (const prop of composition.state.properties) {
|
|
48
|
-
const gdVal = this.toGDScriptValue(prop.value);
|
|
49
|
-
this.emit(`var ${this.escapeStringValue(prop.key, "GDScript")} = ${gdVal}`);
|
|
50
|
-
}
|
|
51
|
-
this.emit("");
|
|
52
|
-
}
|
|
53
|
-
this.emit("func _ready():");
|
|
54
|
-
this.indentLevel++;
|
|
55
|
-
if (composition.environment) {
|
|
56
|
-
this.compileEnvironment(composition.environment);
|
|
57
|
-
}
|
|
58
|
-
if (composition.lights) {
|
|
59
|
-
for (const light of composition.lights) {
|
|
60
|
-
this.compileLight(light);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (composition.camera) {
|
|
64
|
-
this.compileCamera(composition.camera);
|
|
65
|
-
}
|
|
66
|
-
if (composition.objects) {
|
|
67
|
-
for (const obj of composition.objects) {
|
|
68
|
-
this.compileObject(obj, "self");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (composition.spatialGroups) {
|
|
72
|
-
for (const group of composition.spatialGroups) {
|
|
73
|
-
this.compileSpatialGroup(group, "self");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (composition.audio) {
|
|
77
|
-
for (const audio of composition.audio) {
|
|
78
|
-
this.compileAudio(audio);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (composition.zones) {
|
|
82
|
-
for (const zone of composition.zones) {
|
|
83
|
-
this.compileZone(zone);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (composition.timelines) {
|
|
87
|
-
for (const tl of composition.timelines) {
|
|
88
|
-
if (tl.autoplay) {
|
|
89
|
-
this.emit(`_play_${this.sanitizeName(tl.name)}()`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (composition.ui) {
|
|
94
|
-
this.compileUI(composition.ui);
|
|
95
|
-
}
|
|
96
|
-
this.indentLevel--;
|
|
97
|
-
this.emit("");
|
|
98
|
-
if (composition.timelines) {
|
|
99
|
-
for (const tl of composition.timelines) {
|
|
100
|
-
this.compileTimeline(tl);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (composition.transitions) {
|
|
104
|
-
for (const tr of composition.transitions) {
|
|
105
|
-
this.compileTransition(tr);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (composition.effects) {
|
|
109
|
-
this.compileEffects(composition.effects);
|
|
110
|
-
}
|
|
111
|
-
this.compileGodotDomainBlocks(composition);
|
|
112
|
-
return this.lines.join("\n");
|
|
113
|
-
}
|
|
114
|
-
compileGodotDomainBlocks(composition) {
|
|
115
|
-
const domainBlocks = composition.domainBlocks ?? [];
|
|
116
|
-
if (domainBlocks.length === 0) return;
|
|
117
|
-
this.emit("");
|
|
118
|
-
this.emit("# === v4.2 Domain Blocks ===");
|
|
119
|
-
let blockIdx = 0;
|
|
120
|
-
const compiled = compileDomainBlocks(
|
|
121
|
-
domainBlocks,
|
|
122
|
-
{
|
|
123
|
-
material: (block) => {
|
|
124
|
-
const mat = compileMaterialBlock(block);
|
|
125
|
-
return materialToGodot(mat, `db${blockIdx++}`);
|
|
126
|
-
},
|
|
127
|
-
physics: (block) => {
|
|
128
|
-
const phys = compilePhysicsBlock(block);
|
|
129
|
-
return physicsToGodot(phys, `db${blockIdx++}`);
|
|
130
|
-
},
|
|
131
|
-
vfx: (block) => {
|
|
132
|
-
const ps = compileParticleBlock(block);
|
|
133
|
-
return particlesToGodot(ps, `db${blockIdx++}`);
|
|
134
|
-
},
|
|
135
|
-
postfx: (block) => {
|
|
136
|
-
const pp = compilePostProcessingBlock(block);
|
|
137
|
-
return postProcessingToGodot(pp);
|
|
138
|
-
},
|
|
139
|
-
audio: (block) => {
|
|
140
|
-
const audio = compileAudioSourceBlock(block);
|
|
141
|
-
return audioSourceToGodot(audio, `db${blockIdx++}`);
|
|
142
|
-
},
|
|
143
|
-
weather: (block) => {
|
|
144
|
-
const weather = compileWeatherBlock(block);
|
|
145
|
-
return weatherToGodot(weather);
|
|
146
|
-
},
|
|
147
|
-
narrative: (block) => {
|
|
148
|
-
const narr = compileNarrativeBlock(block);
|
|
149
|
-
return narrativeToGodot(narr);
|
|
150
|
-
},
|
|
151
|
-
payment: (block) => {
|
|
152
|
-
const pay = compilePaymentBlock(block);
|
|
153
|
-
return paymentToGodot(pay);
|
|
154
|
-
},
|
|
155
|
-
healthcare: (block) => {
|
|
156
|
-
const h = compileHealthcareBlock(block);
|
|
157
|
-
return healthcareToGodot(h);
|
|
158
|
-
},
|
|
159
|
-
robotics: (block) => {
|
|
160
|
-
const r = compileRoboticsBlock(block);
|
|
161
|
-
return roboticsToGodot(r);
|
|
162
|
-
},
|
|
163
|
-
iot: (block) => iotToGodot(compileIoTBlock(block)),
|
|
164
|
-
dataviz: (block) => datavizToGodot(compileDataVizBlock(block)),
|
|
165
|
-
education: (block) => educationToGodot(compileEducationBlock(block)),
|
|
166
|
-
music: (block) => musicToGodot(compileMusicBlock(block)),
|
|
167
|
-
architecture: (block) => architectureToGodot(compileArchitectureBlock(block)),
|
|
168
|
-
web3: (block) => web3ToGodot(compileWeb3Block(block)),
|
|
169
|
-
procedural: (block) => proceduralToGodot(compileProceduralBlock(block)),
|
|
170
|
-
rendering: (block) => renderingToGodot(compileRenderingBlock(block)),
|
|
171
|
-
navigation: (block) => navigationToGodot(compileNavigationBlock(block)),
|
|
172
|
-
input: (block) => inputToGodot(compileInputBlock(block))
|
|
173
|
-
},
|
|
174
|
-
(block) => `# Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "GDScript")}"`
|
|
175
|
-
);
|
|
176
|
-
for (const line of compiled) {
|
|
177
|
-
for (const l of line.split("\n")) {
|
|
178
|
-
this.emit(l);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
compileEnvironment(env) {
|
|
183
|
-
this.emit("# === Environment ===");
|
|
184
|
-
for (const prop of env.properties) {
|
|
185
|
-
if (prop.key === "preset" || prop.key === "skybox") {
|
|
186
|
-
this.emit(`var env = WorldEnvironment.new()`);
|
|
187
|
-
this.emit(`env.environment = Environment.new()`);
|
|
188
|
-
this.emit(`env.environment.background_mode = Environment.BG_SKY`);
|
|
189
|
-
this.emit(`add_child(env)`);
|
|
190
|
-
} else if (prop.key === "fog" && typeof prop.value === "object") {
|
|
191
|
-
const fog = prop.value;
|
|
192
|
-
this.emit(`# Fog settings`);
|
|
193
|
-
if (fog.color) this.emit(`# fog_color: ${fog.color}`);
|
|
194
|
-
if (fog.near !== void 0) this.emit(`# fog_near: ${fog.near}`);
|
|
195
|
-
if (fog.far !== void 0) this.emit(`# fog_far: ${fog.far}`);
|
|
196
|
-
} else if (prop.key === "ambient_light") {
|
|
197
|
-
this.emit(`# Ambient light intensity: ${prop.value}`);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
this.emit("");
|
|
201
|
-
}
|
|
202
|
-
compileLight(light) {
|
|
203
|
-
const varName = this.sanitizeName(light.name);
|
|
204
|
-
this.emit(`# Light: ${this.escapeStringValue(light.name, "GDScript")}`);
|
|
205
|
-
const typeMap = {
|
|
206
|
-
directional: "DirectionalLight3D",
|
|
207
|
-
point: "OmniLight3D",
|
|
208
|
-
spot: "SpotLight3D"
|
|
209
|
-
};
|
|
210
|
-
const gdType = typeMap[light.lightType] || "DirectionalLight3D";
|
|
211
|
-
this.emit(`var ${varName} = ${gdType}.new()`);
|
|
212
|
-
this.emit(`${varName}.name = "${this.escapeStringValue(light.name, "GDScript")}"`);
|
|
213
|
-
for (const prop of light.properties) {
|
|
214
|
-
if (prop.key === "color") {
|
|
215
|
-
this.emit(`${varName}.light_color = ${this.toColor(prop.value)}`);
|
|
216
|
-
} else if (prop.key === "intensity") {
|
|
217
|
-
this.emit(`${varName}.light_energy = ${prop.value}`);
|
|
218
|
-
} else if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
219
|
-
this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
|
|
220
|
-
} else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
|
|
221
|
-
this.emit(`${varName}.shadow_enabled = ${prop.value}`);
|
|
222
|
-
} else if (prop.key === "distance") {
|
|
223
|
-
this.emit(`${varName}.omni_range = ${prop.value}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
this.emit(`add_child(${varName})`);
|
|
227
|
-
this.emit("");
|
|
228
|
-
}
|
|
229
|
-
compileCamera(camera) {
|
|
230
|
-
this.emit("# === Camera ===");
|
|
231
|
-
this.emit("var cam = Camera3D.new()");
|
|
232
|
-
const fov = this.findProp(camera.properties, "fov");
|
|
233
|
-
if (fov) this.emit(`cam.fov = ${fov}`);
|
|
234
|
-
const pos = this.findProp(camera.properties, "position");
|
|
235
|
-
if (pos) this.emit(`cam.position = ${this.toVector3(pos)}`);
|
|
236
|
-
const lookAt = this.findProp(camera.properties, "look_at") || this.findProp(camera.properties, "lookAt");
|
|
237
|
-
if (lookAt) this.emit(`cam.look_at(${this.toVector3(lookAt)})`);
|
|
238
|
-
const near = this.findProp(camera.properties, "near");
|
|
239
|
-
if (near) this.emit(`cam.near = ${near}`);
|
|
240
|
-
const far = this.findProp(camera.properties, "far");
|
|
241
|
-
if (far) this.emit(`cam.far = ${far}`);
|
|
242
|
-
this.emit("cam.current = true");
|
|
243
|
-
this.emit("add_child(cam)");
|
|
244
|
-
this.emit("");
|
|
245
|
-
}
|
|
246
|
-
compileObject(obj, parentVar) {
|
|
247
|
-
const varName = this.sanitizeName(obj.name);
|
|
248
|
-
const meshType = this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
|
|
249
|
-
const isText = meshType === "text";
|
|
250
|
-
const isModel = !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src");
|
|
251
|
-
const isSparkles = meshType === "sparkles";
|
|
252
|
-
const isLight = ["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(
|
|
253
|
-
meshType
|
|
254
|
-
);
|
|
255
|
-
this.emit(`# Object: ${this.escapeStringValue(obj.name, "GDScript")}`);
|
|
256
|
-
if (isLight) {
|
|
257
|
-
const lightMap = {
|
|
258
|
-
directional: "DirectionalLight3D",
|
|
259
|
-
point: "OmniLight3D",
|
|
260
|
-
spot: "SpotLight3D"
|
|
261
|
-
};
|
|
262
|
-
this.emit(`var ${varName} = ${lightMap[meshType] || "DirectionalLight3D"}.new()`);
|
|
263
|
-
} else if (isText) {
|
|
264
|
-
this.emit(`var ${varName} = Label3D.new()`);
|
|
265
|
-
const text = this.findObjProp(obj, "text");
|
|
266
|
-
if (text) this.emit(`${varName}.text = "${text}"`);
|
|
267
|
-
const fontSize = this.findObjProp(obj, "font_size");
|
|
268
|
-
if (fontSize) this.emit(`${varName}.font_size = ${Math.round(fontSize * 100)}`);
|
|
269
|
-
const color = this.findObjProp(obj, "color");
|
|
270
|
-
if (color) this.emit(`${varName}.modulate = ${this.toColor(color)}`);
|
|
271
|
-
} else if (isModel) {
|
|
272
|
-
const src = this.findObjProp(obj, "model") || this.findObjProp(obj, "src");
|
|
273
|
-
this.emit(`var ${varName} = load("res://models/${src}.glb").instantiate()`);
|
|
274
|
-
} else if (isSparkles) {
|
|
275
|
-
this.emit(`var ${varName} = GPUParticles3D.new()`);
|
|
276
|
-
} else {
|
|
277
|
-
const hasPhysics2 = obj.traits?.some((t) => t.name === "physics" || t.name === "grabbable");
|
|
278
|
-
if (hasPhysics2) {
|
|
279
|
-
this.emit(`var ${varName}_body = RigidBody3D.new()`);
|
|
280
|
-
this.emit(
|
|
281
|
-
`${varName}_body.name = "${this.escapeStringValue(obj.name, "GDScript")}"`
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
this.emit(`var ${varName} = MeshInstance3D.new()`);
|
|
285
|
-
const meshMap = {
|
|
286
|
-
sphere: "SphereMesh",
|
|
287
|
-
box: "BoxMesh",
|
|
288
|
-
cube: "BoxMesh",
|
|
289
|
-
cylinder: "CylinderMesh",
|
|
290
|
-
cone: "CylinderMesh",
|
|
291
|
-
plane: "PlaneMesh",
|
|
292
|
-
torus: "TorusMesh",
|
|
293
|
-
capsule: "CapsuleMesh"
|
|
294
|
-
};
|
|
295
|
-
const gdMesh = meshMap[meshType] || "BoxMesh";
|
|
296
|
-
this.emit(`${varName}.mesh = ${gdMesh}.new()`);
|
|
297
|
-
const size = this.findObjProp(obj, "size");
|
|
298
|
-
if (size && gdMesh === "BoxMesh" && Array.isArray(size)) {
|
|
299
|
-
this.emit(`${varName}.mesh.size = ${this.toVector3(size)}`);
|
|
300
|
-
} else if (typeof size === "number" && gdMesh === "PlaneMesh") {
|
|
301
|
-
this.emit(`${varName}.mesh.size = Vector2(${size}, ${size})`);
|
|
302
|
-
}
|
|
303
|
-
const material = this.findObjProp(obj, "material");
|
|
304
|
-
if (material && typeof material === "object") {
|
|
305
|
-
const mat = material;
|
|
306
|
-
this.emit(`var ${varName}_mat = StandardMaterial3D.new()`);
|
|
307
|
-
if (mat.color) this.emit(`${varName}_mat.albedo_color = ${this.toColor(mat.color)}`);
|
|
308
|
-
if (mat.roughness !== void 0) this.emit(`${varName}_mat.roughness = ${mat.roughness}`);
|
|
309
|
-
if (mat.metalness !== void 0) this.emit(`${varName}_mat.metallic = ${mat.metalness}`);
|
|
310
|
-
if (mat.emissive) {
|
|
311
|
-
this.emit(`${varName}_mat.emission_enabled = true`);
|
|
312
|
-
this.emit(`${varName}_mat.emission = ${this.toColor(mat.emissive)}`);
|
|
313
|
-
}
|
|
314
|
-
if (mat.transmission) {
|
|
315
|
-
this.emit(`${varName}_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA`);
|
|
316
|
-
}
|
|
317
|
-
this.emit(`${varName}.material_override = ${varName}_mat`);
|
|
318
|
-
}
|
|
319
|
-
const hasCollider = obj.traits?.some(
|
|
320
|
-
(t) => t.name === "collidable" || t.name === "physics" || t.name === "grabbable"
|
|
321
|
-
);
|
|
322
|
-
if (hasCollider && !hasPhysics2) {
|
|
323
|
-
this.emit(`var ${varName}_static = StaticBody3D.new()`);
|
|
324
|
-
this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
|
|
325
|
-
this.emit(`${varName}_shape.shape = ${varName}.mesh.create_convex_shape()`);
|
|
326
|
-
this.emit(`${varName}_static.add_child(${varName}_shape)`);
|
|
327
|
-
this.emit(`${varName}_static.add_child(${varName})`);
|
|
328
|
-
}
|
|
329
|
-
if (hasPhysics2) {
|
|
330
|
-
this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
|
|
331
|
-
this.emit(`${varName}_shape.shape = ${varName}.mesh.create_convex_shape()`);
|
|
332
|
-
this.emit(`${varName}_body.add_child(${varName}_shape)`);
|
|
333
|
-
this.emit(`${varName}_body.add_child(${varName})`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
this.emit(`${varName}.name = "${this.escapeStringValue(obj.name, "GDScript")}"`);
|
|
337
|
-
const pos = this.findObjProp(obj, "position");
|
|
338
|
-
if (pos) this.emit(`${varName}.position = ${this.toVector3(pos)}`);
|
|
339
|
-
const rot = this.findObjProp(obj, "rotation");
|
|
340
|
-
if (rot && Array.isArray(rot)) {
|
|
341
|
-
this.emit(`${varName}.rotation_degrees = ${this.toVector3(rot)}`);
|
|
342
|
-
}
|
|
343
|
-
const scale = this.findObjProp(obj, "scale");
|
|
344
|
-
if (scale) this.emit(`${varName}.scale = ${this.toVector3(scale)}`);
|
|
345
|
-
const hasPhysics = obj.traits?.some((t) => t.name === "physics" || t.name === "grabbable");
|
|
346
|
-
if (hasPhysics) {
|
|
347
|
-
this.emit(`${parentVar}.add_child(${varName}_body)`);
|
|
348
|
-
} else {
|
|
349
|
-
this.emit(`${parentVar}.add_child(${varName})`);
|
|
350
|
-
}
|
|
351
|
-
if (obj.traits) {
|
|
352
|
-
for (const trait of obj.traits) {
|
|
353
|
-
const tn = trait.name;
|
|
354
|
-
if (tn === "collidable" || tn === "physics" || tn === "grabbable") continue;
|
|
355
|
-
if (tn === "plane_detection") {
|
|
356
|
-
this.emit(`# @plane_detection \u2014 use XRServer plane detection`);
|
|
357
|
-
} else if (tn === "mesh_detection") {
|
|
358
|
-
this.emit(`# @mesh_detection \u2014 use XRServer mesh tracking`);
|
|
359
|
-
} else if (tn === "anchor" || tn === "persistent_anchor" || tn === "shared_anchor") {
|
|
360
|
-
this.emit(`# @${tn} \u2014 XRAnchor3D`);
|
|
361
|
-
} else if (tn === "occlusion") {
|
|
362
|
-
this.emit(`# @occlusion \u2014 Environment3D occlusion`);
|
|
363
|
-
} else if (tn === "light_estimation") {
|
|
364
|
-
this.emit(`# @light_estimation \u2014 XR light estimation`);
|
|
365
|
-
} else if (tn === "cloth") {
|
|
366
|
-
this.emit(`var ${varName}_soft = SoftBody3D.new()`);
|
|
367
|
-
this.emit(
|
|
368
|
-
`${varName}_soft.name = "${this.escapeStringValue(obj.name, "GDScript")}_cloth"`
|
|
369
|
-
);
|
|
370
|
-
this.emit(`# @cloth \u2014 configure SoftBody3D stiffness/damping`);
|
|
371
|
-
} else if (tn === "wind") {
|
|
372
|
-
this.emit(`# @wind \u2014 use GPUParticles3D attractor or custom force`);
|
|
373
|
-
} else if (tn === "fluid") {
|
|
374
|
-
this.emit(`# @fluid \u2014 custom SPH/particle fluid simulation`);
|
|
375
|
-
} else if (tn === "destruction") {
|
|
376
|
-
this.emit(`# @destruction \u2014 pre-fractured mesh swap on impact`);
|
|
377
|
-
} else if (tn === "rope" || tn === "chain") {
|
|
378
|
-
this.emit(`# @${tn} \u2014 use PinJoint3D chain or custom solver`);
|
|
379
|
-
} else if (tn === "reverb_zone") {
|
|
380
|
-
this.emit(`var ${varName}_reverb = AudioEffectReverb.new()`);
|
|
381
|
-
this.emit(`# @reverb_zone \u2014 add to AudioBus`);
|
|
382
|
-
} else if (tn === "ambisonics" || tn === "hrtf" || tn === "audio_occlusion" || tn === "audio_portal" || tn === "audio_material" || tn === "head_tracked_audio") {
|
|
383
|
-
this.emit(`# @${tn} \u2014 spatial audio: ${JSON.stringify(trait.config || {})}`);
|
|
384
|
-
} else if (tn === "gaussian_splat" || tn === "nerf" || tn === "volumetric_video" || tn === "point_cloud" || tn === "photogrammetry") {
|
|
385
|
-
this.emit(`# @${tn} \u2014 volumetric renderer: ${JSON.stringify(trait.config || {})}`);
|
|
386
|
-
} else if (tn === "accessible" || tn === "alt_text" || tn === "screen_reader" || tn === "high_contrast" || tn === "motion_reduced" || tn === "magnifiable") {
|
|
387
|
-
this.emit(`# @${tn} \u2014 accessibility: ${JSON.stringify(trait.config || {})}`);
|
|
388
|
-
} else if (tn === "eye_tracking" || tn === "hand_tracking" || tn === "body_tracking" || tn === "face_tracking" || tn === "controller") {
|
|
389
|
-
this.emit(`# @${tn} \u2014 XR input: ${JSON.stringify(trait.config || {})}`);
|
|
390
|
-
} else if (tn === "spatial_persona") {
|
|
391
|
-
this.emit(`# @spatial_persona \u2014 visionOS-specific; use custom avatar scene for Godot`);
|
|
392
|
-
} else if (tn === "shareplay") {
|
|
393
|
-
this.emit(`# @shareplay \u2014 multiplayer via ENetMultiplayerPeer or WebSocketPeer`);
|
|
394
|
-
} else if (tn === "object_tracking") {
|
|
395
|
-
this.emit(`# @object_tracking \u2014 use XRTracker or custom vision-based tracker`);
|
|
396
|
-
} else if (tn === "scene_reconstruction") {
|
|
397
|
-
this.emit(`# @scene_reconstruction \u2014 use XRServer environment mesh`);
|
|
398
|
-
} else if (tn === "eye_tracked" || tn === "eye_hand_fusion") {
|
|
399
|
-
this.emit(`# @${tn} \u2014 use XRPositionalTracker for eye/hand data`);
|
|
400
|
-
} else if (tn === "controlnet" || tn === "ai_texture_gen" || tn === "diffusion_realtime" || tn === "ai_upscaling" || tn === "ai_inpainting") {
|
|
401
|
-
this.emit(`# @${tn} \u2014 AI generation: route to external inference or GDExtension`);
|
|
402
|
-
} else if (tn === "neural_link" || tn === "neural_forge") {
|
|
403
|
-
this.emit(`# @${tn} \u2014 neural interface: ${JSON.stringify(trait.config || {})}`);
|
|
404
|
-
} else if (tn === "embedding_search" || tn === "ai_npc_brain" || tn === "vector_db") {
|
|
405
|
-
this.emit(`# @${tn} \u2014 knowledge/AI: integrate via HTTP or GDExtension`);
|
|
406
|
-
} else if (tn === "vision" || tn === "ai_vision" || tn === "spatial_awareness") {
|
|
407
|
-
this.emit(`# @${tn} \u2014 computer vision: use OpenCV GDExtension or XRServer`);
|
|
408
|
-
} else if (tn === "neural_animation") {
|
|
409
|
-
this.emit(`# @neural_animation \u2014 motion matching via AnimationTree + custom solver`);
|
|
410
|
-
} else {
|
|
411
|
-
this.emit(`# @${tn}: ${JSON.stringify(trait.config || {})}`);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (obj.children) {
|
|
416
|
-
for (const child of obj.children) {
|
|
417
|
-
this.compileObject(child, varName);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
this.emit("");
|
|
421
|
-
}
|
|
422
|
-
compileSpatialGroup(group, parentVar) {
|
|
423
|
-
const varName = this.sanitizeName(group.name);
|
|
424
|
-
this.emit(`# Spatial Group: ${this.escapeStringValue(group.name, "GDScript")}`);
|
|
425
|
-
this.emit(`var ${varName} = Node3D.new()`);
|
|
426
|
-
this.emit(`${varName}.name = "${this.escapeStringValue(group.name, "GDScript")}"`);
|
|
427
|
-
for (const prop of group.properties) {
|
|
428
|
-
if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
429
|
-
this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
this.emit(`${parentVar}.add_child(${varName})`);
|
|
433
|
-
for (const obj of group.objects) {
|
|
434
|
-
this.compileObject(obj, varName);
|
|
435
|
-
}
|
|
436
|
-
if (group.groups) {
|
|
437
|
-
for (const sub of group.groups) {
|
|
438
|
-
this.compileSpatialGroup(sub, varName);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
this.emit("");
|
|
442
|
-
}
|
|
443
|
-
compileAudio(audio) {
|
|
444
|
-
const varName = this.sanitizeName(audio.name);
|
|
445
|
-
const spatial = audio.properties.find((p) => p.key === "spatial")?.value;
|
|
446
|
-
this.emit(`# Audio: ${this.escapeStringValue(audio.name, "GDScript")}`);
|
|
447
|
-
if (spatial) {
|
|
448
|
-
this.emit(`var ${varName} = AudioStreamPlayer3D.new()`);
|
|
449
|
-
} else {
|
|
450
|
-
this.emit(`var ${varName} = AudioStreamPlayer.new()`);
|
|
451
|
-
}
|
|
452
|
-
this.emit(`${varName}.name = "${this.escapeStringValue(audio.name, "GDScript")}"`);
|
|
453
|
-
for (const prop of audio.properties) {
|
|
454
|
-
if (prop.key === "src" || prop.key === "source") {
|
|
455
|
-
this.emit(`${varName}.stream = load("res://audio/${prop.value}")`);
|
|
456
|
-
} else if (prop.key === "volume") {
|
|
457
|
-
this.emit(`${varName}.volume_db = linear_to_db(${prop.value})`);
|
|
458
|
-
} else if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
459
|
-
this.emit(`${varName}.position = ${this.toVector3(prop.value)}`);
|
|
460
|
-
} else if (prop.key === "distance") {
|
|
461
|
-
this.emit(`${varName}.max_distance = ${prop.value}`);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
const loop = audio.properties.find((p) => p.key === "loop")?.value;
|
|
465
|
-
this.emit(`add_child(${varName})`);
|
|
466
|
-
this.emit(`${varName}.play()`);
|
|
467
|
-
if (loop) {
|
|
468
|
-
this.emit(`${varName}.finished.connect(func(): ${varName}.play())`);
|
|
469
|
-
}
|
|
470
|
-
this.emit("");
|
|
471
|
-
}
|
|
472
|
-
compileZone(zone) {
|
|
473
|
-
const varName = this.sanitizeName(zone.name);
|
|
474
|
-
this.emit(`# Zone: ${this.escapeStringValue(zone.name, "GDScript")}`);
|
|
475
|
-
this.emit(`var ${varName} = Area3D.new()`);
|
|
476
|
-
this.emit(`${varName}.name = "${this.escapeStringValue(zone.name, "GDScript")}"`);
|
|
477
|
-
const shape = zone.properties.find((p) => p.key === "shape")?.value;
|
|
478
|
-
this.emit(`var ${varName}_shape = CollisionShape3D.new()`);
|
|
479
|
-
if (shape === "box") {
|
|
480
|
-
this.emit(`${varName}_shape.shape = BoxShape3D.new()`);
|
|
481
|
-
const size = zone.properties.find((p) => p.key === "size")?.value;
|
|
482
|
-
if (size && Array.isArray(size)) {
|
|
483
|
-
this.emit(`${varName}_shape.shape.size = ${this.toVector3(size)}`);
|
|
484
|
-
}
|
|
485
|
-
} else if (shape === "sphere") {
|
|
486
|
-
this.emit(`${varName}_shape.shape = SphereShape3D.new()`);
|
|
487
|
-
const radius = zone.properties.find((p) => p.key === "radius")?.value;
|
|
488
|
-
if (radius) this.emit(`${varName}_shape.shape.radius = ${radius}`);
|
|
489
|
-
}
|
|
490
|
-
this.emit(`${varName}.add_child(${varName}_shape)`);
|
|
491
|
-
const pos = zone.properties.find((p) => p.key === "position")?.value;
|
|
492
|
-
if (pos) this.emit(`${varName}.position = ${this.toVector3(pos)}`);
|
|
493
|
-
for (const handler of zone.handlers) {
|
|
494
|
-
if (handler.event === "on_enter") {
|
|
495
|
-
this.emit(
|
|
496
|
-
`${varName}.body_entered.connect(func(body): print("${this.escapeStringValue(zone.name, "GDScript")}: enter"))`
|
|
497
|
-
);
|
|
498
|
-
} else if (handler.event === "on_exit") {
|
|
499
|
-
this.emit(
|
|
500
|
-
`${varName}.body_exited.connect(func(body): print("${this.escapeStringValue(zone.name, "GDScript")}: exit"))`
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
this.emit(`add_child(${varName})`);
|
|
505
|
-
this.emit("");
|
|
506
|
-
}
|
|
507
|
-
compileTimeline(tl) {
|
|
508
|
-
const varName = this.sanitizeName(tl.name);
|
|
509
|
-
this.emit(`func _play_${varName}():`);
|
|
510
|
-
this.indentLevel++;
|
|
511
|
-
this.emit(`var tween = create_tween()`);
|
|
512
|
-
if (tl.loop) {
|
|
513
|
-
this.emit(`tween.set_loops()`);
|
|
514
|
-
}
|
|
515
|
-
for (const entry of tl.entries) {
|
|
516
|
-
if (entry.action.kind === "animate") {
|
|
517
|
-
this.emit(
|
|
518
|
-
`tween.tween_callback(func(): pass) # animate "${entry.action.target}" at ${entry.time}s`
|
|
519
|
-
);
|
|
520
|
-
for (const [key, value] of Object.entries(entry.action.properties)) {
|
|
521
|
-
this.emit(`# ${key}: ${JSON.stringify(value)}`);
|
|
522
|
-
}
|
|
523
|
-
} else if (entry.action.kind === "emit") {
|
|
524
|
-
this.emit(
|
|
525
|
-
`tween.tween_callback(func(): print("Event: ${entry.action.event}")).set_delay(${entry.time})`
|
|
526
|
-
);
|
|
527
|
-
} else if (entry.action.kind === "call") {
|
|
528
|
-
this.emit(
|
|
529
|
-
`tween.tween_callback(func(): ${entry.action.method}()).set_delay(${entry.time})`
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
this.indentLevel--;
|
|
534
|
-
this.emit("");
|
|
535
|
-
}
|
|
536
|
-
compileTransition(tr) {
|
|
537
|
-
const varName = this.sanitizeName(tr.name);
|
|
538
|
-
this.emit(`func ${varName}():`);
|
|
539
|
-
this.indentLevel++;
|
|
540
|
-
const target = tr.properties.find((p) => p.key === "target")?.value;
|
|
541
|
-
const effect = tr.properties.find((p) => p.key === "effect")?.value;
|
|
542
|
-
const duration = tr.properties.find((p) => p.key === "duration")?.value;
|
|
543
|
-
this.emit(`# Transition: ${effect} (${duration}s)`);
|
|
544
|
-
if (target) {
|
|
545
|
-
this.emit(`get_tree().change_scene_to_file("res://scenes/${target}.tscn")`);
|
|
546
|
-
}
|
|
547
|
-
this.indentLevel--;
|
|
548
|
-
this.emit("");
|
|
549
|
-
}
|
|
550
|
-
compileEffects(effects) {
|
|
551
|
-
this.emit("# === Post-Processing (configure via WorldEnvironment) ===");
|
|
552
|
-
for (const effect of effects.effects) {
|
|
553
|
-
this.emit(`# Effect: ${effect.effectType} \u2014 ${JSON.stringify(effect.properties)}`);
|
|
554
|
-
}
|
|
555
|
-
this.emit("");
|
|
556
|
-
}
|
|
557
|
-
compileUI(ui) {
|
|
558
|
-
this.emit("# === UI Overlay ===");
|
|
559
|
-
this.emit("var ui_layer = CanvasLayer.new()");
|
|
560
|
-
this.emit('ui_layer.name = "HoloUI"');
|
|
561
|
-
this.emit("add_child(ui_layer)");
|
|
562
|
-
this.emit("");
|
|
563
|
-
for (const el of ui.elements) {
|
|
564
|
-
const varName = this.sanitizeName(el.name);
|
|
565
|
-
const elType = el.properties.find((p) => p.key === "type")?.value;
|
|
566
|
-
this.emit(`# UI: ${this.escapeStringValue(el.name, "GDScript")} (${elType})`);
|
|
567
|
-
if (elType === "text") {
|
|
568
|
-
this.emit(`var ${varName} = Label.new()`);
|
|
569
|
-
const text = el.properties.find((p) => p.key === "text")?.value;
|
|
570
|
-
if (text) this.emit(`${varName}.text = "${text}"`);
|
|
571
|
-
} else if (elType === "progress") {
|
|
572
|
-
this.emit(`var ${varName} = ProgressBar.new()`);
|
|
573
|
-
} else if (elType === "panel") {
|
|
574
|
-
this.emit(`var ${varName} = Panel.new()`);
|
|
575
|
-
} else {
|
|
576
|
-
this.emit(`var ${varName} = Control.new()`);
|
|
577
|
-
}
|
|
578
|
-
this.emit(`${varName}.name = "${this.escapeStringValue(el.name, "GDScript")}"`);
|
|
579
|
-
const pos = el.properties.find((p) => p.key === "position")?.value;
|
|
580
|
-
if (pos && Array.isArray(pos)) {
|
|
581
|
-
this.emit(`${varName}.position = Vector2(${pos[0]}, ${pos[1]})`);
|
|
582
|
-
}
|
|
583
|
-
const size = el.properties.find((p) => p.key === "size")?.value;
|
|
584
|
-
if (size && Array.isArray(size)) {
|
|
585
|
-
this.emit(`${varName}.size = Vector2(${size[0]}, ${size[1]})`);
|
|
586
|
-
}
|
|
587
|
-
this.emit(`ui_layer.add_child(${varName})`);
|
|
588
|
-
this.emit("");
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
// ─── Helpers ───────────────────────────────────────────────────────────
|
|
592
|
-
emit(line) {
|
|
593
|
-
this.lines.push(this.options.indent.repeat(this.indentLevel) + line);
|
|
594
|
-
}
|
|
595
|
-
sanitizeName(name) {
|
|
596
|
-
return name.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
597
|
-
}
|
|
598
|
-
toVector3(arr) {
|
|
599
|
-
if (Array.isArray(arr) && arr.length >= 3) {
|
|
600
|
-
return `Vector3(${arr[0]}, ${arr[1]}, ${arr[2]})`;
|
|
601
|
-
}
|
|
602
|
-
return `Vector3(${arr}, ${arr}, ${arr})`;
|
|
603
|
-
}
|
|
604
|
-
toColor(value) {
|
|
605
|
-
if (typeof value === "string" && value.startsWith("#")) {
|
|
606
|
-
return `Color.html("${value}")`;
|
|
607
|
-
}
|
|
608
|
-
return `Color.WHITE`;
|
|
609
|
-
}
|
|
610
|
-
toGDScriptValue(value) {
|
|
611
|
-
if (typeof value === "number") return `${value}`;
|
|
612
|
-
if (typeof value === "boolean") return value ? "true" : "false";
|
|
613
|
-
if (typeof value === "string") return `"${this.escapeStringValue(value, "GDScript")}"`;
|
|
614
|
-
if (value === null) return "null";
|
|
615
|
-
if (Array.isArray(value)) return `[${value.map((v) => this.toGDScriptValue(v)).join(", ")}]`;
|
|
616
|
-
return "null";
|
|
617
|
-
}
|
|
618
|
-
findProp(props, key) {
|
|
619
|
-
return props?.find((p) => p.key === key)?.value;
|
|
620
|
-
}
|
|
621
|
-
findObjProp(obj, key) {
|
|
622
|
-
return obj.properties?.find((p) => p.key === key)?.value;
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
export { GodotCompiler, GodotCompiler_exports, init_GodotCompiler };
|
|
629
|
-
//# sourceMappingURL=chunk-K6EKD26I.js.map
|
|
630
|
-
//# sourceMappingURL=chunk-K6EKD26I.js.map
|