@snaptrude/plugin-core 0.9.17 → 0.9.18-edgesetbacks-20261021.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/AGENTS.md +231 -231
- package/CHANGELOG.md +408 -408
- package/CLAUDE.md +11 -11
- package/api-manifest.json +1428 -712
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +29 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +7 -1
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/update/contour.d.ts +8 -2
- package/dist/api/core/geom/update/contour.d.ts.map +1 -1
- package/dist/api/core/storeys/index.d.ts +5 -2
- package/dist/api/core/storeys/index.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +13 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/bim.d.ts +299 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +2 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -1
- package/dist/api/design/catalog.d.ts +320 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +65 -25
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +299 -100
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +13 -12
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +1 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +18 -24
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +813 -35
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +16 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1703 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/grids.d.ts +2 -2
- package/dist/api/design/query/index.d.ts +42 -32
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +10 -10
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +111 -6
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +8 -8
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +84 -2
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +10 -10
- package/dist/api/presentation/annotate.d.ts +38 -22
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/drawingContract.d.ts +32 -0
- package/dist/api/presentation/drawingContract.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +3523 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +23 -5
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +32 -12
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +106 -6
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +175 -19
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/viewPresets.d.ts +222 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +141 -8
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +6 -6
- package/dist/errors/codes.d.ts +3 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/index.cjs +3831 -2444
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3705 -2444
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/check-dist-fresh.mjs +22 -22
- package/scripts/generate-manifest.mjs +243 -238
- package/scripts/generate-manifest.test.mjs +303 -303
- package/src/api/analysis/daylight.ts +470 -470
- package/src/api/analysis/heatmaps.ts +683 -683
- package/src/api/analysis/illuminance.ts +155 -155
- package/src/api/analysis/index.ts +61 -61
- package/src/api/analysis/shadows.ts +183 -183
- package/src/api/analysis/solar.ts +237 -237
- package/src/api/analysis/sunlightHours.ts +211 -211
- package/src/api/analysis/sunpath.ts +83 -83
- package/src/api/analysis/weather.ts +179 -179
- package/src/api/core/buildings.ts +485 -485
- package/src/api/core/camera/index.ts +696 -667
- package/src/api/core/comment/index.ts +376 -376
- package/src/api/core/geom/create/index.ts +2139 -2133
- package/src/api/core/geom/delete/index.ts +84 -84
- package/src/api/core/geom/index.ts +35 -35
- package/src/api/core/geom/query/arc.ts +169 -169
- package/src/api/core/geom/query/brep.ts +621 -621
- package/src/api/core/geom/query/circle.ts +404 -404
- package/src/api/core/geom/query/contour.ts +540 -540
- package/src/api/core/geom/query/curve.ts +1102 -1102
- package/src/api/core/geom/query/edge.ts +130 -130
- package/src/api/core/geom/query/face.ts +508 -508
- package/src/api/core/geom/query/halfedge.ts +210 -210
- package/src/api/core/geom/query/index.ts +63 -63
- package/src/api/core/geom/query/profile.ts +473 -473
- package/src/api/core/geom/query/vertex.ts +205 -205
- package/src/api/core/geom/update/contour.ts +323 -317
- package/src/api/core/geom/update/curve.ts +209 -209
- package/src/api/core/geom/update/index.ts +29 -29
- package/src/api/core/geom/update/profile.ts +379 -379
- package/src/api/core/groups.ts +521 -521
- package/src/api/core/handles/index.ts +234 -234
- package/src/api/core/history/index.ts +84 -84
- package/src/api/core/index.ts +99 -99
- package/src/api/core/io/export/index.ts +126 -126
- package/src/api/core/io/import/index.ts +504 -504
- package/src/api/core/io/index.ts +42 -42
- package/src/api/core/io/job/index.ts +140 -140
- package/src/api/core/io/query/index.ts +71 -71
- package/src/api/core/io/terrain/index.ts +360 -360
- package/src/api/core/io/underlay/index.ts +705 -705
- package/src/api/core/layers.ts +540 -540
- package/src/api/core/math/index.ts +20 -20
- package/src/api/core/math/quat.ts +172 -172
- package/src/api/core/math/vec3.ts +179 -179
- package/src/api/core/mode/index.ts +108 -108
- package/src/api/core/project/index.ts +479 -479
- package/src/api/core/proposals/index.ts +570 -570
- package/src/api/core/storeys/index.ts +311 -308
- package/src/api/core/storeys/layers.ts +339 -339
- package/src/api/core/tags.ts +911 -911
- package/src/api/core/units/index.ts +164 -164
- package/src/api/core/user.ts +46 -46
- package/src/api/core/zoom/index.ts +64 -51
- package/src/api/design/bim.ts +210 -0
- package/src/api/design/boolean/index.ts +181 -179
- package/src/api/design/catalog.ts +203 -0
- package/src/api/design/create/bulk-items.ts +294 -254
- package/src/api/design/create/grids.ts +137 -137
- package/src/api/design/create/index.ts +2178 -1980
- package/src/api/design/create/opening-fields.ts +40 -37
- package/src/api/design/delete/index.ts +75 -74
- package/src/api/design/dimensions.ts +453 -453
- package/src/api/design/doors/index.ts +516 -500
- package/src/api/design/edit/index.ts +54 -54
- package/src/api/design/erase/index.ts +151 -151
- package/src/api/design/family.ts +1342 -704
- package/src/api/design/furniture/index.ts +319 -319
- package/src/api/design/grids.ts +237 -237
- package/src/api/design/index.ts +304 -274
- package/src/api/design/lock.ts +69 -69
- package/src/api/design/materials/index.ts +608 -608
- package/src/api/design/networks.ts +607 -0
- package/src/api/design/query/geometry/index.ts +319 -319
- package/src/api/design/query/grids.ts +197 -197
- package/src/api/design/query/index.ts +1236 -1226
- package/src/api/design/query/referenceLines.ts +52 -52
- package/src/api/design/query/spaces.ts +275 -275
- package/src/api/design/selection/index.ts +273 -273
- package/src/api/design/shared.ts +40 -40
- package/src/api/design/transform/index.ts +254 -254
- package/src/api/design/types/index.ts +163 -156
- package/src/api/design/update/index.ts +1096 -983
- package/src/api/design/visibility.ts +143 -143
- package/src/api/design/windows/index.ts +351 -333
- package/src/api/entity/buildableEnvelope.ts +397 -322
- package/src/api/entity/index.ts +30 -30
- package/src/api/entity/referenceLine.ts +235 -235
- package/src/api/entity/space.ts +612 -612
- package/src/api/entity/story.ts +517 -517
- package/src/api/index.ts +47 -47
- package/src/api/presentation/aiInspiration.ts +1116 -1116
- package/src/api/presentation/annotate.ts +417 -385
- package/src/api/presentation/camera.ts +289 -289
- package/src/api/presentation/diagrams.ts +194 -194
- package/src/api/presentation/drawingContract.ts +70 -0
- package/src/api/presentation/drawings.ts +1179 -0
- package/src/api/presentation/export.ts +134 -108
- package/src/api/presentation/import.ts +159 -159
- package/src/api/presentation/index.ts +160 -135
- package/src/api/presentation/placedViews.ts +1211 -1120
- package/src/api/presentation/sections.ts +420 -420
- package/src/api/presentation/shapes.ts +274 -274
- package/src/api/presentation/sheets.ts +746 -585
- package/src/api/presentation/slideshow.ts +134 -134
- package/src/api/presentation/tables.ts +84 -84
- package/src/api/presentation/viewPresets.ts +241 -0
- package/src/api/presentation/views.ts +742 -673
- package/src/api/presentation/walkthroughs.ts +1201 -1201
- package/src/api/program/adjacency.ts +164 -164
- package/src/api/program/areas.ts +408 -408
- package/src/api/program/classification.ts +138 -138
- package/src/api/program/cores.ts +83 -83
- package/src/api/program/departments.ts +517 -517
- package/src/api/program/index.ts +73 -73
- package/src/api/program/labels.ts +332 -332
- package/src/api/program/layout.ts +422 -422
- package/src/api/program/metadata.ts +364 -364
- package/src/api/program/metrics.ts +120 -120
- package/src/api/program/site.ts +748 -748
- package/src/api/program/spreadsheet.ts +2698 -2698
- package/src/api/workspace/index.ts +612 -612
- package/src/errors/codes.ts +143 -136
- package/src/errors/envelope.ts +75 -75
- package/src/errors/index.ts +21 -21
- package/src/errors/plugin-error.ts +134 -134
- package/src/handles.ts +297 -297
- package/src/host-utils.ts +67 -67
- package/src/index.ts +7 -7
- package/src/massParameters.ops.ts +246 -246
- package/src/massParameters.ts +427 -427
- package/src/types.ts +16 -16
- package/test/drawingContract.test.mjs +288 -0
- package/test/errors.test.mjs +185 -184
- package/test/massParameters.test.mjs +952 -952
- package/test/presentationViewSettings.test.mjs +85 -0
- package/tsconfig.json +22 -22
- package/tsup.config.ts +12 -12
|
@@ -1,667 +1,696 @@
|
|
|
1
|
-
import * as z from "zod"
|
|
2
|
-
import { PluginApiReturn } from "../../../types"
|
|
3
|
-
import { Vec3Components, Vec3Handle } from "../../../handles"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Camera controls.
|
|
7
|
-
*
|
|
8
|
-
* Position the viewport camera, snap it to a standard orthographic/isometric
|
|
9
|
-
* view, and toggle between the 2D (plan) and 3D modelling modes — mirrors the
|
|
10
|
-
* canvas view menu and the 2D/3D toggle. Like {@linkcode PluginZoomApi}, these
|
|
11
|
-
* are transient VIEW-STATE changes: they are not model edits, so they are not
|
|
12
|
-
* write-gated and are not undoable. Accessed via `snaptrude.core.camera`.
|
|
13
|
-
*
|
|
14
|
-
* Read and set the full camera pose (`getPose`/`setPose`), walk and turn it the
|
|
15
|
-
* way the arrow keys do (`move`/`rotate`), and read or change the arrow-key
|
|
16
|
-
* navigation settings (`getNavigationSettings`/`updateNavigationSettings`).
|
|
17
|
-
* Positions are world coordinates in internal `babylon` units (1 unit =
|
|
18
|
-
* 0.254 m, Y up); yaw is degrees clockwise from +z seen from above, pitch is
|
|
19
|
-
* degrees above level.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* `
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
115
|
-
*
|
|
116
|
-
* @examplePrompt
|
|
117
|
-
* @examplePrompt
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* @examplePrompt
|
|
164
|
-
* @examplePrompt
|
|
165
|
-
* @examplePrompt
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* await snaptrude.core.camera.
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
public abstract
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* @
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* @
|
|
234
|
-
* @
|
|
235
|
-
* @
|
|
236
|
-
* @
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* @
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* @
|
|
306
|
-
* @
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
options?:
|
|
322
|
-
): PluginApiReturn<PluginCameraPose>
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* @
|
|
333
|
-
* @
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
*
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
export
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
* {@linkcode PluginCameraApi.
|
|
468
|
-
*
|
|
469
|
-
* | Property | Type | Description |
|
|
470
|
-
* |---|---|---|
|
|
471
|
-
* | `
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
z
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
* |
|
|
525
|
-
*
|
|
526
|
-
* | `
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
*
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
export
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
*
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
export
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { Vec3Components, Vec3Handle } from "../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Camera controls.
|
|
7
|
+
*
|
|
8
|
+
* Position the viewport camera, snap it to a standard orthographic/isometric
|
|
9
|
+
* view, and toggle between the 2D (plan) and 3D modelling modes — mirrors the
|
|
10
|
+
* canvas view menu and the 2D/3D toggle. Like {@linkcode PluginZoomApi}, these
|
|
11
|
+
* are transient VIEW-STATE changes: they are not model edits, so they are not
|
|
12
|
+
* write-gated and are not undoable. Accessed via `snaptrude.core.camera`.
|
|
13
|
+
*
|
|
14
|
+
* Read and set the full camera pose (`getPose`/`setPose`), walk and turn it the
|
|
15
|
+
* way the arrow keys do (`move`/`rotate`), and read or change the arrow-key
|
|
16
|
+
* navigation settings (`getNavigationSettings`/`updateNavigationSettings`).
|
|
17
|
+
* Positions are world coordinates in internal `babylon` units (1 unit =
|
|
18
|
+
* 0.254 m, Y up); yaw is degrees clockwise from +z seen from above, pitch is
|
|
19
|
+
* degrees above level.
|
|
20
|
+
*
|
|
21
|
+
* While Present mode is open these calls set the Design frame a view saved in
|
|
22
|
+
* Present (`presentation.views.create`) is taken from; they never move the
|
|
23
|
+
* Present sheet canvas. To pan, zoom or screenshot the Present canvas, use
|
|
24
|
+
* {@linkcode PluginPresentationCameraApi} (`presentation.camera`).
|
|
25
|
+
*/
|
|
26
|
+
export abstract class PluginCameraApi {
|
|
27
|
+
constructor() {}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Point the camera: place its eye at `eye` looking toward `target` (world
|
|
31
|
+
* coordinates, internal `babylon` units). View-state only — not undoable.
|
|
32
|
+
*
|
|
33
|
+
* While Present is open this sets the Design frame a view saved in Present
|
|
34
|
+
* is taken from; it never moves the Present sheet canvas; use
|
|
35
|
+
* `presentation.camera` for that.
|
|
36
|
+
*
|
|
37
|
+
* @param eye - Camera position as a {@linkcode Vec3Handle}
|
|
38
|
+
* @param target - Point the camera looks at as a {@linkcode Vec3Handle}
|
|
39
|
+
* @returns `true` once the camera has been positioned.
|
|
40
|
+
*
|
|
41
|
+
* @examplePrompt Look at the model from above the north-east corner
|
|
42
|
+
* @examplePrompt Position the camera at (50, 30, 50) looking at the origin
|
|
43
|
+
* @examplePrompt Point the camera at the centre of the building from the side
|
|
44
|
+
* @examplePrompt Set the eye to this point and aim it at that point
|
|
45
|
+
*
|
|
46
|
+
* # Example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const { vec3 } = snaptrude.core.math
|
|
49
|
+
* await snaptrude.core.camera.lookFrom(vec3.new(50, 30, 50), vec3.new(0, 0, 0))
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
public abstract lookFrom(
|
|
53
|
+
eye: Vec3Handle,
|
|
54
|
+
target: Vec3Handle,
|
|
55
|
+
): PluginApiReturn<boolean>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Snap the camera to a standard view — the five orthographic elevations
|
|
59
|
+
* (`top` / `front` / `back` / `left` / `right`) or the 3D `iso` (isometric
|
|
60
|
+
* perspective) view. Mirrors the canvas view menu. View-state only — not
|
|
61
|
+
* undoable. The orthographic presets exit 2D mode first if needed.
|
|
62
|
+
*
|
|
63
|
+
* While Present is open this sets the Design frame a view saved in Present
|
|
64
|
+
* is taken from; it never moves the Present sheet canvas; use
|
|
65
|
+
* `presentation.camera` for that.
|
|
66
|
+
*
|
|
67
|
+
* @param view - The standard view to snap to ({@linkcode PluginStandardView})
|
|
68
|
+
* @returns `true` once the view has been applied.
|
|
69
|
+
*
|
|
70
|
+
* @examplePrompt Switch to the top view
|
|
71
|
+
* @examplePrompt Show me the front elevation
|
|
72
|
+
* @examplePrompt Go to the isometric view
|
|
73
|
+
* @examplePrompt Look at the model from the left
|
|
74
|
+
* @examplePrompt Give me a plan view from the top
|
|
75
|
+
*
|
|
76
|
+
* # Example
|
|
77
|
+
* ```ts
|
|
78
|
+
* await snaptrude.core.camera.setStandardView("top")
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
public abstract setStandardView(
|
|
82
|
+
view: PluginStandardView,
|
|
83
|
+
): PluginApiReturn<boolean>
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get the current camera mode. Paired with {@linkcode PluginCameraApi.setMode}.
|
|
87
|
+
*
|
|
88
|
+
* @returns `"2d"` when the editor is in plan view, `"3d"` otherwise.
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt Am I in 2D or 3D?
|
|
91
|
+
* @examplePrompt What view mode is the editor in?
|
|
92
|
+
*
|
|
93
|
+
* # Example
|
|
94
|
+
* ```ts
|
|
95
|
+
* if ((await snaptrude.core.camera.getMode()) === "2d") {
|
|
96
|
+
* await snaptrude.core.camera.setMode("3d")
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
public abstract getMode(): PluginApiReturn<PluginCameraMode>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Toggle the modelling mode between `2d` (plan) and `3d`. Mirrors the canvas
|
|
104
|
+
* 2D/3D toggle: `3d` enters the isometric perspective view, `2d` drops to the
|
|
105
|
+
* orthographic plan of the active storey. View-state only — not undoable.
|
|
106
|
+
*
|
|
107
|
+
* While Present is open this sets the Design frame a view saved in Present
|
|
108
|
+
* is taken from; it never moves the Present sheet canvas; use
|
|
109
|
+
* `presentation.camera` for that.
|
|
110
|
+
*
|
|
111
|
+
* @param mode - `"2d"` or `"3d"` ({@linkcode PluginCameraMode})
|
|
112
|
+
* @returns `true` once the mode switch has been requested.
|
|
113
|
+
*
|
|
114
|
+
* @examplePrompt Switch to 3D view
|
|
115
|
+
* @examplePrompt Drop into 2D plan mode
|
|
116
|
+
* @examplePrompt Go back to 3D
|
|
117
|
+
* @examplePrompt Show the floor plan in 2D
|
|
118
|
+
*
|
|
119
|
+
* # Example
|
|
120
|
+
* ```ts
|
|
121
|
+
* await snaptrude.core.camera.setMode("3d")
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
public abstract setMode(mode: PluginCameraMode): PluginApiReturn<boolean>
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Read the camera's current projection: `"perspective"` (the default 3D
|
|
128
|
+
* view) or `"orthographic"`. In 2D (plan) mode this always reports
|
|
129
|
+
* `"orthographic"` — a plan is an orthographic projection.
|
|
130
|
+
*
|
|
131
|
+
* @returns The current {@linkcode PluginCameraProjection}.
|
|
132
|
+
*
|
|
133
|
+
* @examplePrompt Is the camera in perspective or orthographic?
|
|
134
|
+
* @examplePrompt What projection is the 3D view using?
|
|
135
|
+
* @examplePrompt Check whether perspective is on
|
|
136
|
+
*
|
|
137
|
+
* # Example
|
|
138
|
+
* ```ts
|
|
139
|
+
* const projection = await snaptrude.core.camera.getProjection()
|
|
140
|
+
* console.log(projection) // "perspective" | "orthographic"
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
public abstract getProjection(): PluginApiReturn<PluginCameraProjection>
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Switch the 3D camera between `"perspective"` and `"orthographic"`
|
|
147
|
+
* projection — the Perspective/Orthographic control in the Design tab's
|
|
148
|
+
* View Settings panel. Like {@linkcode PluginCameraApi.setMode}, this is a
|
|
149
|
+
* transient view-state change: not write-gated, not undoable.
|
|
150
|
+
*
|
|
151
|
+
* In 2D (plan) mode the canvas is always an orthographic plan:
|
|
152
|
+
* `"orthographic"` is accepted as a no-op, while `"perspective"` is
|
|
153
|
+
* rejected — switch to 3D first via `setMode("3d")`.
|
|
154
|
+
*
|
|
155
|
+
* While Present is open this sets the Design frame a view saved in Present
|
|
156
|
+
* is taken from; it never moves the Present sheet canvas; use
|
|
157
|
+
* `presentation.camera` for that.
|
|
158
|
+
*
|
|
159
|
+
* @param projection - `"perspective"` or `"orthographic"` ({@linkcode PluginCameraProjection})
|
|
160
|
+
* @returns `true` once the projection has been applied.
|
|
161
|
+
*
|
|
162
|
+
* @examplePrompt Switch the camera to orthographic
|
|
163
|
+
* @examplePrompt Turn perspective off
|
|
164
|
+
* @examplePrompt Give me a perspective view of the model
|
|
165
|
+
* @examplePrompt Make the 3D view orthographic like an axonometric drawing
|
|
166
|
+
*
|
|
167
|
+
* # Example
|
|
168
|
+
* ```ts
|
|
169
|
+
* await snaptrude.core.camera.setProjection("orthographic")
|
|
170
|
+
* const projection = await snaptrude.core.camera.getProjection() // "orthographic"
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
public abstract setProjection(
|
|
174
|
+
projection: PluginCameraProjection,
|
|
175
|
+
): PluginApiReturn<boolean>
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Zoom (fit) the camera to all geometry in the scene — the "zoom extents"
|
|
179
|
+
* action. View-state only — not undoable. Canonical home of the zoom-extents
|
|
180
|
+
* read (the deprecated `core.zoom.extents`).
|
|
181
|
+
*
|
|
182
|
+
* While Present is open this sets the Design frame a view saved in Present
|
|
183
|
+
* is taken from; it never moves the Present sheet canvas; use
|
|
184
|
+
* `presentation.camera` for that.
|
|
185
|
+
*
|
|
186
|
+
* @returns `true` once the camera has been framed to the scene.
|
|
187
|
+
*
|
|
188
|
+
* @examplePrompt Zoom out so I can see the whole model
|
|
189
|
+
* @examplePrompt Fit everything in the view
|
|
190
|
+
* @examplePrompt Frame the entire building in the viewport
|
|
191
|
+
* @examplePrompt Do a zoom extents on the canvas
|
|
192
|
+
*
|
|
193
|
+
* # Example
|
|
194
|
+
* ```ts
|
|
195
|
+
* await snaptrude.core.camera.zoomExtents()
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
public abstract zoomExtents(): PluginApiReturn<boolean>
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Zoom (fit) the camera to the current selection. View-state only — not
|
|
202
|
+
* undoable. Canonical home of the zoom-to-selection read (the deprecated
|
|
203
|
+
* `core.zoom.selection`).
|
|
204
|
+
*
|
|
205
|
+
* While Present is open this sets the Design frame a view saved in Present
|
|
206
|
+
* is taken from; it never moves the Present sheet canvas; use
|
|
207
|
+
* `presentation.camera` for that.
|
|
208
|
+
*
|
|
209
|
+
* @returns `true` if there was a selection to frame; `false` if nothing is
|
|
210
|
+
* selected (no-op).
|
|
211
|
+
*
|
|
212
|
+
* @examplePrompt Zoom in on what I have selected
|
|
213
|
+
* @examplePrompt Frame the selected walls in the view
|
|
214
|
+
* @examplePrompt Focus the camera on my current selection
|
|
215
|
+
* @examplePrompt Fit the view to the selected room
|
|
216
|
+
*
|
|
217
|
+
* # Example
|
|
218
|
+
* ```ts
|
|
219
|
+
* await snaptrude.core.camera.zoomSelection()
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
public abstract zoomSelection(): PluginApiReturn<boolean>
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Read where the camera is and where it looks: the eye and target positions
|
|
226
|
+
* (world coordinates, internal `babylon` units), the view direction as yaw
|
|
227
|
+
* and pitch, the vertical field of view, the projection and the 2D/3D mode.
|
|
228
|
+
* Paired with {@linkcode PluginCameraApi.setPose}.
|
|
229
|
+
*
|
|
230
|
+
* @returns The current {@linkcode PluginCameraPose}.
|
|
231
|
+
* @throws PRECONDITION_FAILED when there is no active camera.
|
|
232
|
+
*
|
|
233
|
+
* @examplePrompt Where is the camera right now?
|
|
234
|
+
* @examplePrompt Remember this viewpoint so we can come back to it
|
|
235
|
+
* @examplePrompt Which way is the camera facing?
|
|
236
|
+
* @examplePrompt How high above the ground is the camera?
|
|
237
|
+
*
|
|
238
|
+
* # Example
|
|
239
|
+
* ```ts
|
|
240
|
+
* const pose = await snaptrude.core.camera.getPose()
|
|
241
|
+
* console.log(pose.eye, pose.yawInDegrees, pose.pitchInDegrees)
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
public abstract getPose(): PluginApiReturn<PluginCameraPose>
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Place the camera, optionally easing there over `options.durationInSeconds`,
|
|
248
|
+
* and resolve once the new view has been drawn, so a capture that follows sees
|
|
249
|
+
* it without a fixed wait. `pose` is one of:
|
|
250
|
+
*
|
|
251
|
+
* - `{ eye, target }`: stand at `eye` looking at `target`, as
|
|
252
|
+
* {@linkcode PluginCameraApi.lookFrom} does with handles;
|
|
253
|
+
* - `{ eye, yawInDegrees, pitchInDegrees }`: stand at `eye` looking along a
|
|
254
|
+
* direction;
|
|
255
|
+
* - `{ standAt, yawInDegrees? }`: stand on the floor, stair, terrain or
|
|
256
|
+
* ground at or below `standAt`, at the user's eye height above it (the `I`
|
|
257
|
+
* key), facing `yawInDegrees` (the current yaw when omitted).
|
|
258
|
+
*
|
|
259
|
+
* Stops a playing walkthrough and switches from 2D plan view to 3D first.
|
|
260
|
+
* View-state only: not write-gated, not undoable.
|
|
261
|
+
*
|
|
262
|
+
* @param pose - Where to put the camera ({@linkcode PluginCameraPoseInput})
|
|
263
|
+
* @param options - `durationInSeconds`: ease over this long (0 to 10, default 0 jumps)
|
|
264
|
+
* @returns The camera's {@linkcode PluginCameraPose} once it has arrived.
|
|
265
|
+
* @throws PRECONDITION_FAILED when there is no active camera, while a
|
|
266
|
+
* walkthrough export is recording, or when `standAt` lies below the ground
|
|
267
|
+
* with nothing under it. VALIDATION when `eye` and `target` coincide or a
|
|
268
|
+
* pitch is beyond ±89°.
|
|
269
|
+
*
|
|
270
|
+
* @examplePrompt Stand in the living room at eye level facing the window
|
|
271
|
+
* @examplePrompt Move the camera to (40, 12, 30) looking at the entrance
|
|
272
|
+
* @examplePrompt Fly the camera smoothly over to the courtyard
|
|
273
|
+
* @examplePrompt Put me back at the viewpoint we saved earlier
|
|
274
|
+
*
|
|
275
|
+
* # Example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const { camera } = snaptrude.core
|
|
278
|
+
* await camera.setPose({ standAt: { x: 20, y: 0, z: 35 }, yawInDegrees: 90 })
|
|
279
|
+
* await camera.setPose(
|
|
280
|
+
* { eye: { x: 60, y: 25, z: 60 }, target: { x: 0, y: 5, z: 0 } },
|
|
281
|
+
* { durationInSeconds: 1.5 },
|
|
282
|
+
* )
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
public abstract setPose(
|
|
286
|
+
pose: PluginCameraPoseInput,
|
|
287
|
+
options?: PluginCameraSetPoseOptions,
|
|
288
|
+
): PluginApiReturn<PluginCameraPose>
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Walk or fly the camera by a displacement in its own frame: `forward` along
|
|
292
|
+
* the level view direction, `right` to its side and `up` vertically, in
|
|
293
|
+
* internal `babylon` units. The view direction does not change. With
|
|
294
|
+
* `options.followsFloor` the camera keeps its height above the floor as it
|
|
295
|
+
* goes, climbing and descending stairs and ramps the way the arrow keys do.
|
|
296
|
+
* Stops a playing walkthrough and switches from 2D plan view to 3D first.
|
|
297
|
+
* View-state only: not write-gated, not undoable.
|
|
298
|
+
*
|
|
299
|
+
* @param displacement - {@linkcode PluginCameraMoveDisplacement}; omitted components are 0
|
|
300
|
+
* @param options - `followsFloor` (default `false`) and `durationInSeconds` (0 to 10, default 0)
|
|
301
|
+
* @returns The camera's {@linkcode PluginCameraPose} after the move.
|
|
302
|
+
* @throws PRECONDITION_FAILED when there is no active camera, or while a
|
|
303
|
+
* walkthrough export is recording.
|
|
304
|
+
*
|
|
305
|
+
* @examplePrompt Walk forward 3 metres
|
|
306
|
+
* @examplePrompt Step to the right a little
|
|
307
|
+
* @examplePrompt Walk up the stairs ahead
|
|
308
|
+
* @examplePrompt Raise the camera by 2 metres
|
|
309
|
+
*
|
|
310
|
+
* # Example
|
|
311
|
+
* ```ts
|
|
312
|
+
* const metre = 1 / 0.254
|
|
313
|
+
* await snaptrude.core.camera.move(
|
|
314
|
+
* { forward: 3 * metre },
|
|
315
|
+
* { followsFloor: true, durationInSeconds: 2 },
|
|
316
|
+
* )
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
public abstract move(
|
|
320
|
+
displacement: PluginCameraMoveDisplacement,
|
|
321
|
+
options?: PluginCameraMoveOptions,
|
|
322
|
+
): PluginApiReturn<PluginCameraPose>
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Turn the camera in place by signed angles: `yawInDegrees` to the right
|
|
326
|
+
* (clockwise seen from above) and `pitchInDegrees` up. The eye does not move;
|
|
327
|
+
* the resulting pitch is kept within ±89°. Stops a playing walkthrough and
|
|
328
|
+
* switches from 2D plan view to 3D first. View-state only: not write-gated,
|
|
329
|
+
* not undoable.
|
|
330
|
+
*
|
|
331
|
+
* @param yawInDegrees - Turn to the right by this much (negative turns left)
|
|
332
|
+
* @param pitchInDegrees - Tilt up by this much (negative tilts down; default 0)
|
|
333
|
+
* @param options - `durationInSeconds` (0 to 10, default 0)
|
|
334
|
+
* @returns The camera's {@linkcode PluginCameraPose} after turning.
|
|
335
|
+
* @throws PRECONDITION_FAILED when there is no active camera, or while a
|
|
336
|
+
* walkthrough export is recording.
|
|
337
|
+
*
|
|
338
|
+
* @examplePrompt Turn around
|
|
339
|
+
* @examplePrompt Look 45 degrees to the left
|
|
340
|
+
* @examplePrompt Tilt the camera down a bit
|
|
341
|
+
*
|
|
342
|
+
* # Example
|
|
343
|
+
* ```ts
|
|
344
|
+
* await snaptrude.core.camera.rotate(180, 0, { durationInSeconds: 1 })
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
public abstract rotate(
|
|
348
|
+
yawInDegrees: number,
|
|
349
|
+
pitchInDegrees?: number,
|
|
350
|
+
options?: PluginCameraRotateOptions,
|
|
351
|
+
): PluginApiReturn<PluginCameraPose>
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Read the arrow-key navigation settings: whether the arrow keys walk the
|
|
355
|
+
* camera, the eye height used by `setPose`'s `standAt` and by walkthroughs
|
|
356
|
+
* that follow the floor, the walking speed, and whether walking stops at
|
|
357
|
+
* walls. Paired with {@linkcode PluginCameraApi.updateNavigationSettings}.
|
|
358
|
+
*
|
|
359
|
+
* @returns The current {@linkcode PluginCameraNavigationSettings}.
|
|
360
|
+
*
|
|
361
|
+
* @examplePrompt Is arrow-key navigation on?
|
|
362
|
+
* @examplePrompt What eye height does the camera use?
|
|
363
|
+
*
|
|
364
|
+
* # Example
|
|
365
|
+
* ```ts
|
|
366
|
+
* const { isKeyboardNavigationEnabled } =
|
|
367
|
+
* await snaptrude.core.camera.getNavigationSettings()
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
public abstract getNavigationSettings(): PluginApiReturn<PluginCameraNavigationSettings>
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Change arrow-key navigation settings; only the fields given change.
|
|
374
|
+
* `isKeyboardNavigationEnabled` is the user's Project Settings switch and is
|
|
375
|
+
* saved on this device; the other settings last for the session.
|
|
376
|
+
* Write-gated: this changes the user's preferences, not just the view.
|
|
377
|
+
*
|
|
378
|
+
* @param patch - The settings to change ({@linkcode PluginCameraNavigationSettingsPatch})
|
|
379
|
+
* @returns The {@linkcode PluginCameraNavigationSettings} after the change.
|
|
380
|
+
* @throws METHOD_NOT_PERMITTED when plugin writes are disabled.
|
|
381
|
+
*
|
|
382
|
+
* @examplePrompt Turn off arrow-key navigation
|
|
383
|
+
* @examplePrompt Use a 1.6 m eye height
|
|
384
|
+
* @examplePrompt Make walking stop at walls
|
|
385
|
+
*
|
|
386
|
+
* # Example
|
|
387
|
+
* ```ts
|
|
388
|
+
* await snaptrude.core.camera.updateNavigationSettings({
|
|
389
|
+
* eyeHeight: 1.6 / 0.254,
|
|
390
|
+
* isCollisionEnabled: true,
|
|
391
|
+
* })
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
public abstract updateNavigationSettings(
|
|
395
|
+
patch: PluginCameraNavigationSettingsPatch,
|
|
396
|
+
): PluginApiReturn<PluginCameraNavigationSettings>
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* A standard camera view: the five orthographic elevations (`top`/`front`/
|
|
401
|
+
* `back`/`left`/`right`) or the 3D isometric perspective (`iso`).
|
|
402
|
+
*/
|
|
403
|
+
export const PluginStandardView = z.enum([
|
|
404
|
+
"top",
|
|
405
|
+
"front",
|
|
406
|
+
"back",
|
|
407
|
+
"left",
|
|
408
|
+
"right",
|
|
409
|
+
"iso",
|
|
410
|
+
])
|
|
411
|
+
export type PluginStandardView = z.infer<typeof PluginStandardView>
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* The modelling mode: `2d` (orthographic plan) or `3d` (isometric perspective).
|
|
415
|
+
*/
|
|
416
|
+
export const PluginCameraMode = z.enum(["2d", "3d"])
|
|
417
|
+
export type PluginCameraMode = z.infer<typeof PluginCameraMode>
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* The 3D camera projection: `perspective` (the default) or `orthographic` —
|
|
421
|
+
* the Perspective/Orthographic control in the Design tab's View Settings panel.
|
|
422
|
+
*/
|
|
423
|
+
export const PluginCameraProjection = z.enum(["perspective", "orthographic"])
|
|
424
|
+
export type PluginCameraProjection = z.infer<typeof PluginCameraProjection>
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Arguments for {@linkcode PluginCameraApi.lookFrom}.
|
|
428
|
+
*
|
|
429
|
+
* | Property | Type | Description |
|
|
430
|
+
* |---|---|---|
|
|
431
|
+
* | `eye` | {@linkcode Vec3Handle} | Camera position (world, `babylon` units) |
|
|
432
|
+
* | `target` | {@linkcode Vec3Handle} | Point the camera looks at |
|
|
433
|
+
*/
|
|
434
|
+
export const PluginCameraLookFromArgs = z.object({
|
|
435
|
+
eye: Vec3Handle,
|
|
436
|
+
target: Vec3Handle,
|
|
437
|
+
})
|
|
438
|
+
export type PluginCameraLookFromArgs = z.infer<typeof PluginCameraLookFromArgs>
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Arguments for {@linkcode PluginCameraApi.setStandardView}.
|
|
442
|
+
*
|
|
443
|
+
* | Property | Type | Description |
|
|
444
|
+
* |---|---|---|
|
|
445
|
+
* | `view` | {@linkcode PluginStandardView} | The standard view to snap to |
|
|
446
|
+
*/
|
|
447
|
+
export const PluginCameraSetStandardViewArgs = z.object({
|
|
448
|
+
view: PluginStandardView,
|
|
449
|
+
})
|
|
450
|
+
export type PluginCameraSetStandardViewArgs = z.infer<
|
|
451
|
+
typeof PluginCameraSetStandardViewArgs
|
|
452
|
+
>
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Arguments for {@linkcode PluginCameraApi.setMode}.
|
|
456
|
+
*
|
|
457
|
+
* | Property | Type | Description |
|
|
458
|
+
* |---|---|---|
|
|
459
|
+
* | `mode` | {@linkcode PluginCameraMode} | `"2d"` or `"3d"` |
|
|
460
|
+
*/
|
|
461
|
+
export const PluginCameraSetModeArgs = z.object({
|
|
462
|
+
mode: PluginCameraMode,
|
|
463
|
+
})
|
|
464
|
+
export type PluginCameraSetModeArgs = z.infer<typeof PluginCameraSetModeArgs>
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Arguments for {@linkcode PluginCameraApi.setProjection}.
|
|
468
|
+
*
|
|
469
|
+
* | Property | Type | Description |
|
|
470
|
+
* |---|---|---|
|
|
471
|
+
* | `projection` | {@linkcode PluginCameraProjection} | `"perspective"` or `"orthographic"` |
|
|
472
|
+
*/
|
|
473
|
+
export const PluginCameraSetProjectionArgs = z.object({
|
|
474
|
+
projection: PluginCameraProjection,
|
|
475
|
+
})
|
|
476
|
+
export type PluginCameraSetProjectionArgs = z.infer<
|
|
477
|
+
typeof PluginCameraSetProjectionArgs
|
|
478
|
+
>
|
|
479
|
+
|
|
480
|
+
// Plain {x, y, z} record with finite components (the brepFromRevolution `axisOrigin` pattern).
|
|
481
|
+
const FiniteVec3Components = z.object({
|
|
482
|
+
x: z.number().finite(),
|
|
483
|
+
y: z.number().finite(),
|
|
484
|
+
z: z.number().finite(),
|
|
485
|
+
})
|
|
486
|
+
|
|
487
|
+
/** Pitch is kept off the vertical, where yaw has no meaning. */
|
|
488
|
+
const PitchInDegrees = z.number().finite().min(-89).max(89)
|
|
489
|
+
|
|
490
|
+
/** How long a camera move eases for; 0 jumps. */
|
|
491
|
+
const DurationInSeconds = z.number().finite().min(0).max(10)
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* The camera's pose — result of {@linkcode PluginCameraApi.getPose},
|
|
495
|
+
* {@linkcode PluginCameraApi.setPose}, {@linkcode PluginCameraApi.move} and
|
|
496
|
+
* {@linkcode PluginCameraApi.rotate}.
|
|
497
|
+
*
|
|
498
|
+
* | Property | Type | Description |
|
|
499
|
+
* |---|---|---|
|
|
500
|
+
* | `eye` | `{ x, y, z }` | Camera position (world, `babylon` units) |
|
|
501
|
+
* | `target` | `{ x, y, z }` | Point the camera looks at |
|
|
502
|
+
* | `yawInDegrees` | `number` | View direction, degrees clockwise from +z seen from above (-180 to 180) |
|
|
503
|
+
* | `pitchInDegrees` | `number` | View direction, degrees above level (negative looks down) |
|
|
504
|
+
* | `fieldOfViewInDegrees` | `number` | Vertical field of view |
|
|
505
|
+
* | `projection` | {@linkcode PluginCameraProjection} | `"perspective"` or `"orthographic"` |
|
|
506
|
+
* | `mode` | {@linkcode PluginCameraMode} | `"2d"` or `"3d"` |
|
|
507
|
+
*/
|
|
508
|
+
export const PluginCameraPose = z.object({
|
|
509
|
+
eye: Vec3Components,
|
|
510
|
+
target: Vec3Components,
|
|
511
|
+
yawInDegrees: z.number(),
|
|
512
|
+
pitchInDegrees: z.number(),
|
|
513
|
+
fieldOfViewInDegrees: z.number(),
|
|
514
|
+
projection: PluginCameraProjection,
|
|
515
|
+
mode: PluginCameraMode,
|
|
516
|
+
})
|
|
517
|
+
export type PluginCameraPose = z.infer<typeof PluginCameraPose>
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Where {@linkcode PluginCameraApi.setPose} puts the camera — exactly one of:
|
|
521
|
+
*
|
|
522
|
+
* | Shape | Meaning |
|
|
523
|
+
* |---|---|
|
|
524
|
+
* | `{ eye, target }` | Stand at `eye` looking at `target` |
|
|
525
|
+
* | `{ eye, yawInDegrees, pitchInDegrees }` | Stand at `eye` looking along a direction (pitch within ±89°) |
|
|
526
|
+
* | `{ standAt, yawInDegrees? }` | Stand at eye height on the floor, stair, terrain or ground at or below `standAt`, facing `yawInDegrees` (default: current yaw) |
|
|
527
|
+
*
|
|
528
|
+
* Points are plain `{ x, y, z }` world coordinates in `babylon` units.
|
|
529
|
+
*/
|
|
530
|
+
export const PluginCameraPoseInput = z.union([
|
|
531
|
+
z
|
|
532
|
+
.object({ eye: FiniteVec3Components, target: FiniteVec3Components })
|
|
533
|
+
.strict(),
|
|
534
|
+
z
|
|
535
|
+
.object({
|
|
536
|
+
eye: FiniteVec3Components,
|
|
537
|
+
yawInDegrees: z.number().finite(),
|
|
538
|
+
pitchInDegrees: PitchInDegrees,
|
|
539
|
+
})
|
|
540
|
+
.strict(),
|
|
541
|
+
z
|
|
542
|
+
.object({
|
|
543
|
+
standAt: FiniteVec3Components,
|
|
544
|
+
yawInDegrees: z.number().finite().optional(),
|
|
545
|
+
})
|
|
546
|
+
.strict(),
|
|
547
|
+
])
|
|
548
|
+
export type PluginCameraPoseInput = z.infer<typeof PluginCameraPoseInput>
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Options for {@linkcode PluginCameraApi.setPose}.
|
|
552
|
+
*
|
|
553
|
+
* | Property | Type | Description |
|
|
554
|
+
* |---|---|---|
|
|
555
|
+
* | `durationInSeconds` | `number \| undefined` | Ease to the pose over this long (0 to 10; default 0 jumps) |
|
|
556
|
+
*/
|
|
557
|
+
export const PluginCameraSetPoseOptions = z
|
|
558
|
+
.object({ durationInSeconds: DurationInSeconds.optional() })
|
|
559
|
+
.strict()
|
|
560
|
+
export type PluginCameraSetPoseOptions = z.infer<
|
|
561
|
+
typeof PluginCameraSetPoseOptions
|
|
562
|
+
>
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Arguments for {@linkcode PluginCameraApi.setPose}.
|
|
566
|
+
*/
|
|
567
|
+
export const PluginCameraSetPoseArgs = z.object({
|
|
568
|
+
pose: PluginCameraPoseInput,
|
|
569
|
+
options: PluginCameraSetPoseOptions.optional(),
|
|
570
|
+
})
|
|
571
|
+
export type PluginCameraSetPoseArgs = z.infer<typeof PluginCameraSetPoseArgs>
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* A displacement in the camera's own frame, for {@linkcode PluginCameraApi.move}
|
|
575
|
+
* (`babylon` units; omitted components are 0).
|
|
576
|
+
*
|
|
577
|
+
* | Property | Type | Description |
|
|
578
|
+
* |---|---|---|
|
|
579
|
+
* | `forward` | `number \| undefined` | Along the level view direction (negative walks back) |
|
|
580
|
+
* | `right` | `number \| undefined` | To the camera's right (negative steps left) |
|
|
581
|
+
* | `up` | `number \| undefined` | Vertically (negative descends) |
|
|
582
|
+
*/
|
|
583
|
+
export const PluginCameraMoveDisplacement = z
|
|
584
|
+
.object({
|
|
585
|
+
forward: z.number().finite().optional(),
|
|
586
|
+
right: z.number().finite().optional(),
|
|
587
|
+
up: z.number().finite().optional(),
|
|
588
|
+
})
|
|
589
|
+
.strict()
|
|
590
|
+
export type PluginCameraMoveDisplacement = z.infer<
|
|
591
|
+
typeof PluginCameraMoveDisplacement
|
|
592
|
+
>
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Options for {@linkcode PluginCameraApi.move}.
|
|
596
|
+
*
|
|
597
|
+
* | Property | Type | Description |
|
|
598
|
+
* |---|---|---|
|
|
599
|
+
* | `followsFloor` | `boolean \| undefined` | Keep the height above the floor, climbing stairs and ramps (default `false`) |
|
|
600
|
+
* | `durationInSeconds` | `number \| undefined` | Walk over this long (0 to 10; default 0 jumps) |
|
|
601
|
+
*/
|
|
602
|
+
export const PluginCameraMoveOptions = z
|
|
603
|
+
.object({
|
|
604
|
+
followsFloor: z.boolean().optional(),
|
|
605
|
+
durationInSeconds: DurationInSeconds.optional(),
|
|
606
|
+
})
|
|
607
|
+
.strict()
|
|
608
|
+
export type PluginCameraMoveOptions = z.infer<typeof PluginCameraMoveOptions>
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Arguments for {@linkcode PluginCameraApi.move}.
|
|
612
|
+
*/
|
|
613
|
+
export const PluginCameraMoveArgs = z.object({
|
|
614
|
+
displacement: PluginCameraMoveDisplacement,
|
|
615
|
+
options: PluginCameraMoveOptions.optional(),
|
|
616
|
+
})
|
|
617
|
+
export type PluginCameraMoveArgs = z.infer<typeof PluginCameraMoveArgs>
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Options for {@linkcode PluginCameraApi.rotate}.
|
|
621
|
+
*
|
|
622
|
+
* | Property | Type | Description |
|
|
623
|
+
* |---|---|---|
|
|
624
|
+
* | `durationInSeconds` | `number \| undefined` | Turn over this long (0 to 10; default 0 jumps) |
|
|
625
|
+
*/
|
|
626
|
+
export const PluginCameraRotateOptions = z
|
|
627
|
+
.object({ durationInSeconds: DurationInSeconds.optional() })
|
|
628
|
+
.strict()
|
|
629
|
+
export type PluginCameraRotateOptions = z.infer<
|
|
630
|
+
typeof PluginCameraRotateOptions
|
|
631
|
+
>
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Arguments for {@linkcode PluginCameraApi.rotate}.
|
|
635
|
+
*/
|
|
636
|
+
export const PluginCameraRotateArgs = z.object({
|
|
637
|
+
yawInDegrees: z.number().finite(),
|
|
638
|
+
pitchInDegrees: z.number().finite().optional(),
|
|
639
|
+
options: PluginCameraRotateOptions.optional(),
|
|
640
|
+
})
|
|
641
|
+
export type PluginCameraRotateArgs = z.infer<typeof PluginCameraRotateArgs>
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* How fast the arrow keys walk: the Slow / Normal / Fast navigation setting.
|
|
645
|
+
*/
|
|
646
|
+
export const PluginCameraWalkSpeed = z.enum(["slow", "normal", "fast"])
|
|
647
|
+
export type PluginCameraWalkSpeed = z.infer<typeof PluginCameraWalkSpeed>
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* The arrow-key navigation settings — result of
|
|
651
|
+
* {@linkcode PluginCameraApi.getNavigationSettings} and
|
|
652
|
+
* {@linkcode PluginCameraApi.updateNavigationSettings}.
|
|
653
|
+
*
|
|
654
|
+
* | Property | Type | Description |
|
|
655
|
+
* |---|---|---|
|
|
656
|
+
* | `isKeyboardNavigationEnabled` | `boolean` | Whether the arrow keys walk the camera (Project Settings) |
|
|
657
|
+
* | `eyeHeight` | `number` | Eye height above the floor, `babylon` units |
|
|
658
|
+
* | `walkSpeed` | {@linkcode PluginCameraWalkSpeed} | Arrow-key walking speed |
|
|
659
|
+
* | `isCollisionEnabled` | `boolean` | Whether walking stops at walls |
|
|
660
|
+
*/
|
|
661
|
+
export const PluginCameraNavigationSettings = z.object({
|
|
662
|
+
isKeyboardNavigationEnabled: z.boolean(),
|
|
663
|
+
eyeHeight: z.number(),
|
|
664
|
+
walkSpeed: PluginCameraWalkSpeed,
|
|
665
|
+
isCollisionEnabled: z.boolean(),
|
|
666
|
+
})
|
|
667
|
+
export type PluginCameraNavigationSettings = z.infer<
|
|
668
|
+
typeof PluginCameraNavigationSettings
|
|
669
|
+
>
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* The settings to change in {@linkcode PluginCameraApi.updateNavigationSettings};
|
|
673
|
+
* omitted fields keep their value. `eyeHeight` is in `babylon` units, between
|
|
674
|
+
* 0.8 m and 2.5 m (3.15 to 9.84 units).
|
|
675
|
+
*/
|
|
676
|
+
export const PluginCameraNavigationSettingsPatch = z
|
|
677
|
+
.object({
|
|
678
|
+
isKeyboardNavigationEnabled: z.boolean().optional(),
|
|
679
|
+
eyeHeight: z.number().finite().min(3.15).max(9.84).optional(),
|
|
680
|
+
walkSpeed: PluginCameraWalkSpeed.optional(),
|
|
681
|
+
isCollisionEnabled: z.boolean().optional(),
|
|
682
|
+
})
|
|
683
|
+
.strict()
|
|
684
|
+
export type PluginCameraNavigationSettingsPatch = z.infer<
|
|
685
|
+
typeof PluginCameraNavigationSettingsPatch
|
|
686
|
+
>
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Arguments for {@linkcode PluginCameraApi.updateNavigationSettings}.
|
|
690
|
+
*/
|
|
691
|
+
export const PluginCameraUpdateNavigationSettingsArgs = z.object({
|
|
692
|
+
patch: PluginCameraNavigationSettingsPatch,
|
|
693
|
+
})
|
|
694
|
+
export type PluginCameraUpdateNavigationSettingsArgs = z.infer<
|
|
695
|
+
typeof PluginCameraUpdateNavigationSettingsArgs
|
|
696
|
+
>
|