@holoscript/core 7.0.0 → 8.0.1
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/README.md +4 -4
- package/bin/holoscript.cjs +3 -0
- package/dist/GLTFPipeline-N6B6PJ6G.cjs +38 -0
- package/dist/GLTFPipeline-P3WMNYCN.js +17 -0
- package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
- package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
- package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
- package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
- package/dist/HoloScriptRuntime-CBYJX3LZ.js +10 -0
- package/dist/HoloScriptRuntime-VJ374RER.cjs +19 -0
- package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
- package/dist/USDZExporter-D2HQLQYK.js +1035 -0
- package/dist/agents/index.cjs +19 -0
- package/dist/agents/index.d.ts +100 -0
- package/dist/agents/index.js +17 -0
- package/dist/chunk-2BSMSUCE.js +1941 -0
- package/dist/chunk-2IWC4FP7.cjs +1189 -0
- package/dist/chunk-2M2DPHKB.js +762 -0
- package/dist/chunk-2X7NGX3M.js +2426 -0
- package/dist/chunk-2YSNA2F2.cjs +1274 -0
- package/dist/chunk-3FOKASKO.cjs +348 -0
- package/dist/chunk-3WZEJHUQ.cjs +116 -0
- package/dist/chunk-4C57PR42.js +468 -0
- package/dist/chunk-4GU5GCIY.js +1384 -0
- package/dist/chunk-4N4SXXWF.js +769 -0
- package/dist/chunk-4PDEPEQW.cjs +41 -0
- package/dist/chunk-4R6SBXDB.js +45 -0
- package/dist/chunk-4SDKXQ4C.js +811 -0
- package/dist/chunk-4V2E7U7Q.cjs +2015 -0
- package/dist/chunk-5FSKKMR7.cjs +2092 -0
- package/dist/chunk-5GLCTO44.js +161 -0
- package/dist/chunk-5H2G27PK.cjs +627 -0
- package/dist/chunk-5JEU52DW.js +382 -0
- package/dist/chunk-5NWINHR5.cjs +689 -0
- package/dist/chunk-5S7RKFGR.cjs +446 -0
- package/dist/chunk-5WUNN6ZN.cjs +428 -0
- package/dist/chunk-6CTRH7HT.cjs +1985 -0
- package/dist/chunk-6EX3I5P4.cjs +130 -0
- package/dist/chunk-6Q7RC2MK.cjs +1418 -0
- package/dist/chunk-7H33U5SM.cjs +413 -0
- package/dist/chunk-7M3PNU2M.cjs +672 -0
- package/dist/chunk-7T25IEZ2.js +449 -0
- package/dist/chunk-7V4JI5TB.cjs +6947 -0
- package/dist/chunk-A6KINLZJ.js +236 -0
- package/dist/chunk-ADADVMXY.js +404 -0
- package/dist/chunk-AIA52I7T.cjs +543 -0
- package/dist/chunk-ALC6K7GL.cjs +4402 -0
- package/dist/chunk-ANXZFVY2.js +113 -0
- package/dist/chunk-AOVGZ25K.cjs +56583 -0
- package/dist/chunk-AVJHHUC5.cjs +718 -0
- package/dist/chunk-BGY3SDG3.js +4396 -0
- package/dist/chunk-BOVPWH4H.js +3857 -0
- package/dist/chunk-BRQJKJGT.cjs +20 -0
- package/dist/chunk-C37BHB7N.cjs +636 -0
- package/dist/chunk-CBJY23VL.js +126 -0
- package/dist/chunk-CCATWPXM.js +778 -0
- package/dist/chunk-CIWWXYHZ.cjs +50 -0
- package/dist/chunk-CMT5NMMS.js +669 -0
- package/dist/chunk-CR4FMIWL.cjs +1049 -0
- package/dist/chunk-CR7XRXRN.cjs +639 -0
- package/dist/chunk-CSD27UNQ.js +2176 -0
- package/dist/chunk-D3STJ56J.js +714 -0
- package/dist/chunk-DAJXW4KX.js +725 -0
- package/dist/chunk-DHO2YRIM.js +756 -0
- package/dist/chunk-DTGBOSEM.cjs +319 -0
- package/dist/chunk-E6XXE66V.js +2252 -0
- package/dist/chunk-E7JP3BS3.cjs +61 -0
- package/dist/chunk-EKBKLK7P.js +1169 -0
- package/dist/chunk-EKYL4PE3.cjs +404 -0
- package/dist/chunk-EXKSFGSX.cjs +274 -0
- package/dist/chunk-EXUP2BUM.cjs +1173 -0
- package/dist/chunk-FDSGHPAK.js +130 -0
- package/dist/chunk-FEWUHQNM.cjs +144 -0
- package/dist/chunk-FFAOS5HQ.js +70 -0
- package/dist/chunk-FGGJQRLZ.js +270 -0
- package/dist/chunk-FHP6LXJS.js +415 -0
- package/dist/chunk-FJPADH77.cjs +666 -0
- package/dist/chunk-FL33V6U7.js +421 -0
- package/dist/chunk-FYSPZT4V.cjs +169 -0
- package/dist/chunk-GIOYPNTH.js +5575 -0
- package/dist/chunk-GJNCFRJU.cjs +125 -0
- package/dist/chunk-GMP623FG.cjs +1508 -0
- package/dist/chunk-GQHQOPXZ.cjs +5580 -0
- package/dist/chunk-GTU2Z2WW.cjs +262 -0
- package/dist/chunk-GYZE55MO.js +2007 -0
- package/dist/chunk-GZG4KA4E.js +529 -0
- package/dist/chunk-H652NHX5.js +600 -0
- package/dist/chunk-HCCQLAA4.cjs +74 -0
- package/dist/chunk-HKEXJUWS.cjs +4007 -0
- package/dist/chunk-HNDK4IQU.cjs +5737 -0
- package/dist/chunk-HR2OSYVQ.js +56165 -0
- package/dist/chunk-HYNTS5CP.js +422 -0
- package/dist/chunk-I6XZ5DZF.cjs +488 -0
- package/dist/chunk-ILRBGFVD.cjs +72 -0
- package/dist/chunk-IUDGEUDO.cjs +1409 -0
- package/dist/chunk-IUTY5WQ2.cjs +424 -0
- package/dist/chunk-IVY74O6C.js +247 -0
- package/dist/chunk-IWC5DM2M.cjs +611 -0
- package/dist/chunk-J32ZJZJH.js +554 -0
- package/dist/chunk-J52VSAQ7.js +6884 -0
- package/dist/chunk-J6M4FPK5.js +421 -0
- package/dist/chunk-J7XZV333.js +844 -0
- package/dist/chunk-JBNDTXXV.cjs +2433 -0
- package/dist/chunk-JC5YBPSF.cjs +984 -0
- package/dist/chunk-JD7CIZ33.js +1949 -0
- package/dist/chunk-JIBL5LRK.js +4287 -0
- package/dist/chunk-JIYN45TV.cjs +2525 -0
- package/dist/chunk-K574J76X.cjs +457 -0
- package/dist/chunk-KHDZJE5D.cjs +2196 -0
- package/dist/chunk-KKFZ3B6J.cjs +557 -0
- package/dist/chunk-KKP7JKN4.cjs +6002 -0
- package/dist/chunk-KPJL34Y7.cjs +186 -0
- package/dist/chunk-KQCN6AKJ.cjs +3042 -0
- package/dist/chunk-L5LKKENW.cjs +424 -0
- package/dist/chunk-LHAXPADA.js +882 -0
- package/dist/chunk-LM2VU56C.cjs +37 -0
- package/dist/chunk-M56JSP4A.js +400 -0
- package/dist/chunk-MBOOR7X4.js +18 -0
- package/dist/chunk-MQWAT42R.cjs +4310 -0
- package/dist/chunk-MXFUTKCO.js +56 -0
- package/dist/chunk-MYY4PMWX.cjs +264 -0
- package/dist/chunk-N75IH2HY.js +258 -0
- package/dist/chunk-NCWCUZNS.cjs +72 -0
- package/dist/chunk-NG77ATEW.cjs +778 -0
- package/dist/chunk-NW5G5FBQ.js +215 -0
- package/dist/chunk-OBIYPYYS.cjs +1993 -0
- package/dist/chunk-OH2FAIVU.js +608 -0
- package/dist/chunk-OIQYIIO3.cjs +473 -0
- package/dist/chunk-OL46QLBJ.js +61 -0
- package/dist/chunk-OMXII44L.js +5386 -0
- package/dist/chunk-OSYNRVOV.cjs +243 -0
- package/dist/chunk-PGANYCAG.cjs +220 -0
- package/dist/chunk-PHENW4MQ.js +65 -0
- package/dist/chunk-PY37LNDP.js +686 -0
- package/dist/chunk-Q56TT7IL.js +483 -0
- package/dist/chunk-QD32ADK6.js +1046 -0
- package/dist/chunk-QPOQ7VPI.js +1491 -0
- package/dist/chunk-QPSKHBJP.js +5963 -0
- package/dist/chunk-QXH7QDSZ.js +1989 -0
- package/dist/chunk-R24NNAEG.js +1399 -0
- package/dist/chunk-R75BSDH7.cjs +50 -0
- package/dist/chunk-RARB3MBR.js +207 -0
- package/dist/chunk-ROHLEP2W.cjs +847 -0
- package/dist/chunk-S3MDHNKB.cjs +490 -0
- package/dist/chunk-S6YWHCKV.cjs +410 -0
- package/dist/chunk-SIEXCILW.js +229 -0
- package/dist/chunk-SLU6UPJI.cjs +410 -0
- package/dist/chunk-SMIWS6DE.cjs +212 -0
- package/dist/chunk-T5J7ZKP3.cjs +4885 -0
- package/dist/chunk-TDCNJHWO.js +341 -0
- package/dist/chunk-TG7O4WBC.js +406 -0
- package/dist/chunk-THCK6ECW.js +2085 -0
- package/dist/chunk-TJHVSBP2.js +439 -0
- package/dist/chunk-TVHSPJ4N.cjs +606 -0
- package/dist/chunk-TWUXUCEW.cjs +781 -0
- package/dist/chunk-U44IKGG7.cjs +5390 -0
- package/dist/chunk-UFZZ7TSN.cjs +886 -0
- package/dist/chunk-UJXISJBN.js +487 -0
- package/dist/chunk-UOIGFQXC.cjs +9750 -0
- package/dist/chunk-URG2SJLK.js +2521 -0
- package/dist/chunk-UWJHCOH2.js +623 -0
- package/dist/chunk-V6MKC2FZ.js +979 -0
- package/dist/chunk-VJ3L7CHT.cjs +169 -0
- package/dist/chunk-VMLKSV26.js +1216 -0
- package/dist/chunk-VVKVQZI6.js +55 -0
- package/dist/chunk-W6RW64BB.cjs +1219 -0
- package/dist/chunk-WKX5AMOY.js +309 -0
- package/dist/chunk-WNNE3PO3.js +34 -0
- package/dist/chunk-WRKUDAZJ.js +3038 -0
- package/dist/chunk-WRLUBRKS.cjs +1943 -0
- package/dist/chunk-WRNEH5MO.js +3169 -0
- package/dist/chunk-WRWEX5ZF.js +658 -0
- package/dist/chunk-X3GJPRVK.cjs +3246 -0
- package/dist/chunk-X3UVCWNL.cjs +2257 -0
- package/dist/chunk-XB274MW5.cjs +814 -0
- package/dist/chunk-XHIV6326.cjs +793 -0
- package/dist/chunk-XIVIE43A.cjs +729 -0
- package/dist/chunk-XJAN7CZG.cjs +432 -0
- package/dist/chunk-XKTPFXGA.js +164 -0
- package/dist/chunk-XL6INWKT.js +121 -0
- package/dist/chunk-XSFNHP2E.js +632 -0
- package/dist/chunk-XT6JY5W5.js +9684 -0
- package/dist/chunk-XUILI4KB.cjs +430 -0
- package/dist/chunk-YF2I3MV3.js +46 -0
- package/dist/chunk-YIMN575O.js +4847 -0
- package/dist/chunk-YIVFJNYV.js +176 -0
- package/dist/chunk-YKGPCZEE.cjs +237 -0
- package/dist/chunk-YN2YWTXW.js +5731 -0
- package/dist/chunk-YN6V7R3L.cjs +327 -0
- package/dist/chunk-YQELFNJV.js +39 -0
- package/dist/chunk-YVD3CSO3.js +1183 -0
- package/dist/chunk-YVOAF4ML.js +623 -0
- package/dist/chunk-YWOBW2PV.cjs +759 -0
- package/dist/chunk-YYXH45E2.js +426 -0
- package/dist/chunk-ZDSYWBIE.cjs +69 -0
- package/dist/chunk-ZU7NIRT6.js +325 -0
- package/dist/chunk-ZZ7RO2UQ.js +1243 -0
- package/dist/cli/holoscript-runner.cjs +2255 -0
- package/dist/cli/holoscript-runner.js +2230 -0
- package/dist/codebase/index.cjs +336 -0
- package/dist/codebase/index.js +331 -0
- package/dist/compiler/agent-inference.cjs +31 -0
- package/dist/compiler/agent-inference.js +8 -0
- package/dist/compiler/android-xr.cjs +24 -0
- package/dist/compiler/android-xr.js +14 -0
- package/dist/compiler/android.cjs +24 -0
- package/dist/compiler/android.js +14 -0
- package/dist/compiler/ar.cjs +23 -0
- package/dist/compiler/ar.js +11 -0
- package/dist/compiler/babylon.cjs +21 -0
- package/dist/compiler/babylon.js +15 -0
- package/dist/compiler/business-quest.cjs +43 -0
- package/dist/compiler/business-quest.js +4 -0
- package/dist/compiler/coco.cjs +27 -0
- package/dist/compiler/coco.js +4 -0
- package/dist/compiler/context.cjs +25 -0
- package/dist/compiler/context.d.ts +28 -0
- package/dist/compiler/context.js +8 -0
- package/dist/compiler/domain-block-utils.cjs +609 -0
- package/dist/compiler/domain-block-utils.js +11 -0
- package/dist/compiler/dtdl.cjs +27 -0
- package/dist/compiler/dtdl.js +11 -0
- package/dist/compiler/gltf-pipeline.cjs +39 -0
- package/dist/compiler/gltf-pipeline.js +4 -0
- package/dist/compiler/godot.cjs +18 -0
- package/dist/compiler/godot.js +12 -0
- package/dist/compiler/incremental.cjs +34 -0
- package/dist/compiler/incremental.js +9 -0
- package/dist/compiler/index.cjs +5408 -0
- package/dist/compiler/index.d.ts +334 -21
- package/dist/compiler/index.js +5069 -0
- package/dist/compiler/ios.cjs +23 -0
- package/dist/compiler/ios.js +13 -0
- package/dist/compiler/llm-provider-capabilities.cjs +25 -0
- package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
- package/dist/compiler/llm-provider-capabilities.js +8 -0
- package/dist/compiler/multi-layer.cjs +24 -0
- package/dist/compiler/multi-layer.js +15 -0
- package/dist/compiler/nodetoy.cjs +23 -0
- package/dist/compiler/nodetoy.d.ts +69 -0
- package/dist/compiler/nodetoy.js +4 -0
- package/dist/compiler/openxr.cjs +19 -0
- package/dist/compiler/openxr.js +13 -0
- package/dist/compiler/playcanvas.cjs +19 -0
- package/dist/compiler/playcanvas.js +13 -0
- package/dist/compiler/r3f.cjs +39 -0
- package/dist/compiler/r3f.d.ts +22 -0
- package/dist/compiler/r3f.js +17 -0
- package/dist/compiler/remotion.cjs +23 -0
- package/dist/compiler/remotion.js +4 -0
- package/dist/compiler/reproducibility.cjs +39 -0
- package/dist/compiler/reproducibility.js +4 -0
- package/dist/compiler/sdf.cjs +24 -0
- package/dist/compiler/sdf.js +12 -0
- package/dist/compiler/semantic-scene.cjs +31 -0
- package/dist/compiler/semantic-scene.js +4 -0
- package/dist/compiler/state.cjs +21 -0
- package/dist/compiler/state.js +11 -0
- package/dist/compiler/trait-composition.cjs +30 -0
- package/dist/compiler/trait-composition.js +9 -0
- package/dist/compiler/unity.cjs +19 -0
- package/dist/compiler/unity.js +13 -0
- package/dist/compiler/unreal.cjs +23 -0
- package/dist/compiler/unreal.js +13 -0
- package/dist/compiler/urdf.cjs +52 -0
- package/dist/compiler/urdf.js +12 -0
- package/dist/compiler/usd-physics.cjs +26 -0
- package/dist/compiler/usd-physics.js +9 -0
- package/dist/compiler/visionos.cjs +19 -0
- package/dist/compiler/visionos.js +13 -0
- package/dist/compiler/vrchat.cjs +22 -0
- package/dist/compiler/vrchat.js +12 -0
- package/dist/compiler/vrr.cjs +24 -0
- package/dist/compiler/vrr.js +12 -0
- package/dist/compiler/wasm.cjs +36 -0
- package/dist/compiler/wasm.js +12 -0
- package/dist/compiler/webgpu.cjs +18 -0
- package/dist/compiler/webgpu.js +12 -0
- package/dist/coordinators/index.cjs +1266 -0
- package/dist/coordinators/index.d.ts +72 -1
- package/dist/coordinators/index.js +1259 -0
- package/dist/debugger.cjs +24 -0
- package/dist/debugger.js +11 -0
- package/dist/dist-ACXG6IH5.cjs +3113 -0
- package/dist/dist-VD4L6V7Q.js +3076 -0
- package/dist/entries/interop.cjs +64 -0
- package/dist/entries/interop.js +7 -0
- package/dist/entries/scripting.cjs +55 -0
- package/dist/entries/scripting.js +10 -0
- package/dist/hololand/index.cjs +146 -0
- package/dist/hololand/index.d.ts +70 -0
- package/dist/hololand/index.js +5 -0
- package/dist/index.cjs +44660 -0
- package/dist/index.d.ts +978 -21
- package/dist/index.js +41422 -0
- package/dist/math/tropical-spmv.cjs +45 -0
- package/dist/math/tropical-spmv.js +4 -0
- package/dist/math/vec3.cjs +57 -0
- package/dist/math/vec3.js +4 -0
- package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
- package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
- package/dist/paper-0c-spike/index.cjs +150 -0
- package/dist/paper-0c-spike/index.js +141 -0
- package/dist/parser.cjs +61 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.js +12 -0
- package/dist/playwright-3AT3AKTV.cjs +98673 -0
- package/dist/playwright-VZPDVUEQ.js +98660 -0
- package/dist/reconstruction/index.cjs +153 -0
- package/dist/reconstruction/index.d.ts +29 -2
- package/dist/reconstruction/index.js +8 -0
- package/dist/runtime.cjs +316 -0
- package/dist/runtime.d.ts +61 -0
- package/dist/runtime.js +31 -0
- package/dist/self-improvement/index.cjs +563 -0
- package/dist/self-improvement/index.js +545 -0
- package/dist/src-4ROC227P.cjs +2094 -0
- package/dist/src-HCCCSYP7.js +2073 -0
- package/dist/storage/index.cjs +38 -0
- package/dist/storage/index.js +5 -0
- package/dist/testing.cjs +25 -0
- package/dist/testing.d.ts +70 -0
- package/dist/testing.js +4 -0
- package/dist/traitDocs/traitDocs.cjs +33 -0
- package/dist/traitDocs/traitDocs.js +7 -0
- package/dist/traits/botanical-lotus.cjs +177 -0
- package/dist/traits/botanical-lotus.d.ts +502 -0
- package/dist/traits/botanical-lotus.js +7 -0
- package/dist/traits/engines/index.cjs +520 -0
- package/dist/traits/engines/index.js +380 -0
- package/dist/traits/index.cjs +24548 -0
- package/dist/traits/index.d.ts +171 -35
- package/dist/traits/index.js +21638 -0
- package/dist/traits/simulation-solver-factory.cjs +13 -0
- package/dist/traits/simulation-solver-factory.d.ts +23 -0
- package/dist/traits/simulation-solver-factory.js +4 -0
- package/dist/traits/webcam-gaze.cjs +35 -0
- package/dist/traits/webcam-gaze.d.ts +17 -0
- package/dist/traits/webcam-gaze.js +4 -0
- package/dist/type-checker.cjs +19 -0
- package/dist/type-checker.js +6 -0
- package/dist/world/index.cjs +947 -0
- package/dist/world/index.d.ts +147 -0
- package/dist/world/index.js +939 -0
- package/dist/world-model/index.cjs +1446 -0
- package/dist/world-model/index.d.ts +119 -0
- package/dist/world-model/index.js +1414 -0
- package/dist/wot/index.cjs +29 -0
- package/dist/wot/index.js +4 -0
- package/package.json +93 -49
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkHKEXJUWS_cjs = require('./chunk-HKEXJUWS.cjs');
|
|
4
|
+
var chunkKKP7JKN4_cjs = require('./chunk-KKP7JKN4.cjs');
|
|
5
|
+
var chunkHCCQLAA4_cjs = require('./chunk-HCCQLAA4.cjs');
|
|
6
|
+
var ans = require('@holoscript/core-types/ans');
|
|
7
|
+
|
|
8
|
+
// src/compiler/VRChatCompiler.ts
|
|
9
|
+
var VRChatCompiler_exports = {};
|
|
10
|
+
chunkHCCQLAA4_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 = chunkHCCQLAA4_cjs.__esm({
|
|
20
|
+
"src/compiler/VRChatCompiler.ts"() {
|
|
21
|
+
chunkKKP7JKN4_cjs.init_CompilerBase();
|
|
22
|
+
chunkHKEXJUWS_cjs.init_DomainBlockCompilerMixin();
|
|
23
|
+
exports.VRChatCompiler = class extends chunkKKP7JKN4_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.worldIdCounter = 0;
|
|
32
|
+
const outputFormat = options.outputFormat ?? (options.useUdonSharp === false ? "udon-assembly" : "udonsharp-csharp");
|
|
33
|
+
this.options = {
|
|
34
|
+
namespace: options.namespace || "HoloWorld",
|
|
35
|
+
className: options.className || "GeneratedWorld",
|
|
36
|
+
worldName: options.worldName || "HoloScript World",
|
|
37
|
+
indent: options.indent || " ",
|
|
38
|
+
sdkVersion: options.sdkVersion || "3.5",
|
|
39
|
+
outputFormat,
|
|
40
|
+
useUdonSharp: options.useUdonSharp ?? outputFormat === "udonsharp-csharp",
|
|
41
|
+
provenanceHash: options.provenanceHash ?? ""
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
getRequiredCapability() {
|
|
45
|
+
return ans.ANSCapabilityPath.VRCHAT;
|
|
46
|
+
}
|
|
47
|
+
compile(composition, agentToken, outputPath) {
|
|
48
|
+
this.validateCompilerAccess(agentToken, outputPath);
|
|
49
|
+
this.assertSupportedOutputFormat();
|
|
50
|
+
this.lines = [];
|
|
51
|
+
this.udonScripts.clear();
|
|
52
|
+
this.interactableObjects = [];
|
|
53
|
+
this.indentLevel = 0;
|
|
54
|
+
const mainScript = this.generateMainScript(composition);
|
|
55
|
+
this.generateUdonScripts(composition);
|
|
56
|
+
const prefabHierarchy = this.generatePrefabHierarchy(composition);
|
|
57
|
+
const worldDescriptor = this.generateWorldDescriptor(composition);
|
|
58
|
+
return {
|
|
59
|
+
outputFormat: this.options.outputFormat,
|
|
60
|
+
mainScript,
|
|
61
|
+
udonScripts: this.udonScripts,
|
|
62
|
+
prefabHierarchy,
|
|
63
|
+
worldDescriptor
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
assertSupportedOutputFormat() {
|
|
67
|
+
if (this.options.outputFormat === "udonsharp-csharp" && this.options.useUdonSharp) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const requested = this.options.outputFormat === "udonsharp-csharp" ? "non-UdonSharp Udon output" : this.options.outputFormat;
|
|
71
|
+
throw new Error(
|
|
72
|
+
`VRChat ${requested} output is gated: founder direction is Byte/Udon output, but the artifact contract must be confirmed before implementation (Udon Assembly text vs serialized Udon bytecode asset). The current compiler only emits legacy UdonSharp C# with outputFormat: 'udonsharp-csharp' and useUdonSharp: true.`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
generateMainScript(composition) {
|
|
76
|
+
this.lines = [];
|
|
77
|
+
this.indentLevel = 0;
|
|
78
|
+
this.emit("// Auto-generated by HoloScript VRChatCompiler");
|
|
79
|
+
this.emit(
|
|
80
|
+
`// Source: composition "${this.escapeStringValue(composition.name, "CSharp")}"`
|
|
81
|
+
);
|
|
82
|
+
this.emit(`// VRChat SDK: ${this.options.sdkVersion}`);
|
|
83
|
+
this.emit("// Do not edit manually \xE2\u20AC\u201D regenerate from .holo source");
|
|
84
|
+
if (this.options.provenanceHash) {
|
|
85
|
+
this.emit(`// Provenance Hash: ${this.options.provenanceHash}`);
|
|
86
|
+
}
|
|
87
|
+
this.emit("");
|
|
88
|
+
this.emit("using UdonSharp;");
|
|
89
|
+
this.emit("using UnityEngine;");
|
|
90
|
+
this.emit("using VRC.SDKBase;");
|
|
91
|
+
this.emit("using VRC.Udon;");
|
|
92
|
+
this.emit("using VRC.SDK3.Components;");
|
|
93
|
+
if (composition.audio?.length) {
|
|
94
|
+
this.emit("using VRC.SDK3.Components.Audio;");
|
|
95
|
+
}
|
|
96
|
+
this.emit("");
|
|
97
|
+
this.emit(`namespace ${this.options.namespace}`);
|
|
98
|
+
this.emit("{");
|
|
99
|
+
this.indentLevel++;
|
|
100
|
+
this.emit("[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]");
|
|
101
|
+
this.emit(`public class ${this.options.className} : UdonSharpBehaviour`);
|
|
102
|
+
this.emit("{");
|
|
103
|
+
this.indentLevel++;
|
|
104
|
+
if (composition.state) {
|
|
105
|
+
this.emit("// === Synced State ===");
|
|
106
|
+
for (const prop of composition.state.properties) {
|
|
107
|
+
const csType = this.toCSharpType(prop.value);
|
|
108
|
+
const csVal = this.toCSharpValue(prop.value);
|
|
109
|
+
this.emit(
|
|
110
|
+
`[UdonSynced] public ${csType} ${this.escapeStringValue(prop.key, "CSharp")} = ${csVal};`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
this.emit("");
|
|
114
|
+
}
|
|
115
|
+
this.emit("// === Object References ===");
|
|
116
|
+
this.emit('[Header("Scene Objects")]');
|
|
117
|
+
const objects = composition.objects || [];
|
|
118
|
+
for (const obj of objects) {
|
|
119
|
+
const varName = this.sanitizeName(obj.name);
|
|
120
|
+
this.emit(`public GameObject ${varName};`);
|
|
121
|
+
}
|
|
122
|
+
this.emit("");
|
|
123
|
+
this.emit("void Start()");
|
|
124
|
+
this.emit("{");
|
|
125
|
+
this.indentLevel++;
|
|
126
|
+
this.emit('Debug.Log("[HoloWorld] World initialized");');
|
|
127
|
+
if (composition.environment) {
|
|
128
|
+
this.compileEnvironment(composition.environment);
|
|
129
|
+
}
|
|
130
|
+
this.indentLevel--;
|
|
131
|
+
this.emit("}");
|
|
132
|
+
this.emit("");
|
|
133
|
+
this.emit("public override void OnDeserialization()");
|
|
134
|
+
this.emit("{");
|
|
135
|
+
this.indentLevel++;
|
|
136
|
+
this.emit("// Handle synced state updates");
|
|
137
|
+
this.emit("UpdateVisuals();");
|
|
138
|
+
this.indentLevel--;
|
|
139
|
+
this.emit("}");
|
|
140
|
+
this.emit("");
|
|
141
|
+
this.emit("private void UpdateVisuals()");
|
|
142
|
+
this.emit("{");
|
|
143
|
+
this.indentLevel++;
|
|
144
|
+
this.emit("// Update visuals based on synced state");
|
|
145
|
+
this.indentLevel--;
|
|
146
|
+
this.emit("}");
|
|
147
|
+
this.emit("");
|
|
148
|
+
this.emit("public override void OnPlayerJoined(VRCPlayerApi player)");
|
|
149
|
+
this.emit("{");
|
|
150
|
+
this.indentLevel++;
|
|
151
|
+
this.emit("if (player.isLocal)");
|
|
152
|
+
this.emit("{");
|
|
153
|
+
this.indentLevel++;
|
|
154
|
+
this.emit('Debug.Log($"[HoloWorld] Welcome, {player.displayName}!");');
|
|
155
|
+
this.indentLevel--;
|
|
156
|
+
this.emit("}");
|
|
157
|
+
this.indentLevel--;
|
|
158
|
+
this.emit("}");
|
|
159
|
+
this.emit("");
|
|
160
|
+
if (composition.zones) {
|
|
161
|
+
for (const zone of composition.zones) {
|
|
162
|
+
this.compileZoneTriggers(zone);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (composition.timelines) {
|
|
166
|
+
for (const tl of composition.timelines) {
|
|
167
|
+
this.compileTimeline(tl);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (composition.transitions) {
|
|
171
|
+
for (const tr of composition.transitions) {
|
|
172
|
+
this.compileTransition(tr);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
this.compileVRChatDomainBlocks(composition);
|
|
176
|
+
this.indentLevel--;
|
|
177
|
+
this.emit("}");
|
|
178
|
+
this.indentLevel--;
|
|
179
|
+
this.emit("}");
|
|
180
|
+
return this.lines.join("\n");
|
|
181
|
+
}
|
|
182
|
+
compileVRChatDomainBlocks(composition) {
|
|
183
|
+
const domainBlocks = composition.domainBlocks ?? [];
|
|
184
|
+
if (domainBlocks.length === 0) return;
|
|
185
|
+
this.emit("");
|
|
186
|
+
this.emit("// === v4.2 Domain Blocks (VRChat/Unity) ===");
|
|
187
|
+
let blockIdx = 0;
|
|
188
|
+
const compiled = chunkHKEXJUWS_cjs.compileDomainBlocks(
|
|
189
|
+
domainBlocks,
|
|
190
|
+
{
|
|
191
|
+
material: (block) => {
|
|
192
|
+
const mat = chunkHKEXJUWS_cjs.compileMaterialBlock(block);
|
|
193
|
+
return chunkHKEXJUWS_cjs.materialToVRChat(mat, `db${blockIdx++}`);
|
|
194
|
+
},
|
|
195
|
+
physics: (block) => {
|
|
196
|
+
const phys = chunkHKEXJUWS_cjs.compilePhysicsBlock(block);
|
|
197
|
+
return chunkHKEXJUWS_cjs.physicsToUnity(phys, `db${blockIdx++}`);
|
|
198
|
+
},
|
|
199
|
+
vfx: (block) => {
|
|
200
|
+
const ps = chunkHKEXJUWS_cjs.compileParticleBlock(block);
|
|
201
|
+
return chunkHKEXJUWS_cjs.particlesToUnity(ps, `db${blockIdx++}`);
|
|
202
|
+
},
|
|
203
|
+
postfx: (block) => {
|
|
204
|
+
const pp = chunkHKEXJUWS_cjs.compilePostProcessingBlock(block);
|
|
205
|
+
return chunkHKEXJUWS_cjs.postProcessingToUnity(pp);
|
|
206
|
+
},
|
|
207
|
+
audio: (block) => {
|
|
208
|
+
const audio = chunkHKEXJUWS_cjs.compileAudioSourceBlock(block);
|
|
209
|
+
return chunkHKEXJUWS_cjs.audioSourceToUnity(audio, `db${blockIdx++}`);
|
|
210
|
+
},
|
|
211
|
+
weather: (block) => {
|
|
212
|
+
const weather = chunkHKEXJUWS_cjs.compileWeatherBlock(block);
|
|
213
|
+
return chunkHKEXJUWS_cjs.weatherToUnity(weather);
|
|
214
|
+
},
|
|
215
|
+
narrative: (block) => {
|
|
216
|
+
const narr = chunkHKEXJUWS_cjs.compileNarrativeBlock(block);
|
|
217
|
+
return chunkHKEXJUWS_cjs.narrativeToVRChat(narr);
|
|
218
|
+
},
|
|
219
|
+
payment: (block) => {
|
|
220
|
+
const pay = chunkHKEXJUWS_cjs.compilePaymentBlock(block);
|
|
221
|
+
return chunkHKEXJUWS_cjs.paymentToVRChat(pay);
|
|
222
|
+
},
|
|
223
|
+
healthcare: (block) => {
|
|
224
|
+
const h = chunkHKEXJUWS_cjs.compileHealthcareBlock(block);
|
|
225
|
+
return chunkHKEXJUWS_cjs.healthcareToVRChat(h);
|
|
226
|
+
},
|
|
227
|
+
robotics: (block) => {
|
|
228
|
+
const r = chunkHKEXJUWS_cjs.compileRoboticsBlock(block);
|
|
229
|
+
return chunkHKEXJUWS_cjs.roboticsToVRChat(r);
|
|
230
|
+
},
|
|
231
|
+
iot: (block) => chunkHKEXJUWS_cjs.iotToVRChat(chunkHKEXJUWS_cjs.compileIoTBlock(block)),
|
|
232
|
+
dataviz: (block) => chunkHKEXJUWS_cjs.datavizToVRChat(chunkHKEXJUWS_cjs.compileDataVizBlock(block)),
|
|
233
|
+
education: (block) => chunkHKEXJUWS_cjs.educationToVRChat(chunkHKEXJUWS_cjs.compileEducationBlock(block)),
|
|
234
|
+
music: (block) => chunkHKEXJUWS_cjs.musicToVRChat(chunkHKEXJUWS_cjs.compileMusicBlock(block)),
|
|
235
|
+
architecture: (block) => chunkHKEXJUWS_cjs.architectureToVRChat(chunkHKEXJUWS_cjs.compileArchitectureBlock(block)),
|
|
236
|
+
web3: (block) => chunkHKEXJUWS_cjs.web3ToVRChat(chunkHKEXJUWS_cjs.compileWeb3Block(block)),
|
|
237
|
+
procedural: (block) => chunkHKEXJUWS_cjs.proceduralToVRChat(chunkHKEXJUWS_cjs.compileProceduralBlock(block)),
|
|
238
|
+
rendering: (block) => chunkHKEXJUWS_cjs.renderingToVRChat(chunkHKEXJUWS_cjs.compileRenderingBlock(block)),
|
|
239
|
+
navigation: (block) => chunkHKEXJUWS_cjs.navigationToVRChat(chunkHKEXJUWS_cjs.compileNavigationBlock(block)),
|
|
240
|
+
input: (block) => chunkHKEXJUWS_cjs.inputToVRChat(chunkHKEXJUWS_cjs.compileInputBlock(block))
|
|
241
|
+
},
|
|
242
|
+
(block) => `// Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "CSharp")}"`
|
|
243
|
+
);
|
|
244
|
+
for (const line of compiled) {
|
|
245
|
+
for (const l of line.split("\n")) {
|
|
246
|
+
this.emit(l);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
generateUdonScripts(composition) {
|
|
251
|
+
const objects = composition.objects || [];
|
|
252
|
+
for (const obj of objects) {
|
|
253
|
+
if (!obj.traits) continue;
|
|
254
|
+
const hasGrabbable = obj.traits.some((t) => t.name === "grabbable");
|
|
255
|
+
const hasPointable = obj.traits.some((t) => t.name === "pointable" || t.name === "clickable");
|
|
256
|
+
const hasNetworked = obj.traits.some((t) => t.name === "networked" || t.name === "synced");
|
|
257
|
+
const hasPortal = obj.traits.some((t) => t.name === "portal");
|
|
258
|
+
const hasMirror = obj.traits.some((t) => t.name === "mirror");
|
|
259
|
+
if (hasGrabbable || hasPointable || hasNetworked || hasPortal || hasMirror) {
|
|
260
|
+
const script = this.generateObjectUdonScript(obj, {
|
|
261
|
+
hasGrabbable,
|
|
262
|
+
hasPointable,
|
|
263
|
+
hasNetworked,
|
|
264
|
+
hasPortal,
|
|
265
|
+
hasMirror
|
|
266
|
+
});
|
|
267
|
+
this.udonScripts.set(`${this.sanitizeName(obj.name)}Behaviour.cs`, script);
|
|
268
|
+
this.interactableObjects.push(obj.name);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
generateObjectUdonScript(obj, traits) {
|
|
273
|
+
const lines = [];
|
|
274
|
+
const varName = this.sanitizeName(obj.name);
|
|
275
|
+
const className = `${varName}Behaviour`;
|
|
276
|
+
lines.push("// Auto-generated UdonSharp script");
|
|
277
|
+
lines.push(`// Object: ${this.escapeStringValue(obj.name, "CSharp")}`);
|
|
278
|
+
lines.push("");
|
|
279
|
+
lines.push("using UdonSharp;");
|
|
280
|
+
lines.push("using UnityEngine;");
|
|
281
|
+
lines.push("using VRC.SDKBase;");
|
|
282
|
+
lines.push("using VRC.Udon;");
|
|
283
|
+
lines.push("");
|
|
284
|
+
const syncMode = traits.hasNetworked ? "BehaviourSyncMode.Manual" : "BehaviourSyncMode.None";
|
|
285
|
+
lines.push(`[UdonBehaviourSyncMode(${syncMode})]`);
|
|
286
|
+
lines.push(`public class ${className} : UdonSharpBehaviour`);
|
|
287
|
+
lines.push("{");
|
|
288
|
+
if (obj.state?.properties) {
|
|
289
|
+
lines.push(" // === State ===");
|
|
290
|
+
for (const prop of obj.state.properties) {
|
|
291
|
+
const csType = this.toCSharpType(prop.value);
|
|
292
|
+
const csVal = this.toCSharpValue(prop.value);
|
|
293
|
+
const syncAttr = traits.hasNetworked ? "[UdonSynced] " : "";
|
|
294
|
+
lines.push(
|
|
295
|
+
` ${syncAttr}public ${csType} ${this.escapeStringValue(prop.key, "CSharp")} = ${csVal};`
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
lines.push("");
|
|
299
|
+
}
|
|
300
|
+
if (traits.hasGrabbable) {
|
|
301
|
+
lines.push(" // VRC_Pickup compatible");
|
|
302
|
+
lines.push(" public VRC_Pickup pickup;");
|
|
303
|
+
lines.push("");
|
|
304
|
+
lines.push(" public override void OnPickup()");
|
|
305
|
+
lines.push(" {");
|
|
306
|
+
lines.push(' Debug.Log($"[{gameObject.name}] Picked up");');
|
|
307
|
+
if (traits.hasNetworked) {
|
|
308
|
+
lines.push(" Networking.SetOwner(Networking.LocalPlayer, gameObject);");
|
|
309
|
+
lines.push(" RequestSerialization();");
|
|
310
|
+
}
|
|
311
|
+
lines.push(" }");
|
|
312
|
+
lines.push("");
|
|
313
|
+
lines.push(" public override void OnDrop()");
|
|
314
|
+
lines.push(" {");
|
|
315
|
+
lines.push(' Debug.Log($"[{gameObject.name}] Dropped");');
|
|
316
|
+
if (traits.hasNetworked) {
|
|
317
|
+
lines.push(" RequestSerialization();");
|
|
318
|
+
}
|
|
319
|
+
lines.push(" }");
|
|
320
|
+
lines.push("");
|
|
321
|
+
}
|
|
322
|
+
if (traits.hasPointable) {
|
|
323
|
+
lines.push(" public override void Interact()");
|
|
324
|
+
lines.push(" {");
|
|
325
|
+
lines.push(' Debug.Log($"[{gameObject.name}] Interacted");');
|
|
326
|
+
lines.push(" OnInteractHandler();");
|
|
327
|
+
lines.push(" }");
|
|
328
|
+
lines.push("");
|
|
329
|
+
lines.push(" private void OnInteractHandler()");
|
|
330
|
+
lines.push(" {");
|
|
331
|
+
lines.push(" // Custom interaction logic based on traits");
|
|
332
|
+
lines.push(" }");
|
|
333
|
+
lines.push("");
|
|
334
|
+
}
|
|
335
|
+
if (traits.hasPortal) {
|
|
336
|
+
const portalTrait = obj.traits?.find((t) => t.name === "portal");
|
|
337
|
+
const destination = portalTrait?.config?.destination || "wrld_unknown";
|
|
338
|
+
lines.push(' [Header("Portal Settings")]');
|
|
339
|
+
lines.push(` public string destinationWorld = "${destination}";`);
|
|
340
|
+
lines.push("");
|
|
341
|
+
lines.push(" public override void Interact()");
|
|
342
|
+
lines.push(" {");
|
|
343
|
+
lines.push(" // VRChat portal \xE2\u20AC\u201D player will be teleported");
|
|
344
|
+
lines.push(' Debug.Log($"Portal to {destinationWorld}");');
|
|
345
|
+
lines.push(" }");
|
|
346
|
+
lines.push("");
|
|
347
|
+
}
|
|
348
|
+
if (traits.hasNetworked) {
|
|
349
|
+
lines.push(" public override void OnDeserialization()");
|
|
350
|
+
lines.push(" {");
|
|
351
|
+
lines.push(" // Handle network sync");
|
|
352
|
+
lines.push(" UpdateFromNetwork();");
|
|
353
|
+
lines.push(" }");
|
|
354
|
+
lines.push("");
|
|
355
|
+
lines.push(" private void UpdateFromNetwork()");
|
|
356
|
+
lines.push(" {");
|
|
357
|
+
lines.push(" // Apply synced state to visuals");
|
|
358
|
+
lines.push(" }");
|
|
359
|
+
lines.push("");
|
|
360
|
+
}
|
|
361
|
+
lines.push("}");
|
|
362
|
+
return lines.join("\n");
|
|
363
|
+
}
|
|
364
|
+
generatePrefabHierarchy(composition) {
|
|
365
|
+
const lines = [];
|
|
366
|
+
lines.push(
|
|
367
|
+
`# VRChat World Prefab Hierarchy: ${this.escapeStringValue(composition.name, "CSharp")}`
|
|
368
|
+
);
|
|
369
|
+
lines.push("# Generated by HoloScript VRChatCompiler");
|
|
370
|
+
lines.push("");
|
|
371
|
+
lines.push("World Root");
|
|
372
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Environment");
|
|
373
|
+
if (composition.lights) {
|
|
374
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Lighting");
|
|
375
|
+
for (const light of composition.lights) {
|
|
376
|
+
lines.push(
|
|
377
|
+
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(light.name, "CSharp")} (${light.lightType})`
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (composition.objects) {
|
|
382
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Objects");
|
|
383
|
+
for (const obj of composition.objects) {
|
|
384
|
+
const traits = obj.traits?.map((t) => `@${this.escapeStringValue(t.name, "CSharp")}`).join(" ") || "";
|
|
385
|
+
lines.push(
|
|
386
|
+
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(obj.name, "CSharp")} ${traits}`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (composition.spatialGroups) {
|
|
391
|
+
for (const group of composition.spatialGroups) {
|
|
392
|
+
lines.push(
|
|
393
|
+
`\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(group.name, "CSharp")} (SpatialGroup)`
|
|
394
|
+
);
|
|
395
|
+
for (const child of group.objects || []) {
|
|
396
|
+
lines.push(`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(child.name, "CSharp")}`);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (composition.audio) {
|
|
401
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Audio");
|
|
402
|
+
for (const audio of composition.audio) {
|
|
403
|
+
lines.push(
|
|
404
|
+
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(audio.name, "CSharp")} (VRCSpatialAudioSource)`
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (composition.zones) {
|
|
409
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Zones");
|
|
410
|
+
for (const zone of composition.zones) {
|
|
411
|
+
lines.push(
|
|
412
|
+
`\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC ${this.escapeStringValue(zone.name, "CSharp")} (Trigger)`
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC VRCWorld (VRC_World)");
|
|
417
|
+
lines.push("\xE2\u201D\u0153\xE2\u201D\u20AC\xE2\u201D\u20AC Spawn Points");
|
|
418
|
+
lines.push("\xE2\u201D\u201A \xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC SpawnPoint_0");
|
|
419
|
+
lines.push("\xE2\u201D\u201D\xE2\u201D\u20AC\xE2\u201D\u20AC Player Mods");
|
|
420
|
+
return lines.join("\n");
|
|
421
|
+
}
|
|
422
|
+
generateWorldDescriptor(composition) {
|
|
423
|
+
const lines = [];
|
|
424
|
+
lines.push("// VRC_World Descriptor Settings");
|
|
425
|
+
lines.push(`// World: ${this.options.worldName}`);
|
|
426
|
+
lines.push("");
|
|
427
|
+
lines.push("VRC_SceneDescriptor:");
|
|
428
|
+
lines.push(` worldName: "${this.options.worldName}"`);
|
|
429
|
+
lines.push(` worldId: "wrld_${this.generateWorldId()}"`);
|
|
430
|
+
lines.push(" capacity: 32");
|
|
431
|
+
lines.push(" recommendedCapacity: 16");
|
|
432
|
+
lines.push(" respawnHeightY: -100");
|
|
433
|
+
lines.push(" objectBehaviourAtRespawnHeight: Destroy");
|
|
434
|
+
lines.push(" forbidUserPortals: false");
|
|
435
|
+
lines.push(' unityVersion: "2022.3.22f1"');
|
|
436
|
+
lines.push(` sdkVersion: "${this.options.sdkVersion}"`);
|
|
437
|
+
lines.push("");
|
|
438
|
+
lines.push("SpawnPoints:");
|
|
439
|
+
lines.push(" - position: [0, 0, 0]");
|
|
440
|
+
lines.push(" rotation: [0, 0, 0]");
|
|
441
|
+
lines.push("");
|
|
442
|
+
if (composition.camera) {
|
|
443
|
+
lines.push("ReferenceCamera:");
|
|
444
|
+
lines.push(" near: 0.01");
|
|
445
|
+
lines.push(" far: 1000");
|
|
446
|
+
}
|
|
447
|
+
return lines.join("\n");
|
|
448
|
+
}
|
|
449
|
+
compileEnvironment(env) {
|
|
450
|
+
this.emit("// === Environment Setup ===");
|
|
451
|
+
for (const prop of env.properties) {
|
|
452
|
+
if (prop.key === "skybox" || prop.key === "preset") {
|
|
453
|
+
this.emit(`// Skybox: "${prop.value}" \xE2\u20AC\u201D set via VRChat scene settings`);
|
|
454
|
+
} else if (prop.key === "ambient_light") {
|
|
455
|
+
this.emit(`RenderSettings.ambientIntensity = ${prop.value}f;`);
|
|
456
|
+
} else if (prop.key === "fog" && typeof prop.value === "object") {
|
|
457
|
+
const fog = prop.value;
|
|
458
|
+
this.emit("RenderSettings.fog = true;");
|
|
459
|
+
if (fog.color) this.emit(`RenderSettings.fogColor = ${this.toColor(fog.color)};`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
compileZoneTriggers(zone) {
|
|
464
|
+
const varName = this.sanitizeName(zone.name);
|
|
465
|
+
this.emit(`// Zone: ${this.escapeStringValue(zone.name, "CSharp")}`);
|
|
466
|
+
this.emit(`public void On${varName}Enter(VRCPlayerApi player)`);
|
|
467
|
+
this.emit("{");
|
|
468
|
+
this.indentLevel++;
|
|
469
|
+
this.emit(
|
|
470
|
+
`Debug.Log($"Player {player.displayName} entered ${this.escapeStringValue(zone.name, "CSharp")}");`
|
|
471
|
+
);
|
|
472
|
+
this.indentLevel--;
|
|
473
|
+
this.emit("}");
|
|
474
|
+
this.emit("");
|
|
475
|
+
this.emit(`public void On${varName}Exit(VRCPlayerApi player)`);
|
|
476
|
+
this.emit("{");
|
|
477
|
+
this.indentLevel++;
|
|
478
|
+
this.emit(
|
|
479
|
+
`Debug.Log($"Player {player.displayName} exited ${this.escapeStringValue(zone.name, "CSharp")}");`
|
|
480
|
+
);
|
|
481
|
+
this.indentLevel--;
|
|
482
|
+
this.emit("}");
|
|
483
|
+
this.emit("");
|
|
484
|
+
}
|
|
485
|
+
compileTimeline(timeline) {
|
|
486
|
+
const name = this.sanitizeName(timeline.name);
|
|
487
|
+
this.emit(`// Timeline: ${this.escapeStringValue(timeline.name, "CSharp")}`);
|
|
488
|
+
this.emit(`public void Play${name}()`);
|
|
489
|
+
this.emit("{");
|
|
490
|
+
this.indentLevel++;
|
|
491
|
+
this.emit(`SendCustomEventDelayedSeconds("${name}Step0", 0f);`);
|
|
492
|
+
this.indentLevel--;
|
|
493
|
+
this.emit("}");
|
|
494
|
+
this.emit("");
|
|
495
|
+
for (let i = 0; i < timeline.entries.length; i++) {
|
|
496
|
+
const entry = timeline.entries[i];
|
|
497
|
+
const nextDelay = i < timeline.entries.length - 1 ? timeline.entries[i + 1].time - entry.time : 0;
|
|
498
|
+
this.emit(`public void ${name}Step${i}()`);
|
|
499
|
+
this.emit("{");
|
|
500
|
+
this.indentLevel++;
|
|
501
|
+
if (entry.action.kind === "animate") {
|
|
502
|
+
this.emit(`// Animate ${entry.action.target}`);
|
|
503
|
+
} else if (entry.action.kind === "emit") {
|
|
504
|
+
this.emit(`SendCustomEvent("${entry.action.event}");`);
|
|
505
|
+
} else if (entry.action.kind === "call") {
|
|
506
|
+
this.emit(`${entry.action.method}();`);
|
|
507
|
+
}
|
|
508
|
+
if (nextDelay > 0) {
|
|
509
|
+
this.emit(`SendCustomEventDelayedSeconds("${name}Step${i + 1}", ${nextDelay}f);`);
|
|
510
|
+
} else if (timeline.loop && i === timeline.entries.length - 1) {
|
|
511
|
+
this.emit(`SendCustomEventDelayedSeconds("${name}Step0", 0.1f);`);
|
|
512
|
+
}
|
|
513
|
+
this.indentLevel--;
|
|
514
|
+
this.emit("}");
|
|
515
|
+
this.emit("");
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
compileTransition(transition) {
|
|
519
|
+
const name = this.sanitizeName(transition.name);
|
|
520
|
+
this.emit(`// Transition: ${this.escapeStringValue(transition.name, "CSharp")}`);
|
|
521
|
+
this.emit(`public void ${name}Transition()`);
|
|
522
|
+
this.emit("{");
|
|
523
|
+
this.indentLevel++;
|
|
524
|
+
const dest = transition.properties.find((p) => p.key === "destination" || p.key === "to");
|
|
525
|
+
if (dest) {
|
|
526
|
+
this.emit(`// Transition to: ${dest.value}`);
|
|
527
|
+
}
|
|
528
|
+
this.indentLevel--;
|
|
529
|
+
this.emit("}");
|
|
530
|
+
this.emit("");
|
|
531
|
+
}
|
|
532
|
+
generateWorldId() {
|
|
533
|
+
const seq = this.worldIdCounter++;
|
|
534
|
+
const hex = seq.toString(16).padStart(8, "0");
|
|
535
|
+
return `${hex}-0000-0000-0000-000000000000`;
|
|
536
|
+
}
|
|
537
|
+
// === Utility Methods ===
|
|
538
|
+
emit(line) {
|
|
539
|
+
const indent = this.options.indent.repeat(this.indentLevel);
|
|
540
|
+
this.lines.push(indent + line);
|
|
541
|
+
}
|
|
542
|
+
sanitizeName(name) {
|
|
543
|
+
return name.replace(/[^a-zA-Z0-9_]/g, "_").replace(/^[0-9]/, "_$&");
|
|
544
|
+
}
|
|
545
|
+
toCSharpType(value) {
|
|
546
|
+
if (value === null) return "object";
|
|
547
|
+
if (typeof value === "boolean") return "bool";
|
|
548
|
+
if (typeof value === "number") return Number.isInteger(value) ? "int" : "float";
|
|
549
|
+
if (typeof value === "string") return "string";
|
|
550
|
+
if (Array.isArray(value)) {
|
|
551
|
+
if (value.length === 3 && value.every((v) => typeof v === "number")) return "Vector3";
|
|
552
|
+
if (value.length === 4 && value.every((v) => typeof v === "number")) return "Quaternion";
|
|
553
|
+
return "object[]";
|
|
554
|
+
}
|
|
555
|
+
return "object";
|
|
556
|
+
}
|
|
557
|
+
toCSharpValue(value) {
|
|
558
|
+
if (value === null) return "null";
|
|
559
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
560
|
+
if (typeof value === "number") return Number.isInteger(value) ? `${value}` : `${value}f`;
|
|
561
|
+
if (typeof value === "string") return `"${this.escapeStringValue(value, "CSharp")}"`;
|
|
562
|
+
if (Array.isArray(value)) {
|
|
563
|
+
if (value.length === 3 && value.every((v) => typeof v === "number")) {
|
|
564
|
+
return `new Vector3(${value[0]}f, ${value[1]}f, ${value[2]}f)`;
|
|
565
|
+
}
|
|
566
|
+
if (value.length === 4 && value.every((v) => typeof v === "number")) {
|
|
567
|
+
return `new Quaternion(${value[0]}f, ${value[1]}f, ${value[2]}f, ${value[3]}f)`;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return "null";
|
|
571
|
+
}
|
|
572
|
+
toColor(value) {
|
|
573
|
+
if (typeof value === "string") {
|
|
574
|
+
if (value.startsWith("#")) {
|
|
575
|
+
const hex = value.slice(1);
|
|
576
|
+
if (hex.length === 6) {
|
|
577
|
+
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
578
|
+
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
579
|
+
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
580
|
+
return `new Color(${r}f, ${g}f, ${b}f)`;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
const colors = {
|
|
584
|
+
red: "Color.red",
|
|
585
|
+
green: "Color.green",
|
|
586
|
+
blue: "Color.blue",
|
|
587
|
+
white: "Color.white",
|
|
588
|
+
black: "Color.black",
|
|
589
|
+
yellow: "Color.yellow",
|
|
590
|
+
cyan: "Color.cyan",
|
|
591
|
+
magenta: "Color.magenta"
|
|
592
|
+
};
|
|
593
|
+
return colors[value.toLowerCase()] || "Color.white";
|
|
594
|
+
}
|
|
595
|
+
if (Array.isArray(value) && value.length >= 3) {
|
|
596
|
+
const [r, g, b, a = 1] = value;
|
|
597
|
+
return `new Color(${r}f, ${g}f, ${b}f, ${a}f)`;
|
|
598
|
+
}
|
|
599
|
+
return "Color.white";
|
|
600
|
+
}
|
|
601
|
+
// Collect all trait names for import optimization
|
|
602
|
+
collectAllTraits(composition) {
|
|
603
|
+
const traits = [];
|
|
604
|
+
const addTraits = (obj) => {
|
|
605
|
+
if (obj.traits) {
|
|
606
|
+
for (const t of obj.traits) {
|
|
607
|
+
if (!traits.includes(t.name)) traits.push(t.name);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
for (const obj of composition.objects || []) addTraits(obj);
|
|
612
|
+
for (const group of composition.spatialGroups || []) {
|
|
613
|
+
for (const child of group.objects || []) {
|
|
614
|
+
addTraits(child);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return traits;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
exports.VRChatCompiler_exports = VRChatCompiler_exports;
|
|
624
|
+
exports.compileToVRChat = compileToVRChat;
|
|
625
|
+
exports.init_VRChatCompiler = init_VRChatCompiler;
|
|
626
|
+
//# sourceMappingURL=chunk-5H2G27PK.cjs.map
|
|
627
|
+
//# sourceMappingURL=chunk-5H2G27PK.cjs.map
|