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/canvas.d.ts
CHANGED
|
@@ -1,260 +1,271 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
interface UpdateViewOptions {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
3
|
+
/**
|
|
4
|
+
* List of elements to update
|
|
5
|
+
*/
|
|
6
|
+
elements?: OutlinerElement[]
|
|
7
|
+
/**
|
|
8
|
+
* Which aspects of the elements to update
|
|
9
|
+
*/
|
|
10
|
+
element_aspects?: {
|
|
11
|
+
/**
|
|
12
|
+
* Update visibility of elements
|
|
13
|
+
*/
|
|
14
|
+
visibility?: boolean
|
|
15
|
+
/**
|
|
16
|
+
* Update the position and geometry
|
|
17
|
+
*/
|
|
18
|
+
geometry?: boolean
|
|
19
|
+
/**
|
|
20
|
+
* Update the mesh faces
|
|
21
|
+
*/
|
|
22
|
+
faces?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* Update the UV mapping
|
|
25
|
+
*/
|
|
26
|
+
uv?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* Update the painting grid
|
|
29
|
+
*/
|
|
30
|
+
painting_grid?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* Update the transform of elements
|
|
33
|
+
*/
|
|
34
|
+
transform?: boolean
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Groups to update
|
|
38
|
+
*/
|
|
39
|
+
groups?: Group[]
|
|
40
|
+
/**
|
|
41
|
+
* Whether to update the selection (updates the selection outlines and interface)
|
|
42
|
+
*/
|
|
43
|
+
selection?: boolean
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
42
47
|
* A global namespace handling miscellaneous functionality related to the 3D preview
|
|
43
48
|
*/
|
|
44
49
|
declare namespace Canvas {
|
|
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
|
-
|
|
50
|
+
const materials: {
|
|
51
|
+
[uuid: UUID]: THREE.Material
|
|
52
|
+
}
|
|
53
|
+
const emptyMaterials: {
|
|
54
|
+
[uuid: UUID]: THREE.Material
|
|
55
|
+
}
|
|
56
|
+
const meshes: {
|
|
57
|
+
[uuid: UUID]: THREE.Mesh
|
|
58
|
+
}
|
|
59
|
+
const bones: {
|
|
60
|
+
[uuid: UUID]: THREE.Object3D
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Main scene, shared across all tabs
|
|
64
|
+
*/
|
|
65
|
+
const scene: THREE.Scene
|
|
66
|
+
/**
|
|
67
|
+
* List of the gizmos (control and UI elements) in the 3D scene
|
|
68
|
+
*/
|
|
69
|
+
const gizmos: []
|
|
70
|
+
/**
|
|
71
|
+
* The material used for all selection outlines
|
|
72
|
+
*/
|
|
73
|
+
const outlineMaterial: THREE.LineBasicMaterial
|
|
74
|
+
const meshOutlineMaterial: THREE.LineBasicMaterial
|
|
75
|
+
const onionSkinEarlierMaterial: THREE.LineBasicMaterial
|
|
76
|
+
const onionSkinLaterMaterial: THREE.LineBasicMaterial
|
|
77
|
+
/**
|
|
78
|
+
* The material used for the wireframe view
|
|
79
|
+
*/
|
|
80
|
+
const wireframeMaterial: THREE.MeshBasicMaterial
|
|
81
|
+
const solidMaterial: THREE.ShaderMaterial
|
|
82
|
+
const normalHelperMaterial: THREE.ShaderMaterial
|
|
83
|
+
const uvHelperMaterial: THREE.ShaderMaterial
|
|
84
|
+
const meshVertexMaterial: THREE.PointsMaterial
|
|
85
|
+
const transparentMaterial: THREE.MeshBasicMaterial
|
|
86
|
+
/**
|
|
87
|
+
* The material used for the grids
|
|
88
|
+
*/
|
|
89
|
+
const gridMaterial: THREE.LineBasicMaterial
|
|
79
90
|
|
|
80
|
-
|
|
91
|
+
const pivot_marker: THREE.Object3D
|
|
81
92
|
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
const global_light_color: THREE.Color
|
|
94
|
+
const global_light_side: number
|
|
84
95
|
|
|
85
|
-
|
|
96
|
+
const face_order: string[]
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Raycast on the currently selected preview
|
|
100
|
+
*/
|
|
101
|
+
function raycast(event: MouseEvent): any
|
|
102
|
+
/**
|
|
103
|
+
* Execute the callback function without any gizmos, grids and helpers visible
|
|
104
|
+
*/
|
|
105
|
+
function withoutGizmos(cb: () => void): void
|
|
106
|
+
/**
|
|
107
|
+
* Clear all elements from the scene
|
|
108
|
+
*/
|
|
109
|
+
function clear(): void
|
|
110
|
+
function buildGrid(): void
|
|
111
|
+
function updateShading(): void
|
|
112
|
+
/**
|
|
113
|
+
* Updates selected aspects of the preview
|
|
114
|
+
* @param options
|
|
115
|
+
*/
|
|
116
|
+
function updateView(options: UpdateViewOptions): void
|
|
117
|
+
/**
|
|
118
|
+
* Regenerate all elements in the scene. Very unoptimized, use with care
|
|
119
|
+
*/
|
|
120
|
+
function updateAll(): void
|
|
121
|
+
/**
|
|
122
|
+
* Update the position and shape of all elements
|
|
123
|
+
*/
|
|
124
|
+
function updateAllPositions(): void
|
|
125
|
+
/**
|
|
126
|
+
* Update the visibility of all elements
|
|
127
|
+
*/
|
|
128
|
+
function updateVisibility(): void
|
|
129
|
+
/**
|
|
130
|
+
* Update all faces in the scene
|
|
131
|
+
* @param texture Texture filter. If specified, only faces with this texture will be updated
|
|
132
|
+
*/
|
|
133
|
+
function updateAllFaces(texture?: Texture): void
|
|
134
|
+
/**
|
|
135
|
+
* Update all UV maps in the scene
|
|
136
|
+
*/
|
|
137
|
+
function updateAllUVs(): void
|
|
138
|
+
/**
|
|
139
|
+
* Returns the three.js render sides based on the current settings and state
|
|
140
|
+
*/
|
|
141
|
+
function getRenderSide(): number
|
|
142
|
+
/**
|
|
143
|
+
* Update render sides of all materials
|
|
144
|
+
*/
|
|
145
|
+
function updateRenderSides(): void
|
|
146
|
+
/**
|
|
147
|
+
* Redraw the selected elements in the scene
|
|
148
|
+
* @param arr Optionally specify an array of elements to update
|
|
149
|
+
*/
|
|
86
150
|
|
|
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
|
-
|
|
117
|
-
|
|
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
|
-
function updateSelectedFaces(): void;
|
|
149
|
-
/**
|
|
150
|
-
* Update the UV maps of all selected elements
|
|
151
|
-
*/
|
|
152
|
-
function updateUVs(): void;
|
|
153
|
-
/**
|
|
154
|
-
* Update the hierarchy and position of all bones
|
|
155
|
-
*/
|
|
156
|
-
function updateAllBones(): void;
|
|
157
|
-
/**
|
|
158
|
-
* Update the position of the origin / pivot point gizmo
|
|
159
|
-
*/
|
|
160
|
-
function updateOrigin(): boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Update the position and shape of the specified cube
|
|
163
|
-
* @param cube Cube to update
|
|
164
|
-
* @param mesh Mesh instance of the cube
|
|
165
|
-
*/
|
|
166
|
-
function adaptObjectPosition(cube: Cube, mesh?: THREE.Mesh): void;
|
|
167
|
-
/**
|
|
168
|
-
* Update the geometry faces of the specified cube
|
|
169
|
-
* @param cube Cube to update
|
|
170
|
-
*/
|
|
171
|
-
function adaptObjectFaceGeo(cube: any): void;
|
|
172
|
-
/**
|
|
173
|
-
* Update the faces (material) of the specified cube
|
|
174
|
-
* @param cube Cube to update
|
|
175
|
-
* @param mesh Mesh instance of the cube
|
|
176
|
-
*/
|
|
177
|
-
function adaptObjectFaces(cube: any, mesh: any): void;
|
|
178
|
-
/**
|
|
179
|
-
* Update the layered or not layered material of all elements
|
|
180
|
-
*/
|
|
181
|
-
function updateLayeredTextures(): void;
|
|
182
|
-
/**
|
|
183
|
-
* Update the UV map of the specified cube
|
|
184
|
-
* @param cube Cube to update
|
|
185
|
-
* @param animation Whether to display the current animated texture frame
|
|
186
|
-
*/
|
|
187
|
-
function updateUV(cube: Cube, animation?: boolean): any;
|
|
188
|
-
/**
|
|
189
|
-
* Update the materials of marker colors if new colors were added
|
|
190
|
-
*/
|
|
191
|
-
function updateMarkerColorMaterials(): void;
|
|
192
|
-
/**
|
|
193
|
-
* Create an additional outline around the specified cubes
|
|
194
|
-
* @param arr List of cubes to outline
|
|
195
|
-
*/
|
|
196
|
-
function outlineObjects(arr: Cube[]): void;
|
|
197
|
-
/**
|
|
198
|
-
* Calculate the size of the model, in the currently displayed shape. Returns [width, height] in blockbench units
|
|
199
|
-
*/
|
|
200
|
-
function getModelSize(): [number, number];
|
|
151
|
+
function updateSelected(arr: any): void
|
|
152
|
+
/**
|
|
153
|
+
* Update positions and shapes of the selected elements
|
|
154
|
+
*/
|
|
155
|
+
function updatePositions(y: number): void
|
|
156
|
+
/**
|
|
157
|
+
* Update the faces of all selected elements (material, UV map)
|
|
158
|
+
*/
|
|
159
|
+
function updateSelectedFaces(): void
|
|
160
|
+
/**
|
|
161
|
+
* Update the UV maps of all selected elements
|
|
162
|
+
*/
|
|
163
|
+
function updateUVs(): void
|
|
164
|
+
/**
|
|
165
|
+
* Update the hierarchy and position of all bones
|
|
166
|
+
*/
|
|
167
|
+
function updateAllBones(): void
|
|
168
|
+
/**
|
|
169
|
+
* Update the position of the origin / pivot point gizmo
|
|
170
|
+
*/
|
|
171
|
+
function updateOrigin(): boolean
|
|
172
|
+
/**
|
|
173
|
+
* Update the position and shape of the specified cube
|
|
174
|
+
* @param cube Cube to update
|
|
175
|
+
* @param mesh Mesh instance of the cube
|
|
176
|
+
*/
|
|
177
|
+
function adaptObjectPosition(cube: Cube, mesh?: THREE.Mesh): void
|
|
178
|
+
/**
|
|
179
|
+
* Update the geometry faces of the specified cube
|
|
180
|
+
* @param cube Cube to update
|
|
181
|
+
*/
|
|
182
|
+
function adaptObjectFaceGeo(cube: any): void
|
|
183
|
+
/**
|
|
184
|
+
* Update the faces (material) of the specified cube
|
|
185
|
+
* @param cube Cube to update
|
|
186
|
+
* @param mesh Mesh instance of the cube
|
|
187
|
+
*/
|
|
188
|
+
function adaptObjectFaces(cube: any, mesh: any): void
|
|
189
|
+
/**
|
|
190
|
+
* Update the layered or not layered material of all elements
|
|
191
|
+
*/
|
|
192
|
+
function updateLayeredTextures(): void
|
|
193
|
+
/**
|
|
194
|
+
* Update the UV map of the specified cube
|
|
195
|
+
* @param cube Cube to update
|
|
196
|
+
* @param animation Whether to display the current animated texture frame
|
|
197
|
+
*/
|
|
198
|
+
function updateUV(cube: Cube, animation?: boolean): any
|
|
199
|
+
/**
|
|
200
|
+
* Update the materials of marker colors if new colors were added
|
|
201
|
+
*/
|
|
202
|
+
function updateMarkerColorMaterials(): void
|
|
203
|
+
/**
|
|
204
|
+
* Create an additional outline around the specified cubes
|
|
205
|
+
* @param arr List of cubes to outline
|
|
206
|
+
*/
|
|
207
|
+
function outlineObjects(arr: Cube[]): void
|
|
208
|
+
/**
|
|
209
|
+
* Calculate the size of the model, in the currently displayed shape. Returns [width, height] in blockbench units
|
|
210
|
+
*/
|
|
211
|
+
function getModelSize(): [number, number]
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
/**
|
|
204
215
|
* Marks a specific aspect of the interface to be updated in the next tick. Useful to avoid an update function getting called multiple times in the same task.
|
|
205
216
|
*/
|
|
206
217
|
declare namespace TickUpdates {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
218
|
+
const outliner: undefined | true
|
|
219
|
+
const selection: undefined | true
|
|
220
|
+
const main_uv: undefined | true
|
|
221
|
+
const texture_list: undefined | true
|
|
222
|
+
const keyframes: undefined | true
|
|
223
|
+
const keyframe_selection: undefined | true
|
|
224
|
+
const keybind_conflicts: undefined | true
|
|
214
225
|
}
|
|
215
226
|
|
|
216
227
|
interface NodePreviewControllerOptions {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
setup?(element: OutlinerNode): void
|
|
229
|
+
remove?(element: OutlinerNode): void
|
|
230
|
+
updateAll?(element: OutlinerNode): void
|
|
231
|
+
updateTransform?(element: OutlinerNode): void
|
|
232
|
+
updateVisibility?(element: OutlinerNode): void
|
|
233
|
+
updateSelection?(element: OutlinerNode): void
|
|
234
|
+
updateGeometry?(element: OutlinerNode): void
|
|
235
|
+
updateUV?(element: OutlinerNode): void
|
|
236
|
+
updateFaces?(element: OutlinerNode): void
|
|
237
|
+
updatePaintingGrid?(element: OutlinerNode): void
|
|
238
|
+
updateHighlight?(element: OutlinerNode): void
|
|
228
239
|
}
|
|
229
240
|
declare class NodePreviewController {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
241
|
+
constructor(type: typeof OutlinerNode, options: NodePreviewControllerOptions)
|
|
242
|
+
type: typeof OutlinerNode
|
|
243
|
+
events: {
|
|
244
|
+
[event_name: string]: ((data: any) => void)[]
|
|
245
|
+
}
|
|
246
|
+
dispatchEvent(event_name: string, data: Record<string, any>): void
|
|
236
247
|
/**
|
|
237
248
|
* Adds an event listener
|
|
238
249
|
*/
|
|
239
|
-
|
|
250
|
+
on(event_name: string, cb: (data: any) => void): void
|
|
240
251
|
/**
|
|
241
252
|
* Adds a single-use event listener
|
|
242
253
|
*/
|
|
243
|
-
|
|
254
|
+
once(event_name: string, cb: (data: any) => void): void
|
|
244
255
|
/**
|
|
245
256
|
* Removes an event listener
|
|
246
257
|
*/
|
|
247
|
-
|
|
258
|
+
removeListener(event_name: string, cb: (data: any) => void): void
|
|
248
259
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
260
|
+
setup(element: OutlinerNode): void
|
|
261
|
+
remove(element: OutlinerNode): void
|
|
262
|
+
updateAll(element: OutlinerNode): void
|
|
263
|
+
updateTransform(element: OutlinerNode): void
|
|
264
|
+
updateVisibility(element: OutlinerNode): void
|
|
265
|
+
updateSelection(element: OutlinerNode): void
|
|
266
|
+
updateGeometry(instance: OutlinerNode): void
|
|
267
|
+
updateUV(instance: OutlinerNode): void
|
|
268
|
+
updateFaces(instance: OutlinerNode): void
|
|
269
|
+
updatePaintingGrid(instance: OutlinerNode): void
|
|
270
|
+
updateHighlight(instance: OutlinerNode): void
|
|
271
|
+
}
|
package/types/canvas_frame.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ declare class CanvasFrame {
|
|
|
13
13
|
|
|
14
14
|
createCanvas(width: number, height: number): void
|
|
15
15
|
loadFromUrl(url: string): Promise<void>
|
|
16
|
-
|
|
16
|
+
loadFromImage(img: HTMLImageElement): void
|
|
17
17
|
/**
|
|
18
18
|
* Crop the image to only pixels that have an alpha value
|
|
19
19
|
*/
|
|
20
20
|
autoCrop(): void
|
|
21
|
-
}
|
|
21
|
+
}
|
package/types/codec.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
2
2
|
interface CodecOptions {
|
|
3
3
|
name: string
|
|
4
|
-
load?(model: any, file:
|
|
5
|
-
compile?(options?:
|
|
6
|
-
parse?(data: any, path: string): void
|
|
4
|
+
load?(model: any, file: FileResult, add?: boolean): void
|
|
5
|
+
compile?(options?: any): string | ArrayBuffer | any
|
|
6
|
+
parse?(data: any, path: string, add?: boolean): void
|
|
7
7
|
export?(): void
|
|
8
8
|
/**
|
|
9
9
|
* Generate a file name to suggest when exporting
|
|
@@ -11,9 +11,11 @@ interface CodecOptions {
|
|
|
11
11
|
fileName?(): string
|
|
12
12
|
startPath?(): string
|
|
13
13
|
write?(content: any, path: string): void
|
|
14
|
-
overwrite?(content: any, path: string, callback: (
|
|
15
|
-
afterDownload?(path): void
|
|
16
|
-
afterSave?(path): void
|
|
14
|
+
overwrite?(content: any, path: string, callback: (path: any) => void): void
|
|
15
|
+
afterDownload?(path: any): void
|
|
16
|
+
afterSave?(path: any): void
|
|
17
|
+
|
|
18
|
+
dispatchEvent?(event_name: string, data: any): void
|
|
17
19
|
|
|
18
20
|
extension: string
|
|
19
21
|
/**
|
|
@@ -50,73 +52,73 @@ declare class Codec extends Deletable {
|
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Load a file into the program
|
|
53
|
-
* @param model
|
|
54
|
-
* @param file
|
|
55
|
-
* @param add
|
|
55
|
+
* @param model
|
|
56
|
+
* @param file
|
|
57
|
+
* @param add
|
|
56
58
|
*/
|
|
57
|
-
load
|
|
59
|
+
load(model: any, file: any, add?: boolean): void
|
|
58
60
|
/**
|
|
59
61
|
* Compiles the file content
|
|
60
|
-
* @param options
|
|
62
|
+
* @param options
|
|
61
63
|
*/
|
|
62
|
-
compile
|
|
64
|
+
compile(options?: any): any
|
|
63
65
|
/**
|
|
64
66
|
* Takes the content of a file, and loads the model into the current Blockbench project
|
|
65
67
|
* @param data File content
|
|
66
68
|
* @param path File path
|
|
67
69
|
*/
|
|
68
|
-
parse?(data: any, path: string): void
|
|
70
|
+
parse?(data: any, path: string, add?: boolean): void
|
|
69
71
|
/**
|
|
70
72
|
* Opens the file browser to export a file of this type
|
|
71
73
|
*/
|
|
72
|
-
export
|
|
74
|
+
export(): void
|
|
73
75
|
/**
|
|
74
76
|
* Generate a file name to suggest when exporting
|
|
75
77
|
*/
|
|
76
|
-
fileName
|
|
78
|
+
fileName(): string
|
|
77
79
|
/**
|
|
78
80
|
* Generates the suggested file path. This is the path that the explorer opens in when exporting this type
|
|
79
81
|
*/
|
|
80
|
-
startPath
|
|
82
|
+
startPath(): string
|
|
81
83
|
/**
|
|
82
84
|
* Write the content of this file to the selected location. The default method can be overwritten to achieve custom behavior
|
|
83
85
|
* @param content File content, as generated by compile()
|
|
84
86
|
* @param path The file export path
|
|
85
87
|
*/
|
|
86
|
-
write
|
|
87
|
-
overwrite
|
|
88
|
-
afterDownload
|
|
89
|
-
afterSave
|
|
88
|
+
write(content: any, path: string): void
|
|
89
|
+
overwrite(content: any, path: string, callback: (path: string) => void): void
|
|
90
|
+
afterDownload(path: string): void
|
|
91
|
+
afterSave(path: string): void
|
|
90
92
|
|
|
91
93
|
/**
|
|
92
94
|
* Return the stored export option values of the current project
|
|
93
95
|
*/
|
|
94
|
-
getExportOptions(): {[key: string]: any}
|
|
96
|
+
getExportOptions(): { [key: string]: any }
|
|
95
97
|
/**
|
|
96
98
|
* Prompt the user to enter their preferred export settings into the dialog
|
|
97
99
|
*/
|
|
98
|
-
promptExportOptions(): Promise<
|
|
100
|
+
promptExportOptions(): Promise<{ [key: string]: any } | null>
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* Adds an event listener to the codec
|
|
102
104
|
* @param event_name The event type to listen for
|
|
103
|
-
* @param callback
|
|
105
|
+
* @param callback
|
|
104
106
|
*/
|
|
105
|
-
on(event_name: string, callback: (data:
|
|
107
|
+
on(event_name: string, callback: (data: any) => void): void
|
|
106
108
|
/**
|
|
107
109
|
* Adds a single-use event listener to the codec
|
|
108
110
|
* @param event_name The event type to listen for
|
|
109
|
-
* @param callback
|
|
111
|
+
* @param callback
|
|
110
112
|
*/
|
|
111
|
-
once(event_name: string, callback: (data:
|
|
113
|
+
once(event_name: string, callback: (data: any) => void): void
|
|
112
114
|
/**
|
|
113
115
|
* Removes an event listener from the codec
|
|
114
|
-
* @param event_name
|
|
115
|
-
* @param callback
|
|
116
|
+
* @param event_name
|
|
117
|
+
* @param callback
|
|
116
118
|
*/
|
|
117
|
-
removeListener(event_name: string, callback: (data:
|
|
118
|
-
dispatchEvent(data:
|
|
119
|
-
|
|
119
|
+
removeListener(event_name: string, callback: (data: any) => void): void
|
|
120
|
+
dispatchEvent(event_name: string, data: any): void
|
|
121
|
+
|
|
120
122
|
/**
|
|
121
123
|
* The display name of the codec
|
|
122
124
|
*/
|
|
@@ -141,6 +143,8 @@ declare class Codec extends Deletable {
|
|
|
141
143
|
[key: string]: DialogFormElement
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
format: ModelFormat
|
|
147
|
+
|
|
144
148
|
/**
|
|
145
149
|
* Get a list of all possible extensions of all codecs
|
|
146
150
|
*/
|