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