@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-Z34RLXRA.cjs
DELETED
|
@@ -1,612 +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/VRChatCompiler.ts
|
|
9
|
-
var VRChatCompiler_exports = {};
|
|
10
|
-
chunk3SAK5KFL_cjs.__export(VRChatCompiler_exports, {
|
|
11
|
-
VRChatCompiler: () => exports.VRChatCompiler,
|
|
12
|
-
compileToVRChat: () => compileToVRChat
|
|
13
|
-
});
|
|
14
|
-
function compileToVRChat(composition, options) {
|
|
15
|
-
const compiler = new exports.VRChatCompiler(options);
|
|
16
|
-
return Promise.resolve(compiler.compile(composition, ""));
|
|
17
|
-
}
|
|
18
|
-
exports.VRChatCompiler = void 0;
|
|
19
|
-
var init_VRChatCompiler = chunk3SAK5KFL_cjs.__esm({
|
|
20
|
-
"src/compiler/VRChatCompiler.ts"() {
|
|
21
|
-
chunkBF2235SI_cjs.init_CompilerBase();
|
|
22
|
-
chunkLXJ4667L_cjs.init_DomainBlockCompilerMixin();
|
|
23
|
-
exports.VRChatCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
|
|
24
|
-
constructor(options = {}) {
|
|
25
|
-
super();
|
|
26
|
-
this.compilerName = "VRChatCompiler";
|
|
27
|
-
this.lines = [];
|
|
28
|
-
this.indentLevel = 0;
|
|
29
|
-
this.udonScripts = /* @__PURE__ */ new Map();
|
|
30
|
-
this.interactableObjects = [];
|
|
31
|
-
this.options = {
|
|
32
|
-
namespace: options.namespace || "HoloWorld",
|
|
33
|
-
className: options.className || "GeneratedWorld",
|
|
34
|
-
worldName: options.worldName || "HoloScript World",
|
|
35
|
-
indent: options.indent || " ",
|
|
36
|
-
sdkVersion: options.sdkVersion || "3.5",
|
|
37
|
-
useUdonSharp: options.useUdonSharp ?? true
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
getRequiredCapability() {
|
|
41
|
-
return platform.ANSCapabilityPath.VRCHAT;
|
|
42
|
-
}
|
|
43
|
-
compile(composition, agentToken, outputPath) {
|
|
44
|
-
this.validateCompilerAccess(agentToken, outputPath);
|
|
45
|
-
this.lines = [];
|
|
46
|
-
this.udonScripts.clear();
|
|
47
|
-
this.interactableObjects = [];
|
|
48
|
-
this.indentLevel = 0;
|
|
49
|
-
const mainScript = this.generateMainScript(composition);
|
|
50
|
-
this.generateUdonScripts(composition);
|
|
51
|
-
const prefabHierarchy = this.generatePrefabHierarchy(composition);
|
|
52
|
-
const worldDescriptor = this.generateWorldDescriptor(composition);
|
|
53
|
-
return {
|
|
54
|
-
mainScript,
|
|
55
|
-
udonScripts: this.udonScripts,
|
|
56
|
-
prefabHierarchy,
|
|
57
|
-
worldDescriptor
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
generateMainScript(composition) {
|
|
61
|
-
this.lines = [];
|
|
62
|
-
this.indentLevel = 0;
|
|
63
|
-
this.emit("// Auto-generated by HoloScript VRChatCompiler");
|
|
64
|
-
this.emit(
|
|
65
|
-
`// Source: composition "${this.escapeStringValue(composition.name, "CSharp")}"`
|
|
66
|
-
);
|
|
67
|
-
this.emit(`// VRChat SDK: ${this.options.sdkVersion}`);
|
|
68
|
-
this.emit("// Do not edit manually \xE2\u20AC\u201D regenerate from .holo source");
|
|
69
|
-
this.emit("");
|
|
70
|
-
this.emit("using UdonSharp;");
|
|
71
|
-
this.emit("using UnityEngine;");
|
|
72
|
-
this.emit("using VRC.SDKBase;");
|
|
73
|
-
this.emit("using VRC.Udon;");
|
|
74
|
-
this.emit("using VRC.SDK3.Components;");
|
|
75
|
-
if (composition.audio?.length) {
|
|
76
|
-
this.emit("using VRC.SDK3.Components.Audio;");
|
|
77
|
-
}
|
|
78
|
-
this.emit("");
|
|
79
|
-
this.emit(`namespace ${this.options.namespace}`);
|
|
80
|
-
this.emit("{");
|
|
81
|
-
this.indentLevel++;
|
|
82
|
-
this.emit("[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]");
|
|
83
|
-
this.emit(`public class ${this.options.className} : UdonSharpBehaviour`);
|
|
84
|
-
this.emit("{");
|
|
85
|
-
this.indentLevel++;
|
|
86
|
-
if (composition.state) {
|
|
87
|
-
this.emit("// === Synced State ===");
|
|
88
|
-
for (const prop of composition.state.properties) {
|
|
89
|
-
const csType = this.toCSharpType(prop.value);
|
|
90
|
-
const csVal = this.toCSharpValue(prop.value);
|
|
91
|
-
this.emit(
|
|
92
|
-
`[UdonSynced] public ${csType} ${this.escapeStringValue(prop.key, "CSharp")} = ${csVal};`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
this.emit("");
|
|
96
|
-
}
|
|
97
|
-
this.emit("// === Object References ===");
|
|
98
|
-
this.emit('[Header("Scene Objects")]');
|
|
99
|
-
const objects = composition.objects || [];
|
|
100
|
-
for (const obj of objects) {
|
|
101
|
-
const varName = this.sanitizeName(obj.name);
|
|
102
|
-
this.emit(`public GameObject ${varName};`);
|
|
103
|
-
}
|
|
104
|
-
this.emit("");
|
|
105
|
-
this.emit("void Start()");
|
|
106
|
-
this.emit("{");
|
|
107
|
-
this.indentLevel++;
|
|
108
|
-
this.emit('Debug.Log("[HoloWorld] World initialized");');
|
|
109
|
-
if (composition.environment) {
|
|
110
|
-
this.compileEnvironment(composition.environment);
|
|
111
|
-
}
|
|
112
|
-
this.indentLevel--;
|
|
113
|
-
this.emit("}");
|
|
114
|
-
this.emit("");
|
|
115
|
-
this.emit("public override void OnDeserialization()");
|
|
116
|
-
this.emit("{");
|
|
117
|
-
this.indentLevel++;
|
|
118
|
-
this.emit("// Handle synced state updates");
|
|
119
|
-
this.emit("UpdateVisuals();");
|
|
120
|
-
this.indentLevel--;
|
|
121
|
-
this.emit("}");
|
|
122
|
-
this.emit("");
|
|
123
|
-
this.emit("private void UpdateVisuals()");
|
|
124
|
-
this.emit("{");
|
|
125
|
-
this.indentLevel++;
|
|
126
|
-
this.emit("// Update visuals based on synced state");
|
|
127
|
-
this.indentLevel--;
|
|
128
|
-
this.emit("}");
|
|
129
|
-
this.emit("");
|
|
130
|
-
this.emit("public override void OnPlayerJoined(VRCPlayerApi player)");
|
|
131
|
-
this.emit("{");
|
|
132
|
-
this.indentLevel++;
|
|
133
|
-
this.emit("if (player.isLocal)");
|
|
134
|
-
this.emit("{");
|
|
135
|
-
this.indentLevel++;
|
|
136
|
-
this.emit('Debug.Log($"[HoloWorld] Welcome, {player.displayName}!");');
|
|
137
|
-
this.indentLevel--;
|
|
138
|
-
this.emit("}");
|
|
139
|
-
this.indentLevel--;
|
|
140
|
-
this.emit("}");
|
|
141
|
-
this.emit("");
|
|
142
|
-
if (composition.zones) {
|
|
143
|
-
for (const zone of composition.zones) {
|
|
144
|
-
this.compileZoneTriggers(zone);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (composition.timelines) {
|
|
148
|
-
for (const tl of composition.timelines) {
|
|
149
|
-
this.compileTimeline(tl);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (composition.transitions) {
|
|
153
|
-
for (const tr of composition.transitions) {
|
|
154
|
-
this.compileTransition(tr);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
this.compileVRChatDomainBlocks(composition);
|
|
158
|
-
this.indentLevel--;
|
|
159
|
-
this.emit("}");
|
|
160
|
-
this.indentLevel--;
|
|
161
|
-
this.emit("}");
|
|
162
|
-
return this.lines.join("\n");
|
|
163
|
-
}
|
|
164
|
-
compileVRChatDomainBlocks(composition) {
|
|
165
|
-
const domainBlocks = composition.domainBlocks ?? [];
|
|
166
|
-
if (domainBlocks.length === 0) return;
|
|
167
|
-
this.emit("");
|
|
168
|
-
this.emit("// === v4.2 Domain Blocks (VRChat/Unity) ===");
|
|
169
|
-
let blockIdx = 0;
|
|
170
|
-
const compiled = chunkLXJ4667L_cjs.compileDomainBlocks(
|
|
171
|
-
domainBlocks,
|
|
172
|
-
{
|
|
173
|
-
material: (block) => {
|
|
174
|
-
const mat = chunkLXJ4667L_cjs.compileMaterialBlock(block);
|
|
175
|
-
return chunkLXJ4667L_cjs.materialToVRChat(mat, `db${blockIdx++}`);
|
|
176
|
-
},
|
|
177
|
-
physics: (block) => {
|
|
178
|
-
const phys = chunkLXJ4667L_cjs.compilePhysicsBlock(block);
|
|
179
|
-
return chunkLXJ4667L_cjs.physicsToUnity(phys, `db${blockIdx++}`);
|
|
180
|
-
},
|
|
181
|
-
vfx: (block) => {
|
|
182
|
-
const ps = chunkLXJ4667L_cjs.compileParticleBlock(block);
|
|
183
|
-
return chunkLXJ4667L_cjs.particlesToUnity(ps, `db${blockIdx++}`);
|
|
184
|
-
},
|
|
185
|
-
postfx: (block) => {
|
|
186
|
-
const pp = chunkLXJ4667L_cjs.compilePostProcessingBlock(block);
|
|
187
|
-
return chunkLXJ4667L_cjs.postProcessingToUnity(pp);
|
|
188
|
-
},
|
|
189
|
-
audio: (block) => {
|
|
190
|
-
const audio = chunkLXJ4667L_cjs.compileAudioSourceBlock(block);
|
|
191
|
-
return chunkLXJ4667L_cjs.audioSourceToUnity(audio, `db${blockIdx++}`);
|
|
192
|
-
},
|
|
193
|
-
weather: (block) => {
|
|
194
|
-
const weather = chunkLXJ4667L_cjs.compileWeatherBlock(block);
|
|
195
|
-
return chunkLXJ4667L_cjs.weatherToUnity(weather);
|
|
196
|
-
},
|
|
197
|
-
narrative: (block) => {
|
|
198
|
-
const narr = chunkLXJ4667L_cjs.compileNarrativeBlock(block);
|
|
199
|
-
return chunkLXJ4667L_cjs.narrativeToVRChat(narr);
|
|
200
|
-
},
|
|
201
|
-
payment: (block) => {
|
|
202
|
-
const pay = chunkLXJ4667L_cjs.compilePaymentBlock(block);
|
|
203
|
-
return chunkLXJ4667L_cjs.paymentToVRChat(pay);
|
|
204
|
-
},
|
|
205
|
-
healthcare: (block) => {
|
|
206
|
-
const h = chunkLXJ4667L_cjs.compileHealthcareBlock(block);
|
|
207
|
-
return chunkLXJ4667L_cjs.healthcareToVRChat(h);
|
|
208
|
-
},
|
|
209
|
-
robotics: (block) => {
|
|
210
|
-
const r = chunkLXJ4667L_cjs.compileRoboticsBlock(block);
|
|
211
|
-
return chunkLXJ4667L_cjs.roboticsToVRChat(r);
|
|
212
|
-
},
|
|
213
|
-
iot: (block) => chunkLXJ4667L_cjs.iotToVRChat(chunkLXJ4667L_cjs.compileIoTBlock(block)),
|
|
214
|
-
dataviz: (block) => chunkLXJ4667L_cjs.datavizToVRChat(chunkLXJ4667L_cjs.compileDataVizBlock(block)),
|
|
215
|
-
education: (block) => chunkLXJ4667L_cjs.educationToVRChat(chunkLXJ4667L_cjs.compileEducationBlock(block)),
|
|
216
|
-
music: (block) => chunkLXJ4667L_cjs.musicToVRChat(chunkLXJ4667L_cjs.compileMusicBlock(block)),
|
|
217
|
-
architecture: (block) => chunkLXJ4667L_cjs.architectureToVRChat(chunkLXJ4667L_cjs.compileArchitectureBlock(block)),
|
|
218
|
-
web3: (block) => chunkLXJ4667L_cjs.web3ToVRChat(chunkLXJ4667L_cjs.compileWeb3Block(block)),
|
|
219
|
-
procedural: (block) => chunkLXJ4667L_cjs.proceduralToVRChat(chunkLXJ4667L_cjs.compileProceduralBlock(block)),
|
|
220
|
-
rendering: (block) => chunkLXJ4667L_cjs.renderingToVRChat(chunkLXJ4667L_cjs.compileRenderingBlock(block)),
|
|
221
|
-
navigation: (block) => chunkLXJ4667L_cjs.navigationToVRChat(chunkLXJ4667L_cjs.compileNavigationBlock(block)),
|
|
222
|
-
input: (block) => chunkLXJ4667L_cjs.inputToVRChat(chunkLXJ4667L_cjs.compileInputBlock(block))
|
|
223
|
-
},
|
|
224
|
-
(block) => `// Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "CSharp")}"`
|
|
225
|
-
);
|
|
226
|
-
for (const line of compiled) {
|
|
227
|
-
for (const l of line.split("\n")) {
|
|
228
|
-
this.emit(l);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
generateUdonScripts(composition) {
|
|
233
|
-
const objects = composition.objects || [];
|
|
234
|
-
for (const obj of objects) {
|
|
235
|
-
if (!obj.traits) continue;
|
|
236
|
-
const hasGrabbable = obj.traits.some((t) => t.name === "grabbable");
|
|
237
|
-
const hasPointable = obj.traits.some((t) => t.name === "pointable" || t.name === "clickable");
|
|
238
|
-
const hasNetworked = obj.traits.some((t) => t.name === "networked" || t.name === "synced");
|
|
239
|
-
const hasPortal = obj.traits.some((t) => t.name === "portal");
|
|
240
|
-
const hasMirror = obj.traits.some((t) => t.name === "mirror");
|
|
241
|
-
if (hasGrabbable || hasPointable || hasNetworked || hasPortal || hasMirror) {
|
|
242
|
-
const script = this.generateObjectUdonScript(obj, {
|
|
243
|
-
hasGrabbable,
|
|
244
|
-
hasPointable,
|
|
245
|
-
hasNetworked,
|
|
246
|
-
hasPortal,
|
|
247
|
-
hasMirror
|
|
248
|
-
});
|
|
249
|
-
this.udonScripts.set(`${this.sanitizeName(obj.name)}Behaviour.cs`, script);
|
|
250
|
-
this.interactableObjects.push(obj.name);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
generateObjectUdonScript(obj, traits) {
|
|
255
|
-
const lines = [];
|
|
256
|
-
const varName = this.sanitizeName(obj.name);
|
|
257
|
-
const className = `${varName}Behaviour`;
|
|
258
|
-
lines.push("// Auto-generated UdonSharp script");
|
|
259
|
-
lines.push(`// Object: ${this.escapeStringValue(obj.name, "CSharp")}`);
|
|
260
|
-
lines.push("");
|
|
261
|
-
lines.push("using UdonSharp;");
|
|
262
|
-
lines.push("using UnityEngine;");
|
|
263
|
-
lines.push("using VRC.SDKBase;");
|
|
264
|
-
lines.push("using VRC.Udon;");
|
|
265
|
-
lines.push("");
|
|
266
|
-
const syncMode = traits.hasNetworked ? "BehaviourSyncMode.Manual" : "BehaviourSyncMode.None";
|
|
267
|
-
lines.push(`[UdonBehaviourSyncMode(${syncMode})]`);
|
|
268
|
-
lines.push(`public class ${className} : UdonSharpBehaviour`);
|
|
269
|
-
lines.push("{");
|
|
270
|
-
if (obj.state?.properties) {
|
|
271
|
-
lines.push(" // === State ===");
|
|
272
|
-
for (const prop of obj.state.properties) {
|
|
273
|
-
const csType = this.toCSharpType(prop.value);
|
|
274
|
-
const csVal = this.toCSharpValue(prop.value);
|
|
275
|
-
const syncAttr = traits.hasNetworked ? "[UdonSynced] " : "";
|
|
276
|
-
lines.push(
|
|
277
|
-
` ${syncAttr}public ${csType} ${this.escapeStringValue(prop.key, "CSharp")} = ${csVal};`
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
lines.push("");
|
|
281
|
-
}
|
|
282
|
-
if (traits.hasGrabbable) {
|
|
283
|
-
lines.push(" // VRC_Pickup compatible");
|
|
284
|
-
lines.push(" public VRC_Pickup pickup;");
|
|
285
|
-
lines.push("");
|
|
286
|
-
lines.push(" public override void OnPickup()");
|
|
287
|
-
lines.push(" {");
|
|
288
|
-
lines.push(' Debug.Log($"[{gameObject.name}] Picked up");');
|
|
289
|
-
if (traits.hasNetworked) {
|
|
290
|
-
lines.push(" Networking.SetOwner(Networking.LocalPlayer, gameObject);");
|
|
291
|
-
lines.push(" RequestSerialization();");
|
|
292
|
-
}
|
|
293
|
-
lines.push(" }");
|
|
294
|
-
lines.push("");
|
|
295
|
-
lines.push(" public override void OnDrop()");
|
|
296
|
-
lines.push(" {");
|
|
297
|
-
lines.push(' Debug.Log($"[{gameObject.name}] Dropped");');
|
|
298
|
-
if (traits.hasNetworked) {
|
|
299
|
-
lines.push(" RequestSerialization();");
|
|
300
|
-
}
|
|
301
|
-
lines.push(" }");
|
|
302
|
-
lines.push("");
|
|
303
|
-
}
|
|
304
|
-
if (traits.hasPointable) {
|
|
305
|
-
lines.push(" public override void Interact()");
|
|
306
|
-
lines.push(" {");
|
|
307
|
-
lines.push(' Debug.Log($"[{gameObject.name}] Interacted");');
|
|
308
|
-
lines.push(" OnInteractHandler();");
|
|
309
|
-
lines.push(" }");
|
|
310
|
-
lines.push("");
|
|
311
|
-
lines.push(" private void OnInteractHandler()");
|
|
312
|
-
lines.push(" {");
|
|
313
|
-
lines.push(" // Custom interaction logic based on traits");
|
|
314
|
-
lines.push(" }");
|
|
315
|
-
lines.push("");
|
|
316
|
-
}
|
|
317
|
-
if (traits.hasPortal) {
|
|
318
|
-
const portalTrait = obj.traits?.find((t) => t.name === "portal");
|
|
319
|
-
const destination = portalTrait?.config?.destination || "wrld_unknown";
|
|
320
|
-
lines.push(' [Header("Portal Settings")]');
|
|
321
|
-
lines.push(` public string destinationWorld = "${destination}";`);
|
|
322
|
-
lines.push("");
|
|
323
|
-
lines.push(" public override void Interact()");
|
|
324
|
-
lines.push(" {");
|
|
325
|
-
lines.push(" // VRChat portal \xE2\u20AC\u201D player will be teleported");
|
|
326
|
-
lines.push(' Debug.Log($"Portal to {destinationWorld}");');
|
|
327
|
-
lines.push(" }");
|
|
328
|
-
lines.push("");
|
|
329
|
-
}
|
|
330
|
-
if (traits.hasNetworked) {
|
|
331
|
-
lines.push(" public override void OnDeserialization()");
|
|
332
|
-
lines.push(" {");
|
|
333
|
-
lines.push(" // Handle network sync");
|
|
334
|
-
lines.push(" UpdateFromNetwork();");
|
|
335
|
-
lines.push(" }");
|
|
336
|
-
lines.push("");
|
|
337
|
-
lines.push(" private void UpdateFromNetwork()");
|
|
338
|
-
lines.push(" {");
|
|
339
|
-
lines.push(" // Apply synced state to visuals");
|
|
340
|
-
lines.push(" }");
|
|
341
|
-
lines.push("");
|
|
342
|
-
}
|
|
343
|
-
lines.push("}");
|
|
344
|
-
return lines.join("\n");
|
|
345
|
-
}
|
|
346
|
-
generatePrefabHierarchy(composition) {
|
|
347
|
-
const lines = [];
|
|
348
|
-
lines.push(
|
|
349
|
-
`# VRChat World Prefab Hierarchy: ${this.escapeStringValue(composition.name, "CSharp")}`
|
|
350
|
-
);
|
|
351
|
-
lines.push("# Generated by HoloScript VRChatCompiler");
|
|
352
|
-
lines.push("");
|
|
353
|
-
lines.push("World Root");
|
|
354
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Environment");
|
|
355
|
-
if (composition.lights) {
|
|
356
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Lighting");
|
|
357
|
-
for (const light of composition.lights) {
|
|
358
|
-
lines.push(
|
|
359
|
-
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(light.name, "CSharp")} (${light.lightType})`
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
if (composition.objects) {
|
|
364
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Objects");
|
|
365
|
-
for (const obj of composition.objects) {
|
|
366
|
-
const traits = obj.traits?.map((t) => `@${this.escapeStringValue(t.name, "CSharp")}`).join(" ") || "";
|
|
367
|
-
lines.push(
|
|
368
|
-
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(obj.name, "CSharp")} ${traits}`
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (composition.spatialGroups) {
|
|
373
|
-
for (const group of composition.spatialGroups) {
|
|
374
|
-
lines.push(
|
|
375
|
-
`\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(group.name, "CSharp")} (SpatialGroup)`
|
|
376
|
-
);
|
|
377
|
-
for (const child of group.objects || []) {
|
|
378
|
-
lines.push(`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(child.name, "CSharp")}`);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
if (composition.audio) {
|
|
383
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Audio");
|
|
384
|
-
for (const audio of composition.audio) {
|
|
385
|
-
lines.push(
|
|
386
|
-
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(audio.name, "CSharp")} (VRCSpatialAudioSource)`
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (composition.zones) {
|
|
391
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Zones");
|
|
392
|
-
for (const zone of composition.zones) {
|
|
393
|
-
lines.push(
|
|
394
|
-
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(zone.name, "CSharp")} (Trigger)`
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC VRCWorld (VRC_World)");
|
|
399
|
-
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Spawn Points");
|
|
400
|
-
lines.push("\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC SpawnPoint_0");
|
|
401
|
-
lines.push("\xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC Player Mods");
|
|
402
|
-
return lines.join("\n");
|
|
403
|
-
}
|
|
404
|
-
generateWorldDescriptor(composition) {
|
|
405
|
-
const lines = [];
|
|
406
|
-
lines.push("// VRC_World Descriptor Settings");
|
|
407
|
-
lines.push(`// World: ${this.options.worldName}`);
|
|
408
|
-
lines.push("");
|
|
409
|
-
lines.push("VRC_SceneDescriptor:");
|
|
410
|
-
lines.push(` worldName: "${this.options.worldName}"`);
|
|
411
|
-
lines.push(` worldId: "wrld_${this.generateWorldId()}"`);
|
|
412
|
-
lines.push(" capacity: 32");
|
|
413
|
-
lines.push(" recommendedCapacity: 16");
|
|
414
|
-
lines.push(" respawnHeightY: -100");
|
|
415
|
-
lines.push(" objectBehaviourAtRespawnHeight: Destroy");
|
|
416
|
-
lines.push(" forbidUserPortals: false");
|
|
417
|
-
lines.push(' unityVersion: "2022.3.22f1"');
|
|
418
|
-
lines.push(` sdkVersion: "${this.options.sdkVersion}"`);
|
|
419
|
-
lines.push("");
|
|
420
|
-
lines.push("SpawnPoints:");
|
|
421
|
-
lines.push(" - position: [0, 0, 0]");
|
|
422
|
-
lines.push(" rotation: [0, 0, 0]");
|
|
423
|
-
lines.push("");
|
|
424
|
-
if (composition.camera) {
|
|
425
|
-
lines.push("ReferenceCamera:");
|
|
426
|
-
lines.push(" near: 0.01");
|
|
427
|
-
lines.push(" far: 1000");
|
|
428
|
-
}
|
|
429
|
-
return lines.join("\n");
|
|
430
|
-
}
|
|
431
|
-
compileEnvironment(env) {
|
|
432
|
-
this.emit("// === Environment Setup ===");
|
|
433
|
-
for (const prop of env.properties) {
|
|
434
|
-
if (prop.key === "skybox" || prop.key === "preset") {
|
|
435
|
-
this.emit(`// Skybox: "${prop.value}" \xE2\u20AC\u201D set via VRChat scene settings`);
|
|
436
|
-
} else if (prop.key === "ambient_light") {
|
|
437
|
-
this.emit(`RenderSettings.ambientIntensity = ${prop.value}f;`);
|
|
438
|
-
} else if (prop.key === "fog" && typeof prop.value === "object") {
|
|
439
|
-
const fog = prop.value;
|
|
440
|
-
this.emit("RenderSettings.fog = true;");
|
|
441
|
-
if (fog.color) this.emit(`RenderSettings.fogColor = ${this.toColor(fog.color)};`);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
compileZoneTriggers(zone) {
|
|
446
|
-
const varName = this.sanitizeName(zone.name);
|
|
447
|
-
this.emit(`// Zone: ${this.escapeStringValue(zone.name, "CSharp")}`);
|
|
448
|
-
this.emit(`public void On${varName}Enter(VRCPlayerApi player)`);
|
|
449
|
-
this.emit("{");
|
|
450
|
-
this.indentLevel++;
|
|
451
|
-
this.emit(
|
|
452
|
-
`Debug.Log($"Player {player.displayName} entered ${this.escapeStringValue(zone.name, "CSharp")}");`
|
|
453
|
-
);
|
|
454
|
-
this.indentLevel--;
|
|
455
|
-
this.emit("}");
|
|
456
|
-
this.emit("");
|
|
457
|
-
this.emit(`public void On${varName}Exit(VRCPlayerApi player)`);
|
|
458
|
-
this.emit("{");
|
|
459
|
-
this.indentLevel++;
|
|
460
|
-
this.emit(
|
|
461
|
-
`Debug.Log($"Player {player.displayName} exited ${this.escapeStringValue(zone.name, "CSharp")}");`
|
|
462
|
-
);
|
|
463
|
-
this.indentLevel--;
|
|
464
|
-
this.emit("}");
|
|
465
|
-
this.emit("");
|
|
466
|
-
}
|
|
467
|
-
compileTimeline(timeline) {
|
|
468
|
-
const name = this.sanitizeName(timeline.name);
|
|
469
|
-
this.emit(`// Timeline: ${this.escapeStringValue(timeline.name, "CSharp")}`);
|
|
470
|
-
this.emit(`public void Play${name}()`);
|
|
471
|
-
this.emit("{");
|
|
472
|
-
this.indentLevel++;
|
|
473
|
-
this.emit(`SendCustomEventDelayedSeconds("${name}Step0", 0f);`);
|
|
474
|
-
this.indentLevel--;
|
|
475
|
-
this.emit("}");
|
|
476
|
-
this.emit("");
|
|
477
|
-
for (let i = 0; i < timeline.entries.length; i++) {
|
|
478
|
-
const entry = timeline.entries[i];
|
|
479
|
-
const nextDelay = i < timeline.entries.length - 1 ? timeline.entries[i + 1].time - entry.time : 0;
|
|
480
|
-
this.emit(`public void ${name}Step${i}()`);
|
|
481
|
-
this.emit("{");
|
|
482
|
-
this.indentLevel++;
|
|
483
|
-
if (entry.action.kind === "animate") {
|
|
484
|
-
this.emit(`// Animate ${entry.action.target}`);
|
|
485
|
-
} else if (entry.action.kind === "emit") {
|
|
486
|
-
this.emit(`SendCustomEvent("${entry.action.event}");`);
|
|
487
|
-
} else if (entry.action.kind === "call") {
|
|
488
|
-
this.emit(`${entry.action.method}();`);
|
|
489
|
-
}
|
|
490
|
-
if (nextDelay > 0) {
|
|
491
|
-
this.emit(`SendCustomEventDelayedSeconds("${name}Step${i + 1}", ${nextDelay}f);`);
|
|
492
|
-
} else if (timeline.loop && i === timeline.entries.length - 1) {
|
|
493
|
-
this.emit(`SendCustomEventDelayedSeconds("${name}Step0", 0.1f);`);
|
|
494
|
-
}
|
|
495
|
-
this.indentLevel--;
|
|
496
|
-
this.emit("}");
|
|
497
|
-
this.emit("");
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
compileTransition(transition) {
|
|
501
|
-
const name = this.sanitizeName(transition.name);
|
|
502
|
-
this.emit(`// Transition: ${this.escapeStringValue(transition.name, "CSharp")}`);
|
|
503
|
-
this.emit(`public void ${name}Transition()`);
|
|
504
|
-
this.emit("{");
|
|
505
|
-
this.indentLevel++;
|
|
506
|
-
const dest = transition.properties.find((p) => p.key === "destination" || p.key === "to");
|
|
507
|
-
if (dest) {
|
|
508
|
-
this.emit(`// Transition to: ${dest.value}`);
|
|
509
|
-
}
|
|
510
|
-
this.indentLevel--;
|
|
511
|
-
this.emit("}");
|
|
512
|
-
this.emit("");
|
|
513
|
-
}
|
|
514
|
-
generateWorldId() {
|
|
515
|
-
const chars = "abcdef0123456789";
|
|
516
|
-
let id = "";
|
|
517
|
-
for (let i = 0; i < 8; i++) {
|
|
518
|
-
id += chars[Math.floor(Math.random() * chars.length)];
|
|
519
|
-
}
|
|
520
|
-
return id + "-0000-0000-0000-000000000000";
|
|
521
|
-
}
|
|
522
|
-
// === Utility Methods ===
|
|
523
|
-
emit(line) {
|
|
524
|
-
const indent = this.options.indent.repeat(this.indentLevel);
|
|
525
|
-
this.lines.push(indent + line);
|
|
526
|
-
}
|
|
527
|
-
sanitizeName(name) {
|
|
528
|
-
return name.replace(/[^a-zA-Z0-9_]/g, "_").replace(/^[0-9]/, "_$&");
|
|
529
|
-
}
|
|
530
|
-
toCSharpType(value) {
|
|
531
|
-
if (value === null) return "object";
|
|
532
|
-
if (typeof value === "boolean") return "bool";
|
|
533
|
-
if (typeof value === "number") return Number.isInteger(value) ? "int" : "float";
|
|
534
|
-
if (typeof value === "string") return "string";
|
|
535
|
-
if (Array.isArray(value)) {
|
|
536
|
-
if (value.length === 3 && value.every((v) => typeof v === "number")) return "Vector3";
|
|
537
|
-
if (value.length === 4 && value.every((v) => typeof v === "number")) return "Quaternion";
|
|
538
|
-
return "object[]";
|
|
539
|
-
}
|
|
540
|
-
return "object";
|
|
541
|
-
}
|
|
542
|
-
toCSharpValue(value) {
|
|
543
|
-
if (value === null) return "null";
|
|
544
|
-
if (typeof value === "boolean") return value ? "true" : "false";
|
|
545
|
-
if (typeof value === "number") return Number.isInteger(value) ? `${value}` : `${value}f`;
|
|
546
|
-
if (typeof value === "string") return `"${this.escapeStringValue(value, "CSharp")}"`;
|
|
547
|
-
if (Array.isArray(value)) {
|
|
548
|
-
if (value.length === 3 && value.every((v) => typeof v === "number")) {
|
|
549
|
-
return `new Vector3(${value[0]}f, ${value[1]}f, ${value[2]}f)`;
|
|
550
|
-
}
|
|
551
|
-
if (value.length === 4 && value.every((v) => typeof v === "number")) {
|
|
552
|
-
return `new Quaternion(${value[0]}f, ${value[1]}f, ${value[2]}f, ${value[3]}f)`;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
return "null";
|
|
556
|
-
}
|
|
557
|
-
toColor(value) {
|
|
558
|
-
if (typeof value === "string") {
|
|
559
|
-
if (value.startsWith("#")) {
|
|
560
|
-
const hex = value.slice(1);
|
|
561
|
-
if (hex.length === 6) {
|
|
562
|
-
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
563
|
-
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
564
|
-
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
565
|
-
return `new Color(${r}f, ${g}f, ${b}f)`;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
const colors = {
|
|
569
|
-
red: "Color.red",
|
|
570
|
-
green: "Color.green",
|
|
571
|
-
blue: "Color.blue",
|
|
572
|
-
white: "Color.white",
|
|
573
|
-
black: "Color.black",
|
|
574
|
-
yellow: "Color.yellow",
|
|
575
|
-
cyan: "Color.cyan",
|
|
576
|
-
magenta: "Color.magenta"
|
|
577
|
-
};
|
|
578
|
-
return colors[value.toLowerCase()] || "Color.white";
|
|
579
|
-
}
|
|
580
|
-
if (Array.isArray(value) && value.length >= 3) {
|
|
581
|
-
const [r, g, b, a = 1] = value;
|
|
582
|
-
return `new Color(${r}f, ${g}f, ${b}f, ${a}f)`;
|
|
583
|
-
}
|
|
584
|
-
return "Color.white";
|
|
585
|
-
}
|
|
586
|
-
// Collect all trait names for import optimization
|
|
587
|
-
collectAllTraits(composition) {
|
|
588
|
-
const traits = [];
|
|
589
|
-
const addTraits = (obj) => {
|
|
590
|
-
if (obj.traits) {
|
|
591
|
-
for (const t of obj.traits) {
|
|
592
|
-
if (!traits.includes(t.name)) traits.push(t.name);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
for (const obj of composition.objects || []) addTraits(obj);
|
|
597
|
-
for (const group of composition.spatialGroups || []) {
|
|
598
|
-
for (const child of group.objects || []) {
|
|
599
|
-
addTraits(child);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
return traits;
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
exports.VRChatCompiler_exports = VRChatCompiler_exports;
|
|
609
|
-
exports.compileToVRChat = compileToVRChat;
|
|
610
|
-
exports.init_VRChatCompiler = init_VRChatCompiler;
|
|
611
|
-
//# sourceMappingURL=chunk-Z34RLXRA.cjs.map
|
|
612
|
-
//# sourceMappingURL=chunk-Z34RLXRA.cjs.map
|
package/dist/chunk-ZP4D3CSX.cjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkQ5JT3YML_cjs = require('./chunk-Q5JT3YML.cjs');
|
|
4
|
-
var chunk33LSUQDD_cjs = require('./chunk-33LSUQDD.cjs');
|
|
5
|
-
var chunkLGGRPKTV_cjs = require('./chunk-LGGRPKTV.cjs');
|
|
6
|
-
var chunkBF2235SI_cjs = require('./chunk-BF2235SI.cjs');
|
|
7
|
-
var platform = require('@holoscript/platform');
|
|
8
|
-
|
|
9
|
-
// src/compiler/MultiLayerCompiler.ts
|
|
10
|
-
chunkLGGRPKTV_cjs.init_VRRCompiler();
|
|
11
|
-
chunkQ5JT3YML_cjs.init_ARCompiler();
|
|
12
|
-
chunk33LSUQDD_cjs.init_BabylonCompiler();
|
|
13
|
-
chunkBF2235SI_cjs.init_CompilerBase();
|
|
14
|
-
var MultiLayerCompiler = class extends chunkBF2235SI_cjs.CompilerBase {
|
|
15
|
-
constructor(options) {
|
|
16
|
-
super();
|
|
17
|
-
this.compilerName = "MultiLayerCompiler";
|
|
18
|
-
this.options = options;
|
|
19
|
-
}
|
|
20
|
-
getRequiredCapability() {
|
|
21
|
-
return platform.ANSCapabilityPath.MULTI_LAYER;
|
|
22
|
-
}
|
|
23
|
-
compile(composition, agentToken, outputPath) {
|
|
24
|
-
this.validateCompilerAccess(agentToken, outputPath);
|
|
25
|
-
const result = {
|
|
26
|
-
success: true,
|
|
27
|
-
warnings: [],
|
|
28
|
-
errors: []
|
|
29
|
-
};
|
|
30
|
-
if (this.options.targets.includes("ar")) {
|
|
31
|
-
const arCompiler = new chunkQ5JT3YML_cjs.ARCompiler({
|
|
32
|
-
target: "webxr",
|
|
33
|
-
minify: this.options.minify,
|
|
34
|
-
source_maps: this.options.source_maps,
|
|
35
|
-
features: { hit_test: true, image_tracking: true }
|
|
36
|
-
});
|
|
37
|
-
const arResult = arCompiler.compile(composition, agentToken);
|
|
38
|
-
result.ar = arResult;
|
|
39
|
-
if (!arResult.success) result.success = false;
|
|
40
|
-
}
|
|
41
|
-
if (this.options.targets.includes("vrr")) {
|
|
42
|
-
const vrrCompiler = new chunkLGGRPKTV_cjs.VRRCompiler({
|
|
43
|
-
target: "threejs",
|
|
44
|
-
minify: this.options.minify,
|
|
45
|
-
source_maps: this.options.source_maps,
|
|
46
|
-
performance: { target_fps: 60, max_players: 1e3, lazy_loading: true },
|
|
47
|
-
api_integrations: {}
|
|
48
|
-
// Configured upstream based on @reality_mirror traits
|
|
49
|
-
});
|
|
50
|
-
const vrrResult = vrrCompiler.compile(composition, agentToken);
|
|
51
|
-
result.vrr = vrrResult;
|
|
52
|
-
if (!vrrResult.success) result.success = false;
|
|
53
|
-
}
|
|
54
|
-
if (this.options.targets.includes("vr")) {
|
|
55
|
-
const vrCompiler = new chunk33LSUQDD_cjs.BabylonCompiler({});
|
|
56
|
-
try {
|
|
57
|
-
const vrResult = vrCompiler.compile(composition, agentToken);
|
|
58
|
-
result.vr = vrResult;
|
|
59
|
-
} catch (err) {
|
|
60
|
-
result.success = false;
|
|
61
|
-
result.errors.push(
|
|
62
|
-
`VR Compilation Error: ${err instanceof Error ? err.message : String(err)}`
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
exports.MultiLayerCompiler = MultiLayerCompiler;
|
|
71
|
-
//# sourceMappingURL=chunk-ZP4D3CSX.cjs.map
|
|
72
|
-
//# sourceMappingURL=chunk-ZP4D3CSX.cjs.map
|