@pinkaphant/kolmo 0.2.3 → 0.3.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/bin/kolmo.mjs +1 -1
- package/dist/engine/kolmoActor.js +125 -83
- package/dist/engine/kolmoLongDrive.js +136 -91
- package/dist/engine/kolmoStore.d.ts +6 -5
- package/dist/engine/kolmoStore.js +115 -79
- package/dist/engine/kolmoVehicle.d.ts +1 -1
- package/dist/engine/kolmoVehicle.js +160 -147
- package/dist/engine/kolmoVehicleDriver.d.ts +12 -4
- package/dist/engine/kolmoVehicleDriver.js +40 -20
- package/dist/engine/kolmoWorld.js +55 -35
- package/dist/importer/CabinPreviewRig.d.ts +13 -0
- package/dist/importer/CabinPreviewRig.js +138 -0
- package/dist/importer/CabinStepSection.d.ts +17 -0
- package/dist/importer/CabinStepSection.js +222 -0
- package/dist/importer/ChopShopPanel.d.ts +31 -1
- package/dist/importer/ChopShopPanel.js +474 -380
- package/dist/importer/GateHudBar.d.ts +3 -0
- package/dist/importer/GateHudBar.js +8 -2
- package/dist/importer/GlbImportGate.js +183 -147
- package/dist/importer/ImporterPlinthUikitTags.d.ts +2 -1
- package/dist/importer/ImporterPlinthUikitTags.js +23 -16
- package/dist/importer/Step1CalibrationPlinth.d.ts +10 -0
- package/dist/importer/Step1CalibrationPlinth.js +203 -141
- package/dist/importer/Step2UniversalPad.d.ts +8 -1
- package/dist/importer/Step2UniversalPad.js +112 -90
- package/dist/importer/cabinMeshBuilders.d.ts +13 -0
- package/dist/importer/cabinMeshBuilders.js +104 -0
- package/dist/importer/cabinMixamoRig.d.ts +53 -0
- package/dist/importer/cabinMixamoRig.js +150 -0
- package/dist/importer/chopShopActions.d.ts +6 -0
- package/dist/importer/chopShopActions.js +86 -61
- package/dist/importer/chopShopUiComponents.d.ts +22 -0
- package/dist/importer/chopShopUiComponents.js +91 -0
- package/dist/importer/gateStore.d.ts +5 -2
- package/dist/importer/gateStore.js +13 -10
- package/dist/importer/glbNormalizer.d.ts +10 -1
- package/dist/importer/glbNormalizer.js +114 -49
- package/dist/importer/importerWebMcp.js +4 -1
- package/dist/importer/index.d.ts +4 -2
- package/dist/importer/index.js +24 -21
- package/dist/importer/khrCompiler.d.ts +20 -1
- package/dist/importer/khrCompiler.js +539 -290
- package/dist/importer/launcherBake.js +12 -8
- package/dist/importer/meshIslands.d.ts +4 -0
- package/dist/importer/meshIslands.js +104 -99
- package/dist/importer/surfaceCutter.d.ts +12 -3
- package/dist/importer/surfaceCutter.js +220 -127
- package/dist/importer/surfaceTopology.d.ts +13 -2
- package/dist/importer/surfaceTopology.js +57 -29
- package/dist/importer/universalGateBake.d.ts +7 -1
- package/dist/importer/universalGateBake.js +63 -60
- package/dist/importer/usdToGlb.js +19 -7
- package/dist/importer/useChopShopController.d.ts +27 -1
- package/dist/importer/useChopShopController.js +369 -255
- package/dist/importer/wheelAxlePairing.d.ts +3 -1
- package/dist/importer/wheelAxlePairing.js +82 -33
- package/dist/index.js +31 -28
- package/dist/junk/ShardPieces.js +3 -3
- package/dist/physics/index.d.ts +7 -0
- package/dist/physics/index.js +66 -40
- package/package.json +1 -1
|
@@ -1,42 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { makeStarterDomainScene as
|
|
5
|
-
import { isGateStep1Unlocked as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
1
|
+
import { buildSurfaceStampPatch as e, downloadBlobGlb as t, executeCloseLoop as n, executeCutPartMcp as r, executePeelTransaction as i, parseIngestedAssetFile as a, putAuthenticatedVaultGlb as ee } from "./chopShopActions.js";
|
|
2
|
+
import { suggestCarAxles as te, toggleIslandSelection as ne } from "./wheelAxlePairing.js";
|
|
3
|
+
import { autoFitCabinConfig as o, evaluateCabinFit as re, seatXForLayout as ie } from "./cabinMixamoRig.js";
|
|
4
|
+
import { makeStarterDomainScene as ae } from "./ImporterPlinthUikitTags.js";
|
|
5
|
+
import { isGateStep1Unlocked as oe, useGateStore as se } from "./gateStore.js";
|
|
6
|
+
import { CHOP_ROLES as ce, countSelectionFaces as le } from "./surfaceTopology.js";
|
|
7
|
+
import { defaultTargetMeters as ue, measureAssemblyCalibration as de, measureNormalizedSceneCalibration as fe, snapMetersToC12 as pe, wrapSingleMeshWithPaperShellProxy as me } from "./glbNormalizer.js";
|
|
8
|
+
import { extractMeshIslands as he, normalizeSceneToSi as ge } from "./meshIslands.js";
|
|
9
|
+
import { findMirrorIslandId as _e, selectFacesByClick as ve } from "./surfaceCutter.js";
|
|
10
|
+
import { bakeUniversalGateGlb as ye } from "./universalGateBake.js";
|
|
11
|
+
import { useCallback as be, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
12
|
+
import * as xe from "three";
|
|
13
|
+
import { GLTFLoader as Se } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
14
|
+
import { buildPaperShellAssembly as Ce } from "@khr3/vehicles/paper-shell";
|
|
13
15
|
// src/importer/useChopShopController.ts
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
var we = [
|
|
17
|
+
"#00E5FF",
|
|
18
|
+
"#10B981",
|
|
19
|
+
"#A855F7",
|
|
20
|
+
"#F59E0B"
|
|
21
|
+
];
|
|
22
|
+
function d(d) {
|
|
23
|
+
let f = se(), [p, m] = u("pickup_truck"), [Te, Ee] = u(!1), [De, Oe] = u(null), [h, g] = u(null), [ke, _] = u([
|
|
16
24
|
0,
|
|
17
25
|
0,
|
|
18
26
|
0
|
|
19
|
-
]), [
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
]), [v, y] = u(4.65), [b, Ae] = u(0), [je, x] = u(null), [Me, S] = u(0), [C, w] = u([]), [T, E] = u([]), [D, O] = u({}), [k, Ne] = u("imported"), [A, Pe] = u("door"), [j, Fe] = u("crease"), [M, Ie] = u(32), [N, Le] = u(!0), [Re, ze] = u(!1), [P, F] = u(null), [I, L] = u(null), [Be, R] = u(0), [Ve, He] = u(0), [Ue, We] = u("shell"), [Ge, z] = u("solid"), [B, V] = u(() => o([
|
|
28
|
+
-.9,
|
|
29
|
+
0,
|
|
30
|
+
-2.3
|
|
31
|
+
], [
|
|
32
|
+
.9,
|
|
33
|
+
1.65,
|
|
34
|
+
2.3
|
|
35
|
+
], .34, "lhd")), [Ke, qe] = u(!0), [H, U] = u([]), [Je, W] = u("1. Fit -> 2. Cut Shell (Wheels/Doors/Glass) -> 3. Fit Mixamo Cabin -> 4. Drive!"), [Ye, Xe] = u("none"), [G, K] = u([]), [Ze, Qe] = u(null), [$e, q] = u(!1), et = l(null), tt = l(null), nt = l(null), rt = l(0), it = be((e, t, n = !1) => (q(!0), new Promise((r, i) => {
|
|
36
|
+
new Se().load(e, (e) => {
|
|
37
|
+
m(t), g(e.scene), _([
|
|
22
38
|
0,
|
|
23
39
|
0,
|
|
24
40
|
0
|
|
25
|
-
]),
|
|
26
|
-
}, void 0, (
|
|
27
|
-
|
|
41
|
+
]), y(t.includes("pickup") ? 4.65 : 4.2), O({}), E([]), F(null), L(null), U([]), R(0), W(`Loaded ${t} — chop doors/hood/trunk or pop tires!`), q(!1), r();
|
|
42
|
+
}, void 0, (r) => {
|
|
43
|
+
q(!1), n || W(`Failed to load ${t}`), i(r instanceof Error ? r : /* @__PURE__ */ Error(`Failed to load ${e}`));
|
|
28
44
|
});
|
|
29
45
|
})), []);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
let
|
|
34
|
-
let e = !
|
|
46
|
+
s(() => {
|
|
47
|
+
it("/models/pickup-truck.glb", "pickup_truck", !0).catch(() => {});
|
|
48
|
+
}, [it]);
|
|
49
|
+
let J = c(() => {
|
|
50
|
+
let e = !h && !(f.domain === "vehicle" && f.usePaperShellProxy) ? ae(f.domain) : null, t = h ?? e;
|
|
35
51
|
if (!t) return null;
|
|
36
52
|
try {
|
|
37
|
-
return
|
|
38
|
-
turns:
|
|
39
|
-
targetMeters: Math.max(.05,
|
|
53
|
+
return ge(t, {
|
|
54
|
+
turns: ke,
|
|
55
|
+
targetMeters: Math.max(.05, v),
|
|
40
56
|
axis: "lengthZ"
|
|
41
57
|
}).scene;
|
|
42
58
|
} catch {
|
|
@@ -48,141 +64,194 @@ function p(p) {
|
|
|
48
64
|
});
|
|
49
65
|
}
|
|
50
66
|
}, [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
h,
|
|
68
|
+
f.domain,
|
|
69
|
+
f.usePaperShellProxy,
|
|
70
|
+
ke,
|
|
71
|
+
v
|
|
72
|
+
]), Y = c(() => je ?? Ce(f.presetId, f.shadingMode), [
|
|
73
|
+
je,
|
|
74
|
+
f.presetId,
|
|
75
|
+
f.shadingMode
|
|
76
|
+
]), X = c(() => J && f.domain === "vehicle" && !f.usePaperShellProxy ? he(J) : [], [
|
|
77
|
+
J,
|
|
78
|
+
f.domain,
|
|
79
|
+
f.usePaperShellProxy,
|
|
80
|
+
Me
|
|
60
81
|
]);
|
|
61
|
-
|
|
62
|
-
|
|
82
|
+
s(() => () => {
|
|
83
|
+
for (let e of X) e.geometry.dispose();
|
|
84
|
+
}, [X]), s(() => {
|
|
85
|
+
f.domain === "vehicle" && f.usePaperShellProxy ? de(Y, 1, b, !!h, J) : J && fe(J, b, C, X);
|
|
63
86
|
}, [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
87
|
+
f.domain,
|
|
88
|
+
f.usePaperShellProxy,
|
|
89
|
+
Y,
|
|
90
|
+
J,
|
|
91
|
+
b,
|
|
92
|
+
h,
|
|
93
|
+
Me,
|
|
68
94
|
C,
|
|
69
|
-
|
|
70
|
-
T
|
|
95
|
+
X
|
|
71
96
|
]);
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
97
|
+
let Z = c(() => {
|
|
98
|
+
let e = {
|
|
99
|
+
min: [
|
|
100
|
+
-.9,
|
|
101
|
+
0,
|
|
102
|
+
-2.1
|
|
103
|
+
],
|
|
104
|
+
max: [
|
|
105
|
+
.9,
|
|
106
|
+
1.5,
|
|
107
|
+
2.1
|
|
108
|
+
]
|
|
109
|
+
};
|
|
110
|
+
if (!J) return e;
|
|
111
|
+
J.updateMatrixWorld(!0);
|
|
112
|
+
let t = new xe.Box3().setFromObject(J);
|
|
113
|
+
return t.isEmpty() ? e : {
|
|
114
|
+
min: [
|
|
115
|
+
t.min.x,
|
|
116
|
+
t.min.y,
|
|
117
|
+
t.min.z
|
|
118
|
+
],
|
|
119
|
+
max: [
|
|
120
|
+
t.max.x,
|
|
121
|
+
t.max.y,
|
|
122
|
+
t.max.z
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
}, [J]), at = c(() => re(B, Z.min, Z.max), [B, Z]);
|
|
126
|
+
s(() => {
|
|
127
|
+
if (!J) return;
|
|
128
|
+
let e = he(J), t = f.vehicleArchetype === "car" ? te(e) : [];
|
|
129
|
+
w(t);
|
|
130
|
+
let n = t.length > 0 ? Math.max(.2, ...t.flatMap((e) => [...e.left, ...e.right]).map((t) => (e.find((e) => e.id === t)?.size[1] ?? .6) * .5)) : .32;
|
|
131
|
+
V((e) => o(Z.min, Z.max, n, e.layout));
|
|
132
|
+
for (let t of e) t.geometry.dispose();
|
|
133
|
+
E([]), O({}), F(null), L(null), U([]);
|
|
134
|
+
}, [
|
|
135
|
+
J,
|
|
136
|
+
f.vehicleArchetype,
|
|
137
|
+
Z
|
|
78
138
|
]);
|
|
79
|
-
|
|
80
|
-
for (let e of Q) e.geometry.dispose();
|
|
81
|
-
}, [Q]), l(() => {
|
|
82
|
-
if (!X) return;
|
|
83
|
-
let t = ue(X);
|
|
84
|
-
O(m.vehicleArchetype === "car" ? e(t) : []);
|
|
85
|
-
for (let e of t) e.geometry.dispose();
|
|
86
|
-
A({}), R(null), B(null), W([]);
|
|
87
|
-
}, [X, m.vehicleArchetype]);
|
|
88
|
-
let Ve = u(() => new Set(D.flatMap((e) => [...e.left, ...e.right])), [D]), He = u(() => {
|
|
139
|
+
let Q = c(() => new Set(C.flatMap((e) => [...e.left, ...e.right])), [C]), ot = c(() => new Set(T), [T]), st = c(() => {
|
|
89
140
|
let e = /* @__PURE__ */ new Map();
|
|
90
|
-
return
|
|
91
|
-
|
|
141
|
+
return C.forEach((t, n) => {
|
|
142
|
+
let r = we[n % we.length];
|
|
143
|
+
for (let n of [...t.left, ...t.right]) e.set(n, r);
|
|
92
144
|
}), e;
|
|
93
|
-
}, [
|
|
94
|
-
name:
|
|
95
|
-
domain:
|
|
96
|
-
vehicleArchetype:
|
|
97
|
-
usePaperShellProxy:
|
|
98
|
-
assembly:
|
|
99
|
-
attachedMask:
|
|
100
|
-
fuelLiters:
|
|
101
|
-
normalizedScene:
|
|
102
|
-
massKg:
|
|
103
|
-
powerOrThrust:
|
|
104
|
-
driveType:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
145
|
+
}, [C]), $ = be(() => ye({
|
|
146
|
+
name: p,
|
|
147
|
+
domain: f.domain,
|
|
148
|
+
vehicleArchetype: f.vehicleArchetype,
|
|
149
|
+
usePaperShellProxy: f.usePaperShellProxy,
|
|
150
|
+
assembly: Y,
|
|
151
|
+
attachedMask: f.attachedMask,
|
|
152
|
+
fuelLiters: f.fuelLiters,
|
|
153
|
+
normalizedScene: J,
|
|
154
|
+
massKg: f.massKg,
|
|
155
|
+
powerOrThrust: f.powerOrThrust,
|
|
156
|
+
driveType: f.driveType,
|
|
157
|
+
tirePreset: f.tirePreset,
|
|
158
|
+
torqueCurve: f.torqueCurve,
|
|
159
|
+
steerCurve: f.steerCurve,
|
|
160
|
+
staticProp: f.staticProp,
|
|
161
|
+
axles: C,
|
|
162
|
+
propellerIslandIds: T,
|
|
163
|
+
islands: X,
|
|
164
|
+
partPicks: D,
|
|
165
|
+
wheelSource: k,
|
|
166
|
+
cabin: B,
|
|
167
|
+
patches: G
|
|
111
168
|
}), [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
169
|
+
p,
|
|
170
|
+
f.domain,
|
|
171
|
+
f.vehicleArchetype,
|
|
172
|
+
f.usePaperShellProxy,
|
|
173
|
+
Y,
|
|
174
|
+
f.attachedMask,
|
|
175
|
+
f.fuelLiters,
|
|
176
|
+
J,
|
|
177
|
+
f.massKg,
|
|
178
|
+
f.powerOrThrust,
|
|
179
|
+
f.driveType,
|
|
180
|
+
f.tirePreset,
|
|
181
|
+
f.torqueCurve,
|
|
182
|
+
f.steerCurve,
|
|
183
|
+
f.staticProp,
|
|
184
|
+
C,
|
|
185
|
+
T,
|
|
119
186
|
X,
|
|
120
|
-
m.massKg,
|
|
121
|
-
m.powerOrThrust,
|
|
122
|
-
m.driveType,
|
|
123
|
-
m.staticProp,
|
|
124
187
|
D,
|
|
125
|
-
Q,
|
|
126
188
|
k,
|
|
127
|
-
|
|
128
|
-
|
|
189
|
+
B,
|
|
190
|
+
G
|
|
129
191
|
]);
|
|
130
|
-
|
|
131
|
-
if (
|
|
192
|
+
s(() => {
|
|
193
|
+
if (f.step !== 2 || f.domain === "vehicle" && f.usePaperShellProxy) return;
|
|
132
194
|
let e = !0;
|
|
133
195
|
return $().then((t) => {
|
|
134
|
-
e &&
|
|
196
|
+
e && Qe(t.bundle);
|
|
135
197
|
}).catch(() => {
|
|
136
|
-
e &&
|
|
198
|
+
e && Qe(null);
|
|
137
199
|
}), () => {
|
|
138
200
|
e = !1;
|
|
139
201
|
};
|
|
140
202
|
}, [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
203
|
+
f.step,
|
|
204
|
+
f.domain,
|
|
205
|
+
f.usePaperShellProxy,
|
|
144
206
|
$
|
|
145
207
|
]);
|
|
146
|
-
let
|
|
147
|
-
|
|
208
|
+
let ct = async (e) => {
|
|
209
|
+
q(!0);
|
|
148
210
|
try {
|
|
149
|
-
let { baseName: t, scene: n, usdInfo: r } = await
|
|
150
|
-
|
|
211
|
+
let { baseName: t, scene: n, usdInfo: r } = await a(e);
|
|
212
|
+
m(t), Ee(!0), _([
|
|
151
213
|
0,
|
|
152
214
|
0,
|
|
153
215
|
0
|
|
154
|
-
]),
|
|
216
|
+
]), Ae(0), K([]), f.setField("step", 1), We("fit"), g(n), Oe(r), r ? f.setField("usePaperShellProxy", !1) : f.domain === "vehicle" && f.usePaperShellProxy && x(me(n, f.presetId, f.shadingMode)), W(`Imported "${t}" — orient/scale, pop wheels/rotors, and chop panels!`);
|
|
155
217
|
} finally {
|
|
156
|
-
|
|
218
|
+
q(!1);
|
|
157
219
|
}
|
|
158
|
-
},
|
|
159
|
-
let r = t === "starcraft" ? "starcraft" : "car", i =
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
let
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
O((n) => t(Q, n, e, "car"));
|
|
220
|
+
}, lt = (e, t, n) => {
|
|
221
|
+
let r = t === "starcraft" ? "starcraft" : "car", i = ue(e, r);
|
|
222
|
+
f.setField("domain", e), f.setField("vehicleArchetype", r), f.setField("usePaperShellProxy", n), f.setField("massKg", i.massKg), f.setField("powerOrThrust", i.power), f.setField("step", 1), r === "starcraft" && Pe("propeller"), y(e === "c12" ? pe(i.len) : i.len);
|
|
223
|
+
}, ut = (e, t) => {
|
|
224
|
+
let n = t ?? A;
|
|
225
|
+
if (n === "wheel") {
|
|
226
|
+
w((t) => ne(X, t, e, "car", N));
|
|
166
227
|
return;
|
|
167
228
|
}
|
|
168
|
-
if (
|
|
169
|
-
|
|
229
|
+
if (n === "propeller") {
|
|
230
|
+
if (Q.has(e)) {
|
|
231
|
+
W("That island is paired as a wheel.");
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
let t = N ? _e(X, e, Q) : null, n = t === null ? [e] : [e, t];
|
|
235
|
+
E((t) => {
|
|
236
|
+
let r = new Set(t), i = r.has(e);
|
|
237
|
+
for (let e of n) i ? r.delete(e) : r.add(e);
|
|
238
|
+
return W(i ? "Cleared propeller rotor." : `Tagged ${n.length} propeller rotor(s) (${r.size} total).`), [...r];
|
|
239
|
+
});
|
|
170
240
|
return;
|
|
171
241
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
G("Main body shell — switch to Crease Flood or Tape Lasso to cut a panel!");
|
|
242
|
+
if (Q.has(e) || ot.has(e)) {
|
|
243
|
+
W("That island is already tagged as a wheel/propeller.");
|
|
175
244
|
return;
|
|
176
245
|
}
|
|
177
|
-
let
|
|
178
|
-
|
|
179
|
-
let
|
|
180
|
-
for (let e of
|
|
181
|
-
return
|
|
246
|
+
let r = N && (n === "door" || n === "fender" || n === "glass") ? _e(X, e, Q) : null, i = r === null ? [e] : [e, r];
|
|
247
|
+
O((t) => {
|
|
248
|
+
let r = { ...t }, a = t[e] === n;
|
|
249
|
+
for (let e of i) a ? delete r[e] : r[e] = n;
|
|
250
|
+
return W(a ? `Cleared ${n} tag.` : `Tagged ${i.length} piece(s) as ${n} — drag Hinges to test!`), r;
|
|
182
251
|
});
|
|
183
|
-
},
|
|
184
|
-
let t =
|
|
185
|
-
t && (
|
|
252
|
+
}, dt = (e) => {
|
|
253
|
+
let t = X.find((t) => t.id === e.islandId);
|
|
254
|
+
t && (j === "loop" ? (F(null), L((n) => e.erase ? n && n.points.length > 1 ? {
|
|
186
255
|
...n,
|
|
187
256
|
points: n.points.slice(0, -1)
|
|
188
257
|
} : null : n?.islandId === t.id ? {
|
|
@@ -191,174 +260,219 @@ function p(p) {
|
|
|
191
260
|
} : {
|
|
192
261
|
islandId: t.id,
|
|
193
262
|
points: [e.point]
|
|
194
|
-
})) : (
|
|
195
|
-
creaseDeg:
|
|
196
|
-
mirrorX:
|
|
263
|
+
})) : (j === "crease" && !e.isDrag || j === "triangle") && F((n) => ve(t, e.faceIndex, j, {
|
|
264
|
+
creaseDeg: M,
|
|
265
|
+
mirrorX: N,
|
|
197
266
|
current: n,
|
|
198
|
-
remove: e.erase
|
|
267
|
+
remove: e.erase,
|
|
268
|
+
allIslands: X,
|
|
269
|
+
excludeMirrorIds: Q
|
|
199
270
|
})));
|
|
200
|
-
},
|
|
201
|
-
if (
|
|
202
|
-
let e =
|
|
203
|
-
workingScene:
|
|
204
|
-
islands:
|
|
205
|
-
loopDots:
|
|
206
|
-
splitCoarse:
|
|
207
|
-
mirrorX:
|
|
208
|
-
axles:
|
|
271
|
+
}, ft = () => {
|
|
272
|
+
if (J && I) try {
|
|
273
|
+
let e = n({
|
|
274
|
+
workingScene: J,
|
|
275
|
+
islands: X,
|
|
276
|
+
loopDots: I,
|
|
277
|
+
splitCoarse: Re,
|
|
278
|
+
mirrorX: N,
|
|
279
|
+
axles: C,
|
|
280
|
+
propellerIds: T,
|
|
281
|
+
prevPicks: D
|
|
209
282
|
});
|
|
210
|
-
e.refinedUndo && e.nextAxles && (
|
|
283
|
+
e.refinedUndo && e.nextAxles && (U((t) => [...t, {
|
|
211
284
|
undo: e.refinedUndo,
|
|
212
|
-
axles:
|
|
213
|
-
|
|
214
|
-
|
|
285
|
+
axles: C,
|
|
286
|
+
propellers: T,
|
|
287
|
+
picks: D
|
|
288
|
+
}]), w(e.nextAxles), e.nextPropellers && E(e.nextPropellers), e.nextPicks && O(e.nextPicks), S((e) => e + 1)), F(e.selection), L(null), W("Loop closed — click PEEL to slice those faces into a real part!");
|
|
215
289
|
} catch (e) {
|
|
216
|
-
|
|
290
|
+
W(e instanceof Error ? e.message : "Could not close loop.");
|
|
217
291
|
}
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
292
|
+
}, pt = (e, t) => {
|
|
293
|
+
let n = le(e);
|
|
294
|
+
if (!J || !e || n.primary + n.mirrored === 0) return null;
|
|
295
|
+
let r = i({
|
|
296
|
+
workingScene: J,
|
|
297
|
+
islands: X,
|
|
223
298
|
faceSelection: e,
|
|
224
299
|
activeRole: t,
|
|
225
|
-
cutName: `${t}_chop_${++
|
|
226
|
-
prevAxles:
|
|
227
|
-
|
|
300
|
+
cutName: `${t}_chop_${++rt.current}`,
|
|
301
|
+
prevAxles: C,
|
|
302
|
+
prevPropellers: T,
|
|
303
|
+
prevPicks: D,
|
|
228
304
|
mode: "car"
|
|
229
305
|
});
|
|
230
|
-
return
|
|
231
|
-
undo:
|
|
232
|
-
axles:
|
|
233
|
-
|
|
234
|
-
|
|
306
|
+
return r.bumpHinge && Be === 0 && R(.48), U((e) => [...e, {
|
|
307
|
+
undo: r.undo,
|
|
308
|
+
axles: C,
|
|
309
|
+
propellers: T,
|
|
310
|
+
picks: D
|
|
311
|
+
}]), w(r.nextAxles), E(r.nextPropellers), O(r.nextPicks), F(null), L(null), S((e) => e + 1), W(r.status), r;
|
|
235
312
|
};
|
|
236
313
|
return {
|
|
237
|
-
st:
|
|
238
|
-
assetName:
|
|
239
|
-
hasCustomFile:
|
|
240
|
-
usdInfo:
|
|
241
|
-
targetMeters:
|
|
242
|
-
setTargetMeters:
|
|
243
|
-
setYOffset:
|
|
244
|
-
setTurns:
|
|
245
|
-
axles:
|
|
246
|
-
setAxles:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
314
|
+
st: f,
|
|
315
|
+
assetName: p,
|
|
316
|
+
hasCustomFile: Te,
|
|
317
|
+
usdInfo: De,
|
|
318
|
+
targetMeters: v,
|
|
319
|
+
setTargetMeters: y,
|
|
320
|
+
setYOffset: Ae,
|
|
321
|
+
setTurns: _,
|
|
322
|
+
axles: C,
|
|
323
|
+
setAxles: w,
|
|
324
|
+
propellerIds: T,
|
|
325
|
+
setPropellerIds: E,
|
|
326
|
+
propellerSet: ot,
|
|
327
|
+
partPicks: D,
|
|
328
|
+
setPartPicks: O,
|
|
329
|
+
wheelSource: k,
|
|
330
|
+
setWheelSource: Ne,
|
|
331
|
+
activeRole: A,
|
|
332
|
+
setActiveRole: Pe,
|
|
333
|
+
surfaceMode: j,
|
|
334
|
+
setSurfaceMode: Fe,
|
|
335
|
+
creaseDeg: M,
|
|
336
|
+
setCreaseDeg: Ie,
|
|
337
|
+
mirrorX: N,
|
|
338
|
+
setMirrorX: Le,
|
|
339
|
+
splitCoarse: Re,
|
|
340
|
+
setSplitCoarse: ze,
|
|
341
|
+
faceSelection: P,
|
|
342
|
+
setFaceSelection: F,
|
|
343
|
+
selectedCounts: c(() => le(P), [P]),
|
|
344
|
+
loopDots: I,
|
|
345
|
+
setLoopDots: L,
|
|
346
|
+
hingeScrub: Be,
|
|
347
|
+
setHingeScrub: R,
|
|
348
|
+
explodeAmount: Ve,
|
|
349
|
+
setExplodeAmount: He,
|
|
350
|
+
wizardTab: Ue,
|
|
351
|
+
handleChangeWizardTab: (e) => {
|
|
352
|
+
We(e), e === "cabin" ? z((e) => e === "solid" ? "xray" : e) : (e === "shell" || e === "fit") && z("solid");
|
|
353
|
+
},
|
|
354
|
+
shellViewMode: Ge,
|
|
355
|
+
setShellViewMode: z,
|
|
356
|
+
cabin: B,
|
|
357
|
+
cabinFit: at,
|
|
358
|
+
carBounds: Z,
|
|
359
|
+
updateCabin: (e) => V((t) => ({
|
|
360
|
+
...t,
|
|
361
|
+
...e
|
|
362
|
+
})),
|
|
363
|
+
setCabinLayout: (e) => {
|
|
364
|
+
let t = Math.max(.9, Z.max[0] - Z.min[0]);
|
|
365
|
+
V((n) => ({
|
|
366
|
+
...n,
|
|
367
|
+
layout: e,
|
|
368
|
+
seatPos: [
|
|
369
|
+
ie(e, t),
|
|
370
|
+
n.seatPos[1],
|
|
371
|
+
n.seatPos[2]
|
|
372
|
+
],
|
|
373
|
+
passengerSeat: e !== "center" && t >= 1.35
|
|
374
|
+
}));
|
|
375
|
+
},
|
|
376
|
+
autoFitCabin: () => {
|
|
377
|
+
let e = C.length > 0 ? Math.max(.2, ...C.flatMap((e) => [...e.left, ...e.right]).map((e) => (X.find((t) => t.id === e)?.size[1] ?? .6) * .5)) : .32;
|
|
378
|
+
V((t) => o(Z.min, Z.max, e, t.layout)), W("Auto-fitted Mixamo seated cabin to car bounds.");
|
|
379
|
+
},
|
|
380
|
+
showDriverInStep2: Ke,
|
|
381
|
+
setShowDriverInStep2: qe,
|
|
382
|
+
undoStack: H,
|
|
383
|
+
statusNote: Je,
|
|
384
|
+
stampTool: Ye,
|
|
385
|
+
setStampTool: Xe,
|
|
386
|
+
patches: G,
|
|
387
|
+
setPatches: K,
|
|
388
|
+
liveBundle: Ze,
|
|
389
|
+
busy: $e,
|
|
390
|
+
fileRef: et,
|
|
391
|
+
rootObjRef: tt,
|
|
392
|
+
panelAnimRef: nt,
|
|
393
|
+
workingScene: J,
|
|
394
|
+
assembly: Y,
|
|
395
|
+
setProxyAssembly: x,
|
|
396
|
+
islands: X,
|
|
397
|
+
wheelColors: st,
|
|
398
|
+
loadStarterCar: it,
|
|
399
|
+
ingestFile: ct,
|
|
400
|
+
applyDomainDefaults: lt,
|
|
401
|
+
handleBucketIsland: (e) => ut(e),
|
|
402
|
+
handlePickFace: dt,
|
|
290
403
|
forgeScene: (e, t, n) => {
|
|
291
|
-
|
|
404
|
+
m(e), g(t), _([
|
|
292
405
|
0,
|
|
293
406
|
0,
|
|
294
407
|
0
|
|
295
|
-
]),
|
|
408
|
+
]), y(n), Ee(!0);
|
|
296
409
|
},
|
|
297
|
-
handleCloseLoop:
|
|
410
|
+
handleCloseLoop: ft,
|
|
298
411
|
handlePeelSelection: () => {
|
|
299
412
|
try {
|
|
300
|
-
|
|
413
|
+
pt(P, A);
|
|
301
414
|
} catch (e) {
|
|
302
|
-
|
|
415
|
+
W(e instanceof Error ? e.message : "Peel failed.");
|
|
303
416
|
}
|
|
304
417
|
},
|
|
305
|
-
cutPart: (e) =>
|
|
418
|
+
cutPart: (e) => r({
|
|
306
419
|
req: e,
|
|
307
|
-
workingScene:
|
|
308
|
-
islands:
|
|
309
|
-
creaseDeg:
|
|
310
|
-
mirrorX:
|
|
311
|
-
onPeel:
|
|
312
|
-
onBucket:
|
|
420
|
+
workingScene: J,
|
|
421
|
+
islands: X,
|
|
422
|
+
creaseDeg: M,
|
|
423
|
+
mirrorX: N,
|
|
424
|
+
onPeel: pt,
|
|
425
|
+
onBucket: ut
|
|
313
426
|
}),
|
|
314
427
|
handleUndoCut: () => {
|
|
315
|
-
let e =
|
|
316
|
-
e && (e.undo(),
|
|
428
|
+
let e = H[H.length - 1];
|
|
429
|
+
e && (e.undo(), U((e) => e.slice(0, -1)), w(e.axles), E(e.propellers), O(e.picks), F(null), L(null), S((e) => e + 1), W("Undid last cut."));
|
|
317
430
|
},
|
|
318
431
|
sealAndExport: async (e) => {
|
|
319
|
-
|
|
432
|
+
q(!0);
|
|
320
433
|
try {
|
|
321
|
-
let
|
|
322
|
-
e &&
|
|
323
|
-
id: `${
|
|
324
|
-
label:
|
|
325
|
-
kind:
|
|
326
|
-
domain:
|
|
327
|
-
glbBytes:
|
|
328
|
-
bundle:
|
|
329
|
-
}) :
|
|
434
|
+
let n = await $();
|
|
435
|
+
e && d ? d({
|
|
436
|
+
id: `${p.toLowerCase().replace(/[^a-z0-9]+/g, "_")}_${Date.now().toString(36)}`,
|
|
437
|
+
label: p,
|
|
438
|
+
kind: n.worldKind,
|
|
439
|
+
domain: f.domain,
|
|
440
|
+
glbBytes: n.glbBytes,
|
|
441
|
+
bundle: n.bundle
|
|
442
|
+
}) : t(p, n.glbBytes);
|
|
330
443
|
} finally {
|
|
331
|
-
|
|
444
|
+
q(!1);
|
|
332
445
|
}
|
|
333
446
|
},
|
|
334
447
|
uploadToVault: async (e, t) => {
|
|
335
|
-
|
|
448
|
+
q(!0);
|
|
336
449
|
try {
|
|
337
450
|
let n = await $();
|
|
338
|
-
return await
|
|
451
|
+
return await ee(e, p, n.glbBytes, t);
|
|
339
452
|
} finally {
|
|
340
|
-
|
|
453
|
+
q(!1);
|
|
341
454
|
}
|
|
342
455
|
},
|
|
343
|
-
handleStampSurface: (
|
|
344
|
-
let
|
|
345
|
-
|
|
456
|
+
handleStampSurface: (t) => {
|
|
457
|
+
let n = e(t, Ye, G.length + 1);
|
|
458
|
+
n && K((e) => [...e, n]);
|
|
346
459
|
},
|
|
347
|
-
wheelCount:
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
460
|
+
wheelCount: C.reduce((e, t) => e + +(t.left.length > 0) + +(t.right.length > 0), 0),
|
|
461
|
+
propellerCount: T.length,
|
|
462
|
+
choppedCount: Object.keys(D).length,
|
|
463
|
+
unlocked: oe(f.calibration, f.domain, f.vehicleArchetype, f.usePaperShellProxy),
|
|
464
|
+
activeRoleColor: ce.find((e) => e.role === A)?.color ?? "#FFB000",
|
|
465
|
+
bumpTurn: (e) => _((t) => {
|
|
352
466
|
let n = [...t];
|
|
353
467
|
return n[e] = (n[e] + 1) % 4, n;
|
|
354
468
|
}),
|
|
355
469
|
wrapProxy: () => {
|
|
356
|
-
let e = !
|
|
357
|
-
|
|
470
|
+
let e = !f.usePaperShellProxy;
|
|
471
|
+
f.setField("usePaperShellProxy", e), e && x(me(J, f.presetId, f.shadingMode));
|
|
358
472
|
},
|
|
359
|
-
autoPopWheels: () =>
|
|
360
|
-
autoScaleSi: () =>
|
|
361
|
-
snapC12: () =>
|
|
473
|
+
autoPopWheels: () => w(te(X)),
|
|
474
|
+
autoScaleSi: () => y(ue(f.domain, f.vehicleArchetype).len),
|
|
475
|
+
snapC12: () => y((e) => pe(e))
|
|
362
476
|
};
|
|
363
477
|
}
|
|
364
|
-
export {
|
|
478
|
+
export { d as useChopShopController };
|