blockbench-types 4.9.0 → 4.11.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/.prettierignore +1 -0
- package/.prettierrc.json +9 -0
- package/README.md +3 -2
- package/package.json +43 -33
- package/scripts/generate_docs.js +243 -196
- package/tsconfig.json +13 -14
- package/types/action.d.ts +358 -279
- package/types/animation.d.ts +181 -147
- package/types/animation_controller.d.ts +105 -99
- package/types/blockbench.d.ts +136 -76
- package/types/canvas.d.ts +239 -228
- package/types/canvas_frame.d.ts +2 -2
- package/types/codec.d.ts +36 -32
- package/types/cube.d.ts +32 -11
- package/types/desktop.d.ts +14 -0
- package/types/dialog.d.ts +175 -38
- package/types/display_mode.d.ts +17 -6
- package/types/file_system.d.ts +159 -0
- package/types/format.d.ts +55 -12
- package/types/global.d.ts +49 -3
- package/types/group.d.ts +16 -5
- package/types/index.d.ts +1 -0
- package/types/interface.d.ts +21 -12
- package/types/io.d.ts +2 -2
- package/types/keyframe.d.ts +72 -58
- package/types/legacy.d.ts +2 -1
- package/types/math_util.d.ts +1 -1
- package/types/menu.d.ts +93 -78
- package/types/mesh.d.ts +89 -64
- package/types/misc.d.ts +114 -47
- package/types/mode.d.ts +14 -1
- package/types/molang.d.ts +17 -0
- package/types/outliner.d.ts +42 -23
- package/types/painter.d.ts +49 -11
- package/types/panel.d.ts +49 -21
- package/types/plugin.d.ts +52 -0
- package/types/preview.d.ts +71 -69
- package/types/preview_scene.d.ts +26 -17
- package/types/project.d.ts +54 -37
- package/types/screencam.d.ts +11 -6
- package/types/settings.d.ts +87 -85
- package/types/shared_actions.d.ts +25 -9
- package/types/texture_layers.d.ts +104 -105
- package/types/textures.d.ts +322 -313
- package/types/timeline.d.ts +60 -60
- package/types/undo.d.ts +109 -105
- package/types/util.d.ts +152 -37
- package/types/uveditor.d.ts +3 -0
- package/types/validator.d.ts +3 -2
- package/types/vue.d.ts +7 -0
package/types/cube.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
interface CubeOptions {
|
|
2
3
|
name: string
|
|
3
4
|
autouv: 0 | 1 | 2
|
|
@@ -15,8 +16,12 @@ interface CubeOptions {
|
|
|
15
16
|
*/
|
|
16
17
|
uv_offset: ArrayVector2
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
declare class Cube extends OutlinerElement {
|
|
19
|
-
constructor
|
|
21
|
+
constructor(options: Partial<CubeOptions>, uuid?: string)
|
|
22
|
+
name: string
|
|
23
|
+
uuid: string
|
|
24
|
+
color: any
|
|
20
25
|
/**
|
|
21
26
|
* Auto UV setting, saved as an integer, where 0 means disabled, 1 means enabled, and 2 means relative auto UV (cube position affects UV)
|
|
22
27
|
*/
|
|
@@ -44,19 +49,27 @@ declare class Cube extends OutlinerElement {
|
|
|
44
49
|
faces: {
|
|
45
50
|
[fkey: string]: CubeFace
|
|
46
51
|
}
|
|
52
|
+
rescale?: boolean
|
|
53
|
+
rotation_axis: 'x' | 'y' | 'z'
|
|
47
54
|
/**
|
|
48
55
|
* UV position for box UV mode
|
|
49
56
|
*/
|
|
50
57
|
uv_offset: ArrayVector2
|
|
58
|
+
mesh: THREE.Mesh & {
|
|
59
|
+
outline: THREE.Mesh
|
|
60
|
+
geometry: THREE.BufferGeometry & {
|
|
61
|
+
faces: string[]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
51
64
|
|
|
52
65
|
extend(options: Partial<CubeOptions>): this
|
|
53
66
|
/**
|
|
54
67
|
* Calculates and returns the size of a cube across a certain axis. If the axis argument is omitted, it returns all sizes as an array vector.
|
|
55
68
|
*/
|
|
56
69
|
size(axis?: number, floored?: boolean): number | ArrayVector3
|
|
57
|
-
rotationAxis():
|
|
58
|
-
getUndoCopy(aspects?:
|
|
59
|
-
getSaveCopy(project?: boolean):
|
|
70
|
+
rotationAxis(): string
|
|
71
|
+
getUndoCopy(aspects?: any): void
|
|
72
|
+
getSaveCopy(project?: boolean): Cube
|
|
60
73
|
/**
|
|
61
74
|
* Rotate the cube around axis in 90 degree steps
|
|
62
75
|
* @param axis Axis index
|
|
@@ -76,7 +89,13 @@ declare class Cube extends OutlinerElement {
|
|
|
76
89
|
applyTexture(texture: Texture, faces: true | undefined | CubeFaceDirection[]): void
|
|
77
90
|
mapAutoUV(): void
|
|
78
91
|
moveVector(offset: ArrayVector3, axis: number, update?: boolean): void
|
|
79
|
-
resize(
|
|
92
|
+
resize(
|
|
93
|
+
value: number,
|
|
94
|
+
axis: number,
|
|
95
|
+
negative: boolean,
|
|
96
|
+
allow_negative?: boolean,
|
|
97
|
+
bidirectional?: boolean
|
|
98
|
+
): void
|
|
80
99
|
|
|
81
100
|
static all: Cube[]
|
|
82
101
|
static selected: Cube[]
|
|
@@ -84,6 +103,8 @@ declare class Cube extends OutlinerElement {
|
|
|
84
103
|
static hasAny: () => boolean
|
|
85
104
|
/**Check if any elements of the type are currently selected */
|
|
86
105
|
static hasSelected: () => boolean
|
|
106
|
+
preview_controller: NodePreviewController
|
|
107
|
+
static preview_controller: NodePreviewController
|
|
87
108
|
}
|
|
88
109
|
|
|
89
110
|
interface FaceOptions {
|
|
@@ -91,18 +112,18 @@ interface FaceOptions {
|
|
|
91
112
|
}
|
|
92
113
|
declare class Face {
|
|
93
114
|
constructor()
|
|
94
|
-
texture:
|
|
115
|
+
texture: UUID | false | undefined
|
|
95
116
|
|
|
96
|
-
getTexture(): Texture |
|
|
117
|
+
getTexture(): Texture | undefined
|
|
97
118
|
/**
|
|
98
119
|
* Returns a 2D rectangle around the UV face
|
|
99
120
|
*/
|
|
100
|
-
getBoundingRect():
|
|
121
|
+
getBoundingRect(): any
|
|
101
122
|
reset(): void
|
|
102
123
|
/**
|
|
103
124
|
* Returns a save copy of the face, ready for serialization. Set project to true to save for a bbmodel project file
|
|
104
125
|
*/
|
|
105
|
-
getSaveCopy(project?: boolean):
|
|
126
|
+
getSaveCopy(project?: boolean): any
|
|
106
127
|
/**
|
|
107
128
|
* Get a copy for undo tracking
|
|
108
129
|
*/
|
|
@@ -129,7 +150,7 @@ declare class CubeFace extends Face {
|
|
|
129
150
|
cullface: CubeFaceDirection | ''
|
|
130
151
|
material_name: string
|
|
131
152
|
enabled: boolean
|
|
132
|
-
|
|
133
|
-
extend(data: CubeFaceOptions)
|
|
153
|
+
|
|
154
|
+
extend(data: CubeFaceOptions): void
|
|
134
155
|
getVertexIndices(): [number, number, number, number]
|
|
135
156
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare function initializeDesktopApp(): void
|
|
2
|
+
declare function loadOpenWithBlockbenchFile(): void
|
|
3
|
+
declare function updateRecentProjects(): void
|
|
4
|
+
declare function addRecentProject(data: any): void
|
|
5
|
+
declare function updateRecentProjectData(): void
|
|
6
|
+
declare function updateRecentProjectThumbnail(): Promise<void>
|
|
7
|
+
declare function loadDataFromModelMemory(): void
|
|
8
|
+
declare function updateWindowState(e: any, type: any): void
|
|
9
|
+
declare function changeImageEditor(texture: any, from_settings: any): void
|
|
10
|
+
declare function selectImageEditorFile(texture: any): void
|
|
11
|
+
declare function openDefaultTexturePath(): void
|
|
12
|
+
declare function findExistingFile(paths: string[]): any
|
|
13
|
+
declare function createBackup(init: any): void
|
|
14
|
+
declare function closeBlockbenchWindow(): any
|
package/types/dialog.d.ts
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
interface DialogFormElement {
|
|
2
|
-
type: 'text' | 'number' | 'range' | 'checkbox' | 'select' | 'inline_select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info' | 'buttons'
|
|
3
4
|
label?: string
|
|
5
|
+
/**
|
|
6
|
+
* Detailed description of the field, available behind the questionmark icon or on mouse hover
|
|
7
|
+
*/
|
|
4
8
|
description?: string
|
|
9
|
+
type:
|
|
10
|
+
| 'text'
|
|
11
|
+
| 'number'
|
|
12
|
+
| 'range'
|
|
13
|
+
| 'checkbox'
|
|
14
|
+
| 'select'
|
|
15
|
+
| 'radio'
|
|
16
|
+
| 'textarea'
|
|
17
|
+
| 'vector'
|
|
18
|
+
| 'color'
|
|
19
|
+
| 'file'
|
|
20
|
+
| 'folder'
|
|
21
|
+
| 'save'
|
|
22
|
+
| 'info'
|
|
23
|
+
| 'buttons'
|
|
24
|
+
/**
|
|
25
|
+
* If true, the label will be displayed without colon at the end
|
|
26
|
+
*/
|
|
5
27
|
nocolon?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* Stretch the input field across the whole width of the form
|
|
30
|
+
*/
|
|
6
31
|
full_width?: boolean
|
|
7
32
|
/** Set the input to read-only */
|
|
8
33
|
readonly?: boolean
|
|
@@ -26,11 +51,30 @@ interface DialogFormElement {
|
|
|
26
51
|
*/
|
|
27
52
|
editable_range_label?: boolean
|
|
28
53
|
colorpicker?: any
|
|
54
|
+
/**
|
|
55
|
+
* On numeric inputs, the minimum possible value
|
|
56
|
+
*/
|
|
29
57
|
min?: number
|
|
58
|
+
/**
|
|
59
|
+
* On numeric inputs, the maximum possible value
|
|
60
|
+
*/
|
|
30
61
|
max?: number
|
|
62
|
+
/**
|
|
63
|
+
* The step in which the value can be increased / decreased
|
|
64
|
+
*/
|
|
31
65
|
step?: number
|
|
66
|
+
/**
|
|
67
|
+
* If enabled, the value is forced to multiples of the "step" value. This can be used to create integer-only inputs etc.
|
|
68
|
+
*/
|
|
69
|
+
force_step?: boolean
|
|
70
|
+
/**
|
|
71
|
+
* The height of the input on textareas, in pixels
|
|
72
|
+
*/
|
|
32
73
|
height?: number
|
|
33
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Available options on select or inline_select inputs
|
|
76
|
+
*/
|
|
77
|
+
options?: {[key: string]: string | {name: string}}
|
|
34
78
|
buttons?: string[]
|
|
35
79
|
/**
|
|
36
80
|
* Allow users to toggle the entire option on or off
|
|
@@ -40,21 +84,30 @@ interface DialogFormElement {
|
|
|
40
84
|
* Set whether the setting is toggled on or off by default. Requires 'toggle_enabled' field to be set to true
|
|
41
85
|
*/
|
|
42
86
|
toggle_default?: boolean
|
|
87
|
+
/**
|
|
88
|
+
* Runs when any of the buttons is pressed
|
|
89
|
+
* @param button_index Index of the clicked button in the buttons list
|
|
90
|
+
*/
|
|
43
91
|
click?: (button_index: number) => void
|
|
44
92
|
}
|
|
45
93
|
|
|
46
|
-
type FormResultValue = string|number|boolean|[]
|
|
94
|
+
type FormResultValue = string | number | boolean | []
|
|
47
95
|
|
|
48
96
|
interface ActionInterface {
|
|
49
97
|
name: string
|
|
50
98
|
description?: string
|
|
51
|
-
icon: string
|
|
52
|
-
click
|
|
99
|
+
icon: string
|
|
100
|
+
click(event: Event): void
|
|
53
101
|
condition: ConditionResolvable
|
|
54
102
|
}
|
|
55
103
|
interface DialogOptions {
|
|
56
104
|
title: string
|
|
57
|
-
id
|
|
105
|
+
id?: string
|
|
106
|
+
width?: number
|
|
107
|
+
/**
|
|
108
|
+
* Unless set to false, clicking on the darkened area outside of the dialog will cancel the dialog.
|
|
109
|
+
*/
|
|
110
|
+
cancel_on_click_outside?: boolean
|
|
58
111
|
/**
|
|
59
112
|
* Default button to press to confirm the dialog. Defaults to the first button.
|
|
60
113
|
*/
|
|
@@ -63,10 +116,14 @@ interface DialogOptions {
|
|
|
63
116
|
* Default button to press to cancel the dialog. Defaults to the last button.
|
|
64
117
|
*/
|
|
65
118
|
cancelIndex?: number
|
|
119
|
+
/**
|
|
120
|
+
* Function to execute when the dialog is opened
|
|
121
|
+
*/
|
|
122
|
+
onOpen?(): void
|
|
66
123
|
/**
|
|
67
124
|
* Function to execute when the user confirms the dialog
|
|
68
125
|
*/
|
|
69
|
-
onConfirm
|
|
126
|
+
onConfirm?(formResult: any): void
|
|
70
127
|
/**
|
|
71
128
|
* Function to execute when the user cancels the dialog
|
|
72
129
|
*/
|
|
@@ -74,15 +131,24 @@ interface DialogOptions {
|
|
|
74
131
|
/**
|
|
75
132
|
* Triggered when the user presses a specific button
|
|
76
133
|
*/
|
|
77
|
-
onButton
|
|
134
|
+
onButton?(button_index: number, event?: Event): void
|
|
78
135
|
/**
|
|
79
136
|
* Function to run when anything in the form is changed
|
|
80
137
|
*/
|
|
81
|
-
onFormChange
|
|
138
|
+
onFormChange?(form_result: { [key: string]: FormResultValue }): void
|
|
82
139
|
/**
|
|
83
|
-
* Array of HTML
|
|
140
|
+
* Array of HTML any strings for each line of content in the dialog.
|
|
84
141
|
*/
|
|
85
|
-
lines?: (
|
|
142
|
+
lines?: (
|
|
143
|
+
| HTMLElement
|
|
144
|
+
| Comment
|
|
145
|
+
| {
|
|
146
|
+
label?: string
|
|
147
|
+
widget?: Widget | (() => Widget)
|
|
148
|
+
nocolon?: boolean
|
|
149
|
+
}
|
|
150
|
+
| string
|
|
151
|
+
)[]
|
|
86
152
|
/**
|
|
87
153
|
* Creates a form in the dialog
|
|
88
154
|
*/
|
|
@@ -106,6 +172,15 @@ interface DialogOptions {
|
|
|
106
172
|
* Menu in the handle bar
|
|
107
173
|
*/
|
|
108
174
|
title_menu?: Menu
|
|
175
|
+
/**
|
|
176
|
+
* Display a progress bar in the dialog
|
|
177
|
+
*/
|
|
178
|
+
progress_bar?: {
|
|
179
|
+
/**
|
|
180
|
+
* A progress value between 0 and 1
|
|
181
|
+
*/
|
|
182
|
+
progress?: number
|
|
183
|
+
}
|
|
109
184
|
/**
|
|
110
185
|
* If true, the dialog will only have one button to close it
|
|
111
186
|
*/
|
|
@@ -115,10 +190,41 @@ interface DialogOptions {
|
|
|
115
190
|
*/
|
|
116
191
|
buttons?: string[]
|
|
117
192
|
/**
|
|
118
|
-
*
|
|
193
|
+
* A list of keyboard shortcuts that only work inside the dialog
|
|
119
194
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
195
|
+
keyboard_actions?: {
|
|
196
|
+
[id: string]: {
|
|
197
|
+
keybind: Keybind
|
|
198
|
+
run: (event: KeyboardEvent) => void
|
|
199
|
+
condition?: ConditionResolvable
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Select on which axes the dialog can be resized. None by default
|
|
204
|
+
*/
|
|
205
|
+
resizable?: 'x' | 'y' | 'xy' | boolean
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface DialogSidebarOptions {
|
|
209
|
+
pages?: {
|
|
210
|
+
[key: string]: string | { label: string; icon: IconString; color?: string }
|
|
211
|
+
}
|
|
212
|
+
page?: string
|
|
213
|
+
actions?: (Action | ActionInterface | string)[]
|
|
214
|
+
onPageSwitch?(page: string): void
|
|
215
|
+
}
|
|
216
|
+
declare class DialogSidebar {
|
|
217
|
+
constructor(options: DialogSidebarOptions)
|
|
218
|
+
|
|
219
|
+
pages: {
|
|
220
|
+
[key: string]: string
|
|
221
|
+
}
|
|
222
|
+
page: string
|
|
223
|
+
actions: (Action | string)[]
|
|
224
|
+
onPageSwitch(page: string): void
|
|
225
|
+
build(): void
|
|
226
|
+
toggle(state?: boolean): void
|
|
227
|
+
setPage(page: string): void
|
|
122
228
|
}
|
|
123
229
|
|
|
124
230
|
declare class Dialog {
|
|
@@ -129,7 +235,24 @@ declare class Dialog {
|
|
|
129
235
|
component: Vue.Component
|
|
130
236
|
sidebar: DialogSidebar | null
|
|
131
237
|
content_vue: Vue | null
|
|
238
|
+
progress_bar?: {
|
|
239
|
+
/**
|
|
240
|
+
* The current progress
|
|
241
|
+
*/
|
|
242
|
+
progress?: number
|
|
243
|
+
/**
|
|
244
|
+
* Set the progress displayed in the progress bar
|
|
245
|
+
* @param value A progress value between 0 and 1
|
|
246
|
+
*/
|
|
247
|
+
setProgress(value: number): void
|
|
248
|
+
/**
|
|
249
|
+
* The progress bar HTML node
|
|
250
|
+
*/
|
|
251
|
+
node?: HTMLDivElement
|
|
252
|
+
}
|
|
132
253
|
|
|
254
|
+
confirmIndex: number
|
|
255
|
+
cancelIndex: number
|
|
133
256
|
|
|
134
257
|
show(): this
|
|
135
258
|
hide(): this
|
|
@@ -151,12 +274,40 @@ declare class Dialog {
|
|
|
151
274
|
getFormResult(): {
|
|
152
275
|
[key: string]: FormResultValue
|
|
153
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Function to execute when the dialog is opened
|
|
279
|
+
*/
|
|
280
|
+
onOpen?(): void
|
|
281
|
+
/**
|
|
282
|
+
* Function to execute when the user confirms the dialog
|
|
283
|
+
*/
|
|
284
|
+
onConfirm?(formResult: any): void
|
|
285
|
+
/**
|
|
286
|
+
* Function to execute when the user cancels the dialog
|
|
287
|
+
*/
|
|
288
|
+
onCancel?(): void
|
|
289
|
+
/**
|
|
290
|
+
* Triggered when the user presses a specific button
|
|
291
|
+
*/
|
|
292
|
+
onButton?(button_index: number, event?: Event): void
|
|
293
|
+
/**
|
|
294
|
+
* Function to run when anything in the form is changed
|
|
295
|
+
*/
|
|
296
|
+
onFormChange?(form_result: { [key: string]: FormResultValue }): void
|
|
154
297
|
/**
|
|
155
298
|
* Set the values of the dialog form inputs
|
|
299
|
+
* @param values The values to set, by form input key
|
|
300
|
+
* @param update Whether to update the dialog (call onFormChange) after setting the values. Default is true. Set to false when called from onFormChange
|
|
156
301
|
*/
|
|
157
|
-
setFormValues(values: {[key: string]: FormResultValue}): void
|
|
302
|
+
setFormValues(values: { [key: string]: FormResultValue }, update: boolean): void
|
|
158
303
|
/**
|
|
159
|
-
*
|
|
304
|
+
* Set whether the dialog form inputs are toggled on or off. See "toggle_enabled"
|
|
305
|
+
* @param values
|
|
306
|
+
* @param update Whether to update the dialog (call onFormChange) after setting the values. Default is true. Set to false when called from onFormChange
|
|
307
|
+
*/
|
|
308
|
+
setFormToggles(values: { [key: string]: boolean }, update: boolean): void
|
|
309
|
+
/**
|
|
310
|
+
* Delete the dialog any, causing it to be re-build from scratch on next open
|
|
160
311
|
*/
|
|
161
312
|
delete(): void
|
|
162
313
|
|
|
@@ -180,7 +331,7 @@ interface ShapelessDialogOptions {
|
|
|
180
331
|
/**
|
|
181
332
|
* Function to execute when the user confirms the dialog
|
|
182
333
|
*/
|
|
183
|
-
onConfirm
|
|
334
|
+
onConfirm?(formResult: any): void
|
|
184
335
|
/**
|
|
185
336
|
* Function to execute when the user cancels the dialog
|
|
186
337
|
*/
|
|
@@ -188,7 +339,7 @@ interface ShapelessDialogOptions {
|
|
|
188
339
|
/**
|
|
189
340
|
* Triggered when the user presses a specific button
|
|
190
341
|
*/
|
|
191
|
-
onClose
|
|
342
|
+
onClose?(button_index: number, event?: Event): void
|
|
192
343
|
/**
|
|
193
344
|
* Vue component
|
|
194
345
|
*/
|
|
@@ -199,12 +350,11 @@ interface ShapelessDialogOptions {
|
|
|
199
350
|
cancel_on_click_outside?: boolean
|
|
200
351
|
}
|
|
201
352
|
declare class ShapelessDialog extends Dialog {
|
|
202
|
-
constructor
|
|
353
|
+
constructor(id: string, options: ShapelessDialogOptions)
|
|
203
354
|
|
|
204
355
|
id: string
|
|
205
356
|
component: Vue.Component
|
|
206
357
|
|
|
207
|
-
|
|
208
358
|
show(): this
|
|
209
359
|
hide(): this
|
|
210
360
|
/**
|
|
@@ -228,31 +378,18 @@ declare class ShapelessDialog extends Dialog {
|
|
|
228
378
|
/**
|
|
229
379
|
* Set the values of the dialog form inputs
|
|
230
380
|
*/
|
|
231
|
-
setFormValues(values: {[key: string]: FormResultValue}): void
|
|
381
|
+
setFormValues(values: { [key: string]: FormResultValue }): void
|
|
232
382
|
/**
|
|
233
|
-
* Delete the dialog
|
|
383
|
+
* Delete the dialog any, causing it to be re-build from scratch on next open
|
|
234
384
|
*/
|
|
235
385
|
delete(): void
|
|
236
386
|
}
|
|
237
387
|
|
|
238
388
|
interface DialogSidebarOptions {
|
|
239
389
|
pages?: {
|
|
240
|
-
[key: string]: string | {label: string
|
|
390
|
+
[key: string]: string | { label: string; icon: IconString; color?: string }
|
|
241
391
|
}
|
|
242
392
|
page?: string
|
|
243
|
-
actions?: (Action|ActionInterface|string)[]
|
|
244
|
-
onPageSwitch
|
|
245
|
-
}
|
|
246
|
-
declare class DialogSidebar {
|
|
247
|
-
constructor(options: DialogSidebarOptions)
|
|
248
|
-
|
|
249
|
-
pages: {
|
|
250
|
-
[key: string]: string
|
|
251
|
-
}
|
|
252
|
-
page: string
|
|
253
|
-
actions: (Action|string)[]
|
|
254
|
-
onPageSwitch(page: string): void
|
|
255
|
-
build(): void
|
|
256
|
-
toggle(state?: boolean): void
|
|
257
|
-
setPage(page: string): void
|
|
393
|
+
actions?: (Action | ActionInterface | string)[]
|
|
394
|
+
onPageSwitch?(page: string): void
|
|
258
395
|
}
|
package/types/display_mode.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
declare const DisplayMode: {
|
|
2
3
|
slots: string[]
|
|
3
4
|
}
|
|
@@ -6,6 +7,8 @@ interface DisplaySlotOptions {
|
|
|
6
7
|
rotation?: ArrayVector3
|
|
7
8
|
translation?: ArrayVector3
|
|
8
9
|
scale?: ArrayVector3
|
|
10
|
+
rotation_pivot?: ArrayVector3
|
|
11
|
+
scale_pivot?: ArrayVector3
|
|
9
12
|
mirror?: [boolean, boolean, boolean]
|
|
10
13
|
}
|
|
11
14
|
|
|
@@ -17,6 +20,8 @@ declare class DisplaySlot {
|
|
|
17
20
|
rotation: ArrayVector3
|
|
18
21
|
translation: ArrayVector3
|
|
19
22
|
scale: ArrayVector3
|
|
23
|
+
rotation_pivot: ArrayVector3
|
|
24
|
+
scale_pivot: ArrayVector3
|
|
20
25
|
mirror: [boolean, boolean, boolean]
|
|
21
26
|
/**
|
|
22
27
|
* Reset slot to default values
|
|
@@ -27,18 +32,24 @@ declare class DisplaySlot {
|
|
|
27
32
|
rotation: ArrayVector3
|
|
28
33
|
translation: ArrayVector3
|
|
29
34
|
scale: ArrayVector3
|
|
35
|
+
rotation_pivot: ArrayVector3
|
|
36
|
+
scale_pivot: ArrayVector3
|
|
30
37
|
mirror: [boolean, boolean, boolean]
|
|
31
38
|
}
|
|
32
39
|
/**
|
|
33
40
|
* Generate the values of the slot for export
|
|
34
41
|
*/
|
|
35
|
-
export():
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
export():
|
|
43
|
+
| {
|
|
44
|
+
rotation: ArrayVector3
|
|
45
|
+
translation: ArrayVector3
|
|
46
|
+
scale: ArrayVector3
|
|
47
|
+
rotation_pivot?: ArrayVector3
|
|
48
|
+
scale_pivot?: ArrayVector3
|
|
49
|
+
}
|
|
50
|
+
| undefined
|
|
40
51
|
/**
|
|
41
52
|
* Visually update the UI with the data from this slot if selected
|
|
42
53
|
*/
|
|
43
54
|
update(): this
|
|
44
|
-
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
2
|
+
|
|
3
|
+
declare namespace Blockbench {
|
|
4
|
+
/**
|
|
5
|
+
* The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
|
|
6
|
+
*/
|
|
7
|
+
type ResourceID =
|
|
8
|
+
| string
|
|
9
|
+
| 'texture'
|
|
10
|
+
| 'minecraft_skin'
|
|
11
|
+
| 'dev_plugin'
|
|
12
|
+
| 'animation'
|
|
13
|
+
| 'animation_particle'
|
|
14
|
+
| 'animation_audio'
|
|
15
|
+
| 'theme'
|
|
16
|
+
| 'model'
|
|
17
|
+
| 'gltf'
|
|
18
|
+
| 'obj'
|
|
19
|
+
| 'preview_background'
|
|
20
|
+
| 'screenshot'
|
|
21
|
+
| 'palette'
|
|
22
|
+
|
|
23
|
+
interface FileResult {
|
|
24
|
+
name: string
|
|
25
|
+
path: string
|
|
26
|
+
content: string | ArrayBuffer
|
|
27
|
+
}
|
|
28
|
+
type ReadType = 'buffer' | 'binary' | 'text' | 'image'
|
|
29
|
+
interface ReadOptions {
|
|
30
|
+
readtype?: ReadType | ((file: string) => ReadType)
|
|
31
|
+
errorbox?: boolean
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads the content from the specified files. Desktop app only.
|
|
35
|
+
*/
|
|
36
|
+
export function read(
|
|
37
|
+
files: string[],
|
|
38
|
+
options?: ReadOptions,
|
|
39
|
+
callback?: (files: FileResult[]) => void
|
|
40
|
+
): void
|
|
41
|
+
/**
|
|
42
|
+
* Reads the content from the specified files. Desktop app only.
|
|
43
|
+
*/
|
|
44
|
+
export function readFile(
|
|
45
|
+
files: string[],
|
|
46
|
+
options?: ReadOptions,
|
|
47
|
+
callback?: (files: FileResult[]) => void
|
|
48
|
+
): void
|
|
49
|
+
|
|
50
|
+
type WriteType = 'buffer' | 'text' | 'zip' | 'image'
|
|
51
|
+
interface WriteOptions {
|
|
52
|
+
content?: string | ArrayBuffer
|
|
53
|
+
savetype?: WriteType | ((file: string) => WriteType)
|
|
54
|
+
custom_writer?: (content: string | ArrayBuffer, file_path: string) => void
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Writes a file to the file system. Desktop app only.
|
|
58
|
+
*/
|
|
59
|
+
export function writeFile(
|
|
60
|
+
file_path: string,
|
|
61
|
+
options: WriteOptions,
|
|
62
|
+
callback?: (file_path: string) => void
|
|
63
|
+
): void
|
|
64
|
+
|
|
65
|
+
interface PickDirOptions {
|
|
66
|
+
/**Location where the file dialog starts off
|
|
67
|
+
*/
|
|
68
|
+
startpath?: string
|
|
69
|
+
/** The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
|
|
70
|
+
*/
|
|
71
|
+
resource_id?: ResourceID
|
|
72
|
+
/** Window title for the file picker
|
|
73
|
+
*/
|
|
74
|
+
title?: string
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Pick a directory. Desktop app only.
|
|
78
|
+
*/
|
|
79
|
+
export function pickDirectory(options: PickDirOptions): string | undefined
|
|
80
|
+
|
|
81
|
+
interface ImportOptions extends ReadOptions {
|
|
82
|
+
/** Name of the file type
|
|
83
|
+
*/
|
|
84
|
+
type: string
|
|
85
|
+
/** File Extensions
|
|
86
|
+
*/
|
|
87
|
+
extensions: string[]
|
|
88
|
+
/** Allow selection of multiple elements
|
|
89
|
+
*/
|
|
90
|
+
multiple?: boolean
|
|
91
|
+
/** File picker start path
|
|
92
|
+
*/
|
|
93
|
+
startpath?: string
|
|
94
|
+
/** The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
|
|
95
|
+
*/
|
|
96
|
+
resource_id?: ResourceID
|
|
97
|
+
/** Title of the file picker window
|
|
98
|
+
*/
|
|
99
|
+
title?: string
|
|
100
|
+
/**
|
|
101
|
+
*/
|
|
102
|
+
}
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
function _import(options: ImportOptions, callback?: (files: FileResult[]) => void): any
|
|
105
|
+
export { _import as import }
|
|
106
|
+
|
|
107
|
+
interface ExportOptions extends WriteOptions {
|
|
108
|
+
/**
|
|
109
|
+
* Name of the file type
|
|
110
|
+
*/
|
|
111
|
+
type: string
|
|
112
|
+
/**
|
|
113
|
+
* File extensions
|
|
114
|
+
*/
|
|
115
|
+
extensions: string[]
|
|
116
|
+
/**
|
|
117
|
+
* Suggested file name
|
|
118
|
+
*/
|
|
119
|
+
name?: string
|
|
120
|
+
/**
|
|
121
|
+
* Location where the file dialog starts
|
|
122
|
+
*/
|
|
123
|
+
startpath?: string
|
|
124
|
+
/**
|
|
125
|
+
* The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
|
|
126
|
+
*/
|
|
127
|
+
resource_id?: string
|
|
128
|
+
}
|
|
129
|
+
function _export(options: ExportOptions, callback?: (file_path: string) => void): any
|
|
130
|
+
export { _export as export }
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Adds a drag handler that handles dragging and dropping files into Blockbench
|
|
134
|
+
*/
|
|
135
|
+
interface DragHandlerOptions extends ReadOptions {
|
|
136
|
+
/**
|
|
137
|
+
* Allowed file extensions
|
|
138
|
+
*/
|
|
139
|
+
extensions: string[] | (() => string[])
|
|
140
|
+
/**
|
|
141
|
+
* Whether or not to enable the drag handler
|
|
142
|
+
*/
|
|
143
|
+
condition?: ConditionResolvable
|
|
144
|
+
/**
|
|
145
|
+
* Drop target element
|
|
146
|
+
*/
|
|
147
|
+
element?: string | HTMLElement | (() => string | HTMLElement)
|
|
148
|
+
/**
|
|
149
|
+
* If true, the drop will work on all child elements of the specified element
|
|
150
|
+
*/
|
|
151
|
+
propagate?: boolean
|
|
152
|
+
}
|
|
153
|
+
export function addDragHandler(
|
|
154
|
+
id: string,
|
|
155
|
+
options: DragHandlerOptions,
|
|
156
|
+
callback?: () => void
|
|
157
|
+
): Deletable
|
|
158
|
+
export function removeDragHandler(id: string): void
|
|
159
|
+
}
|