blockbench-types 4.6.1 → 4.8.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/package.json +2 -1
- package/scripts/generate_docs.js +7 -7
- package/types/action.d.ts +42 -2
- package/types/animation.d.ts +20 -4
- package/types/animation_controller.d.ts +7 -1
- package/types/blockbench.d.ts +34 -4
- package/types/canvas.d.ts +13 -0
- package/types/canvas_frame.d.ts +21 -0
- package/types/codec.d.ts +31 -0
- package/types/cube.d.ts +4 -1
- package/types/dialog.d.ts +1 -1
- package/types/display_mode.d.ts +3 -0
- package/types/format.d.ts +2 -0
- package/types/global.d.ts +28 -0
- package/types/group.d.ts +2 -0
- package/types/keyframe.d.ts +26 -3
- package/types/menu.d.ts +5 -2
- package/types/mesh.d.ts +6 -1
- package/types/misc.d.ts +24 -3
- package/types/outliner.d.ts +13 -0
- package/types/painter.d.ts +3 -1
- package/types/panel.d.ts +19 -4
- package/types/plugin.d.ts +4 -0
- package/types/preview.d.ts +3 -0
- package/types/project.d.ts +10 -1
- package/types/screencam.d.ts +3 -0
- package/types/settings.d.ts +53 -5
- package/types/textures.d.ts +49 -0
- package/types/undo.d.ts +2 -2
- package/types/util.d.ts +15 -0
- package/types/validator.d.ts +35 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockbench-types",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Blockbench typescript types",
|
|
5
5
|
"main": "",
|
|
6
6
|
"types": "types/blockbench.d.ts",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@types/jquery": "^3.5.4",
|
|
25
|
+
"@types/three": "^0.155.0",
|
|
25
26
|
"@types/tinycolor2": "^1.4.3",
|
|
26
27
|
"three": "^0.129.0",
|
|
27
28
|
"typescript": "^4.9.5",
|
package/scripts/generate_docs.js
CHANGED
|
@@ -68,13 +68,13 @@ async function main() {
|
|
|
68
68
|
|
|
69
69
|
'Vue.Component': '[Vue.Component](https://v2.vuejs.org/v2/guide/components.html)',
|
|
70
70
|
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
71
|
+
'Vector3': '[THREE.Vector3](https://threejs.org/docs/index.html#api/en/math/Vector3)',
|
|
72
|
+
'Euler': '[THREE.Euler](https://threejs.org/docs/index.html#api/en/math/Euler)',
|
|
73
|
+
'Quaternion': '[THREE.Quaternion](https://threejs.org/docs/index.html#api/en/math/Quaternion)',
|
|
74
|
+
'Object3D': '[THREE.Object3D](https://threejs.org/docs/index.html#api/en/core/Object3D)',
|
|
75
|
+
'PerspectiveCamera': '[THREE.PerspectiveCamera](https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera)',
|
|
76
|
+
'OrthographicCamera': '[THREE.OrthographicCamera](https://threejs.org/docs/index.html#api/en/cameras/OrthographicCamera)',
|
|
77
|
+
'WebGLRenderer': '[THREE.WebGLRenderer](https://threejs.org/docs/index.html#api/en/renderers/WebGLRenderer)',
|
|
78
78
|
|
|
79
79
|
'HTMLElement': '[HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement)',
|
|
80
80
|
'HTMLCanvasElement': '[HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement)',
|
package/types/action.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare class KeybindItem extends Deletable {
|
|
|
31
31
|
declare class MenuSeparator {
|
|
32
32
|
constructor();
|
|
33
33
|
}
|
|
34
|
+
type ActionEventName = 'delete' | 'use' | 'used' | 'trigger' | 'get_node' | 'select' | 'change' | 'changed' | 'update' | 'open'
|
|
34
35
|
interface BarItemOptions extends KeybindItemOptions {
|
|
35
36
|
name?: string
|
|
36
37
|
description?: string
|
|
@@ -60,6 +61,26 @@ declare class BarItem extends KeybindItem {
|
|
|
60
61
|
*/
|
|
61
62
|
toElement(destination: HTMLElement): this;
|
|
62
63
|
pushToolbar(bar: any): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Adds an event listener to the item
|
|
67
|
+
* @param event_name The event type to listen for
|
|
68
|
+
* @param callback
|
|
69
|
+
*/
|
|
70
|
+
on(event_name: ActionEventName, callback: (data: object) => void): void
|
|
71
|
+
/**
|
|
72
|
+
* Adds a single-use event listener to the item
|
|
73
|
+
* @param event_name The event type to listen for
|
|
74
|
+
* @param callback
|
|
75
|
+
*/
|
|
76
|
+
once(event_name: ActionEventName, callback: (data: object) => void): void
|
|
77
|
+
/**
|
|
78
|
+
* Removes an event listener from the item
|
|
79
|
+
* @param event_name
|
|
80
|
+
* @param callback
|
|
81
|
+
*/
|
|
82
|
+
removeListener(event_name: ActionEventName, callback: (data: object) => void): void
|
|
83
|
+
dispatchEvent(data: object): void
|
|
63
84
|
}
|
|
64
85
|
|
|
65
86
|
interface ActionOptions extends BarItemOptions {
|
|
@@ -230,7 +251,7 @@ interface ToolOptions extends ActionOptions {
|
|
|
230
251
|
brush?: BrushOptions
|
|
231
252
|
}
|
|
232
253
|
/**
|
|
233
|
-
* A tool, such as
|
|
254
|
+
* A tool, such as move tool, vertex snap tool, or paint brush
|
|
234
255
|
*/
|
|
235
256
|
declare class Tool extends Action {
|
|
236
257
|
constructor(id: string, options: ToolOptions);
|
|
@@ -284,8 +305,27 @@ declare class ColorPicker extends Widget {
|
|
|
284
305
|
set(color: any): this;
|
|
285
306
|
get(): any;
|
|
286
307
|
}
|
|
308
|
+
interface ToolbarOptions {
|
|
309
|
+
id: string
|
|
310
|
+
name?: string
|
|
311
|
+
/**
|
|
312
|
+
* If true, the toolbar will display a label abovee
|
|
313
|
+
*/
|
|
314
|
+
label?: boolean
|
|
315
|
+
condition?: ConditionResolvable
|
|
316
|
+
/**
|
|
317
|
+
* If true, the toolbar will only take as much width as needed
|
|
318
|
+
*/
|
|
319
|
+
narrow?: boolean
|
|
320
|
+
vertical?: boolean
|
|
321
|
+
/**
|
|
322
|
+
* Default content of the toolbar. Separators are available, where _ = separator, + = spaces, # = line break
|
|
323
|
+
*/
|
|
324
|
+
children: ('_' | '+' | '#' | string | BarItem)[]
|
|
325
|
+
}
|
|
287
326
|
declare class Toolbar {
|
|
288
|
-
constructor(data:
|
|
327
|
+
constructor(id: string, data: ToolbarOptions);
|
|
328
|
+
constructor(data: ToolbarOptions);
|
|
289
329
|
build(data: any, force: any): this;
|
|
290
330
|
contextmenu(event: Event): void;
|
|
291
331
|
editMenu(): this;
|
package/types/animation.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ declare class _Animation extends AnimationItem {
|
|
|
27
27
|
snapping: any;
|
|
28
28
|
selected: any;
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
|
|
32
|
+
*/
|
|
30
33
|
compileBedrockAnimation(): object;
|
|
31
34
|
save(): this | undefined;
|
|
32
35
|
select(): this | undefined;
|
|
@@ -35,12 +38,25 @@ declare class _Animation extends AnimationItem {
|
|
|
35
38
|
rename(): this;
|
|
36
39
|
togglePlayingState(state: any): any;
|
|
37
40
|
showContextMenu(event: any): this;
|
|
38
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Returns (if necessary creates) the animator of a specific bone of the animation
|
|
43
|
+
*/
|
|
44
|
+
getBoneAnimator(group: OutlinerNode): BoneAnimator;
|
|
45
|
+
/**
|
|
46
|
+
* Adds the animation to the current project and to the interface
|
|
47
|
+
* @param undo If true, the addition of the animation will be registered as an edit
|
|
48
|
+
*/
|
|
39
49
|
add(undo: any): this;
|
|
40
50
|
remove(undo: any, remove_from_file?: boolean): this;
|
|
41
51
|
getMaxLength(): number;
|
|
42
52
|
setLoop(value: any, undo: any): void;
|
|
53
|
+
/**
|
|
54
|
+
* Calculate the snapping value that the animation should use, based on the time codes of the keyframes that it holds. Directly updates the value, but also returns it as a number (snaps per second)
|
|
55
|
+
*/
|
|
43
56
|
calculateSnappingFromKeyframes(): number;
|
|
57
|
+
/**
|
|
58
|
+
* Opens the properties dialog
|
|
59
|
+
*/
|
|
44
60
|
propertiesDialog(): void;
|
|
45
61
|
|
|
46
62
|
name: string
|
|
@@ -142,9 +158,9 @@ declare class NullObjectAnimator extends GeneralAnimator {
|
|
|
142
158
|
declare class EffectAnimator extends GeneralAnimator {
|
|
143
159
|
name: string
|
|
144
160
|
uuid: string
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
161
|
+
particle: Keyframe[]
|
|
162
|
+
sound: Keyframe[]
|
|
163
|
+
timeline: Keyframe[]
|
|
148
164
|
pushKeyframe(keyframe): this
|
|
149
165
|
displayFrame(in_loop): this
|
|
150
166
|
startPreviousSounds(): void
|
|
@@ -80,7 +80,9 @@ interface AnimationControllerOptions {
|
|
|
80
80
|
initial_state?: string
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Animation Controllers are state machines used for Minecraft: Bedrock Edition models to control and blend between animations.
|
|
85
|
+
*/
|
|
84
86
|
declare class AnimationController extends AnimationItem {
|
|
85
87
|
constructor(data: AnimationControllerOptions);
|
|
86
88
|
name: string
|
|
@@ -100,6 +102,10 @@ declare class AnimationController extends AnimationItem {
|
|
|
100
102
|
select(): this | undefined;
|
|
101
103
|
createUniqueName(references: AnimationController[]): string | boolean;
|
|
102
104
|
rename(): this;
|
|
105
|
+
/**
|
|
106
|
+
* Adds the animation controller to the current project and to the interface
|
|
107
|
+
* @param undo If true, the addition of the animation controller will be registered as an edit
|
|
108
|
+
*/
|
|
103
109
|
add(undo: any): this;
|
|
104
110
|
remove(undo?: boolean, remove_from_file?: boolean): this;
|
|
105
111
|
propertiesDialog(): void;
|
package/types/blockbench.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="vue" />
|
|
2
|
-
/// <reference types="three" />
|
|
2
|
+
/// <reference types="@types/three" />
|
|
3
3
|
/// <reference types="@types/tinycolor2" />
|
|
4
4
|
/// <reference types="@types/jquery" />
|
|
5
5
|
/// <reference types="wintersky" />
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
/// <reference types="./display_mode" />
|
|
36
36
|
/// <reference types="./misc" />
|
|
37
37
|
/// <reference types="./util" />
|
|
38
|
+
/// <reference types="./canvas_frame" />
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
|
|
@@ -58,7 +59,7 @@ type WriteType = 'buffer' | 'text' | 'zip' | 'image'
|
|
|
58
59
|
interface WriteOptions {
|
|
59
60
|
content: string | ArrayBuffer
|
|
60
61
|
savetype?: WriteType | ((file: string) => WriteType)
|
|
61
|
-
custom_writer(content: string | ArrayBuffer, file_path: string): void
|
|
62
|
+
custom_writer?(content: string | ArrayBuffer, file_path: string): void
|
|
62
63
|
}
|
|
63
64
|
interface PickDirOptions {
|
|
64
65
|
/**Location where the file dialog starts off
|
|
@@ -204,9 +205,13 @@ declare namespace Blockbench {
|
|
|
204
205
|
/**
|
|
205
206
|
* Opens a message box
|
|
206
207
|
*/
|
|
207
|
-
export function showMessageBox(options: MessageBoxOptions, callback: (
|
|
208
|
+
export function showMessageBox(options: MessageBoxOptions, callback: (button: number | string, checkbox_results: {[key: string]: boolean} | undefined, event: Event) => void): void
|
|
208
209
|
|
|
209
210
|
export function textPrompt(title: string, value: string, callback: (value: string) => void): void
|
|
211
|
+
/**
|
|
212
|
+
* todo
|
|
213
|
+
*/
|
|
214
|
+
export function showToastMessage(): Deletable
|
|
210
215
|
/**
|
|
211
216
|
* Opens the specified link in the browser or in a new tab
|
|
212
217
|
*/
|
|
@@ -232,8 +237,17 @@ declare namespace Blockbench {
|
|
|
232
237
|
export function dispatchEvent(event_name: EventName, data: object): void
|
|
233
238
|
|
|
234
239
|
export function addListener(event_names: EventName, callback: (data: object) => void): void
|
|
240
|
+
/**
|
|
241
|
+
* Adds an event listener
|
|
242
|
+
*/
|
|
235
243
|
export function on(event_names: EventName, callback: (data: object) => void): void
|
|
236
|
-
|
|
244
|
+
/**
|
|
245
|
+
* Adds a single-use event listener
|
|
246
|
+
*/
|
|
247
|
+
export function once(event_names: EventName, callback: (data: object) => void): void
|
|
248
|
+
/**
|
|
249
|
+
* Removes an event listener
|
|
250
|
+
*/
|
|
237
251
|
export function removeListener(event_names: EventName): void
|
|
238
252
|
|
|
239
253
|
|
|
@@ -274,6 +288,22 @@ declare namespace Blockbench {
|
|
|
274
288
|
export { _export as export };
|
|
275
289
|
|
|
276
290
|
|
|
291
|
+
interface FindFileFromContentOptions {
|
|
292
|
+
read_file?: boolean
|
|
293
|
+
json?: boolean
|
|
294
|
+
recursive?: boolean
|
|
295
|
+
filter_regex?: RegExp
|
|
296
|
+
priority_regex?: RegExp
|
|
297
|
+
}
|
|
298
|
+
type CheckFileCallback = (path: string, content: (string|object)) => any
|
|
299
|
+
/**
|
|
300
|
+
* Find a file in a directory, based on content. Optimized by prioritizing files with certain names.
|
|
301
|
+
* @param base_directories Base directories to search in
|
|
302
|
+
* @param options Options
|
|
303
|
+
* @param check_file Function that runs on every file to check if the file is a match. If the function returns anything truthy, that result is returned by the main function.
|
|
304
|
+
*/
|
|
305
|
+
export function findFileFromContent(base_directories: string[], options: FindFileFromContentOptions, check_file: CheckFileCallback): false | any
|
|
306
|
+
|
|
277
307
|
|
|
278
308
|
/**
|
|
279
309
|
* Adds a drag handler that handles dragging and dropping files into Blockbench
|
package/types/canvas.d.ts
CHANGED
|
@@ -38,6 +38,9 @@ interface UpdateViewOptions {
|
|
|
38
38
|
selection?: boolean
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* A global namespace handling miscellaneous functionality related to the 3D preview
|
|
43
|
+
*/
|
|
41
44
|
declare namespace Canvas {
|
|
42
45
|
const materials: {
|
|
43
46
|
[uuid: UUID]: THREE.Material
|
|
@@ -230,7 +233,17 @@ declare class NodePreviewController {
|
|
|
230
233
|
[event_name: string]: ((data) => void)[]
|
|
231
234
|
}
|
|
232
235
|
dispatchEvent(event_name: string, data: object)
|
|
236
|
+
/**
|
|
237
|
+
* Adds an event listener
|
|
238
|
+
*/
|
|
233
239
|
on(event_name: string, cb: (data) => void)
|
|
240
|
+
/**
|
|
241
|
+
* Adds a single-use event listener
|
|
242
|
+
*/
|
|
243
|
+
once(event_name: string, cb: (data) => void)
|
|
244
|
+
/**
|
|
245
|
+
* Removes an event listener
|
|
246
|
+
*/
|
|
234
247
|
removeListener(event_name: string, cb: (data) => void)
|
|
235
248
|
|
|
236
249
|
setup(element: OutlinerNode): void
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper for HTML canvases to simplify loading and modifying images
|
|
3
|
+
*/
|
|
4
|
+
declare class CanvasFrame {
|
|
5
|
+
readonly width: number
|
|
6
|
+
readonly height: number
|
|
7
|
+
canvas: HTMLCanvasElement
|
|
8
|
+
ctx: CanvasRenderingContext2D
|
|
9
|
+
|
|
10
|
+
constructor(a: HTMLCanvasElement)
|
|
11
|
+
constructor(a: HTMLImageElement)
|
|
12
|
+
constructor(a: number, b: number)
|
|
13
|
+
|
|
14
|
+
createCanvas(width: number, height: number): void
|
|
15
|
+
loadFromUrl(url: string): Promise<void>
|
|
16
|
+
loadFromImg(img: HTMLImageElement): void
|
|
17
|
+
/**
|
|
18
|
+
* Crop the image to only pixels that have an alpha value
|
|
19
|
+
*/
|
|
20
|
+
autoCrop(): void
|
|
21
|
+
}
|
package/types/codec.d.ts
CHANGED
|
@@ -25,6 +25,15 @@ interface CodecOptions {
|
|
|
25
25
|
type: 'json' | 'text'
|
|
26
26
|
condition?: ConditionResolvable
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* List of export option inputs, based on the Dialog form API
|
|
30
|
+
*/
|
|
31
|
+
export_options?: {
|
|
32
|
+
[key: string]: DialogFormElement
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Default action that is used to export to the codec
|
|
36
|
+
*/
|
|
28
37
|
export_action?: Action
|
|
29
38
|
}
|
|
30
39
|
|
|
@@ -79,12 +88,27 @@ declare class Codec extends Deletable {
|
|
|
79
88
|
afterDownload?(path): void
|
|
80
89
|
afterSave?(path): void
|
|
81
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Return the stored export option values of the current project
|
|
93
|
+
*/
|
|
94
|
+
getExportOptions(): {[key: string]: any}
|
|
95
|
+
/**
|
|
96
|
+
* Prompt the user to enter their preferred export settings into the dialog
|
|
97
|
+
*/
|
|
98
|
+
promptExportOptions(): Promise<({[key: string]: any} | null)>
|
|
99
|
+
|
|
82
100
|
/**
|
|
83
101
|
* Adds an event listener to the codec
|
|
84
102
|
* @param event_name The event type to listen for
|
|
85
103
|
* @param callback
|
|
86
104
|
*/
|
|
87
105
|
on(event_name: string, callback: (data: object) => void): void
|
|
106
|
+
/**
|
|
107
|
+
* Adds a single-use event listener to the codec
|
|
108
|
+
* @param event_name The event type to listen for
|
|
109
|
+
* @param callback
|
|
110
|
+
*/
|
|
111
|
+
once(event_name: string, callback: (data: object) => void): void
|
|
88
112
|
/**
|
|
89
113
|
* Removes an event listener from the codec
|
|
90
114
|
* @param event_name
|
|
@@ -110,6 +134,13 @@ declare class Codec extends Deletable {
|
|
|
110
134
|
*/
|
|
111
135
|
export_action?: Action
|
|
112
136
|
|
|
137
|
+
/**
|
|
138
|
+
* List of export option inputs
|
|
139
|
+
*/
|
|
140
|
+
export_options: {
|
|
141
|
+
[key: string]: DialogFormElement
|
|
142
|
+
}
|
|
143
|
+
|
|
113
144
|
/**
|
|
114
145
|
* Get a list of all possible extensions of all codecs
|
|
115
146
|
*/
|
package/types/cube.d.ts
CHANGED
|
@@ -80,11 +80,14 @@ declare class Cube extends OutlinerElement {
|
|
|
80
80
|
|
|
81
81
|
static all: Cube[]
|
|
82
82
|
static selected: Cube[]
|
|
83
|
+
/**Check if any elements of the type are in the project */
|
|
84
|
+
static hasAny: () => boolean
|
|
85
|
+
/**Check if any elements of the type are currently selected */
|
|
86
|
+
static hasSelected: () => boolean
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
interface FaceOptions {
|
|
86
90
|
texture?: Texture
|
|
87
|
-
|
|
88
91
|
}
|
|
89
92
|
declare class Face {
|
|
90
93
|
constructor()
|
package/types/dialog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface DialogFormElement {
|
|
2
|
-
type: 'text' | 'number' | 'range' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info' | 'buttons'
|
|
2
|
+
type: 'text' | 'number' | 'range' | 'checkbox' | 'select' | 'inline_select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info' | 'buttons'
|
|
3
3
|
label?: string
|
|
4
4
|
description?: string
|
|
5
5
|
nocolon?: boolean
|
package/types/display_mode.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ interface DisplaySlotOptions {
|
|
|
5
5
|
mirror?: [boolean, boolean, boolean]
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Display Slots hold the transform values for a specific item slot in the Minecraft Java Edition "Display Mode" feature
|
|
10
|
+
*/
|
|
8
11
|
declare class DisplaySlot {
|
|
9
12
|
constructor(id: string, data: DisplaySlotOptions)
|
|
10
13
|
rotation: ArrayVector3
|
package/types/format.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ interface FormatOptions {
|
|
|
56
56
|
bone_rig?: boolean
|
|
57
57
|
centered_grid?: boolean
|
|
58
58
|
rotate_cubes?: boolean
|
|
59
|
+
stretch_cubes?: boolean
|
|
59
60
|
integer_size?: boolean
|
|
60
61
|
meshes?: boolean
|
|
61
62
|
texture_meshes?: boolean
|
|
@@ -108,6 +109,7 @@ declare class ModelFormat extends Deletable {
|
|
|
108
109
|
bone_rig: boolean
|
|
109
110
|
centered_grid: boolean
|
|
110
111
|
rotate_cubes: boolean
|
|
112
|
+
stretch_cubes: boolean
|
|
111
113
|
integer_size: boolean
|
|
112
114
|
meshes: boolean
|
|
113
115
|
texture_meshes: boolean
|
package/types/global.d.ts
CHANGED
|
@@ -16,11 +16,17 @@ declare global {
|
|
|
16
16
|
* Rounds the input number to N digits
|
|
17
17
|
*/
|
|
18
18
|
roundTo(number: number, digits: number): number
|
|
19
|
+
/**
|
|
20
|
+
* Test if the number is between two other numbers
|
|
21
|
+
*/
|
|
19
22
|
isBetween(number: number, limit1: number, limit2: number): boolean
|
|
20
23
|
/**
|
|
21
24
|
* Checks if the absolute difference between a and b is smaller than epsilon
|
|
22
25
|
*/
|
|
23
26
|
epsilon(a: number, b: number, epsilon: number): boolean
|
|
27
|
+
/**
|
|
28
|
+
* Take a rotation value in degrees, and trim it to a value between -180 and 180, while keeping the same angle
|
|
29
|
+
*/
|
|
24
30
|
trimDeg(degrees: number): number
|
|
25
31
|
isPowerOfTwo(number: number): boolean
|
|
26
32
|
/***
|
|
@@ -32,8 +38,30 @@ declare global {
|
|
|
32
38
|
*/
|
|
33
39
|
randomab(a: number, b: number): number
|
|
34
40
|
areMultiples(number1: number, number2: number): boolean
|
|
41
|
+
/**
|
|
42
|
+
* Return the next highest power of n
|
|
43
|
+
* @param num Power
|
|
44
|
+
* @param min Value that the result should be equal to or higher than
|
|
45
|
+
*/
|
|
35
46
|
getNextPower(num: number, min: number): number
|
|
47
|
+
/**
|
|
48
|
+
* Snap the value to the closest number in a list of 1 or more snap points
|
|
49
|
+
*/
|
|
36
50
|
snapToValues(number: number, snap_points: number[], epsilon: number): number
|
|
51
|
+
/**
|
|
52
|
+
* Get the lerp alpha value of m, between points a and b
|
|
53
|
+
*/
|
|
54
|
+
getLerp: (a: number, b: number, m: number) => number
|
|
55
|
+
/**
|
|
56
|
+
* Lerp between a and b using the 0-1 alpha value
|
|
57
|
+
*/
|
|
58
|
+
lerp: (a: number, b: number, alpha: number) => number
|
|
59
|
+
/**
|
|
60
|
+
* Return a random integer
|
|
61
|
+
*/
|
|
62
|
+
randomInteger: (a: number, b: number) => number
|
|
63
|
+
hermiteBlend: (input: number) => number
|
|
64
|
+
clamp: (number: number, min: number, max: number) => number
|
|
37
65
|
}
|
|
38
66
|
interface Array<T> {
|
|
39
67
|
remove(item: any): boolean
|
package/types/group.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ declare class Group extends OutlinerNode {
|
|
|
23
23
|
constructor (options: Partial<GroupOptions>)
|
|
24
24
|
static selected: Group
|
|
25
25
|
static all: Group[]
|
|
26
|
+
/**Check if any groups are in the project */
|
|
27
|
+
static hasAny: () => boolean
|
|
26
28
|
|
|
27
29
|
name: string
|
|
28
30
|
children: OutlinerNode[]
|
package/types/keyframe.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
interface KeyframeDataPointData {
|
|
2
|
+
[key: string]: any
|
|
3
|
+
}
|
|
1
4
|
declare class KeyframeDataPoint {
|
|
2
5
|
constructor(keyframe: _Keyframe);
|
|
3
|
-
extend(data:
|
|
4
|
-
getUndoCopy(): {
|
|
6
|
+
extend(data: KeyframeDataPointData): void;
|
|
7
|
+
getUndoCopy(): {
|
|
8
|
+
[key: string]: any
|
|
9
|
+
};
|
|
5
10
|
}
|
|
6
11
|
|
|
7
12
|
interface KeyframeOptions {
|
|
8
|
-
|
|
13
|
+
channel?: string
|
|
14
|
+
data_points: {}[]
|
|
15
|
+
time: number
|
|
16
|
+
color: number
|
|
17
|
+
uniform: boolean
|
|
18
|
+
interpolation: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
|
|
19
|
+
bezier_linked: boolean
|
|
20
|
+
bezier_left_time: ArrayVector3
|
|
21
|
+
bezier_left_value: ArrayVector3
|
|
22
|
+
bezier_right_time: ArrayVector3
|
|
23
|
+
bezier_right_value: ArrayVector3
|
|
9
24
|
}
|
|
10
25
|
type axisLetter = 'x' | 'y' | 'z'
|
|
11
26
|
|
|
@@ -13,6 +28,14 @@ declare class _Keyframe {
|
|
|
13
28
|
constructor(options: KeyframeOptions, uuid: any);
|
|
14
29
|
|
|
15
30
|
animator: GeneralAnimator;
|
|
31
|
+
|
|
32
|
+
channel: string
|
|
33
|
+
data_points: KeyframeDataPoint[]
|
|
34
|
+
time: number
|
|
35
|
+
color: number
|
|
36
|
+
uniform: boolean
|
|
37
|
+
interpolation: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
|
|
38
|
+
bezier_linked: boolean
|
|
16
39
|
bezier_left_time: ArrayVector3;
|
|
17
40
|
bezier_right_time: ArrayVector3;
|
|
18
41
|
bezier_left_value: ArrayVector3;
|
package/types/menu.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ interface MenuOptions {
|
|
|
22
22
|
keep_open?: boolean
|
|
23
23
|
searchable?: boolean
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
27
|
+
*/
|
|
25
28
|
declare class Menu extends Deletable {
|
|
26
29
|
constructor(id: string, template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
27
30
|
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
@@ -78,12 +81,12 @@ declare namespace MenuBar {
|
|
|
78
81
|
/**
|
|
79
82
|
* Adds an action to the menu structure
|
|
80
83
|
* @param action Action to add
|
|
81
|
-
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, separated by a point. For example, `file.export.0` places the action at the top position of the Export submenu in the File menu.
|
|
84
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index or group within a level, separated by a point. For example, `file.export.0` places the action at the top position of the Export submenu in the File menu.
|
|
82
85
|
*/
|
|
83
86
|
function addAction(action: Action, path?: string): void
|
|
84
87
|
/**
|
|
85
88
|
*
|
|
86
|
-
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
89
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index or group within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
87
90
|
*/
|
|
88
91
|
function removeAction(path: string)
|
|
89
92
|
/**
|
package/types/mesh.d.ts
CHANGED
|
@@ -71,10 +71,15 @@ declare class Mesh extends OutlinerElement {
|
|
|
71
71
|
|
|
72
72
|
static all: Mesh[]
|
|
73
73
|
static selected: Mesh[]
|
|
74
|
+
/**Check if any elements of the type are in the project */
|
|
75
|
+
static hasAny: () => boolean
|
|
76
|
+
/**Check if any elements of the type are currently selected */
|
|
77
|
+
static hasSelected: () => boolean
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
interface MeshFaceOptions extends FaceOptions {
|
|
77
|
-
|
|
81
|
+
vertices: string[]
|
|
82
|
+
uv: {[vkey: string]: ArrayVector2}
|
|
78
83
|
}
|
|
79
84
|
declare class MeshFace extends Face {
|
|
80
85
|
constructor(mesh: Mesh, data: MeshFaceOptions)
|
package/types/misc.d.ts
CHANGED
|
@@ -29,12 +29,16 @@ type EventName = 'remove_animation'
|
|
|
29
29
|
| 'reset_project'
|
|
30
30
|
| 'close_project'
|
|
31
31
|
| 'saved_state_changed'
|
|
32
|
+
| 'save_model_action'
|
|
32
33
|
| 'add_cube'
|
|
33
34
|
| 'add_mesh'
|
|
34
35
|
| 'add_group'
|
|
35
36
|
| 'add_texture_mesh'
|
|
36
37
|
| 'group_elements'
|
|
37
38
|
| 'update_selection'
|
|
39
|
+
| 'compile_bedrock_animations'
|
|
40
|
+
| 'load_animation'
|
|
41
|
+
| 'load_animation_controller'
|
|
38
42
|
| 'update_keyframe_selection'
|
|
39
43
|
| 'select_all'
|
|
40
44
|
| 'added_to_selection'
|
|
@@ -98,10 +102,20 @@ interface MessageBoxOptions {
|
|
|
98
102
|
commands?: {
|
|
99
103
|
[id: string]: string | {text: string}
|
|
100
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Adds checkboxes to the bottom of the message box
|
|
107
|
+
*/
|
|
108
|
+
checkboxes: {
|
|
109
|
+
[id: string]: string | {
|
|
110
|
+
value?: boolean
|
|
111
|
+
condition: ConditionResolvable
|
|
112
|
+
text: string
|
|
113
|
+
}
|
|
114
|
+
}
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
|
|
104
|
-
|
|
118
|
+
type PropertyType = 'string' | 'number' | 'enum' | 'molang' | 'boolean' | 'array' | 'instance' | 'vector' | 'vector2'
|
|
105
119
|
interface PropertyOptions {
|
|
106
120
|
default?: any
|
|
107
121
|
condition?: ConditionResolvable
|
|
@@ -111,6 +125,10 @@ interface PropertyOptions {
|
|
|
111
125
|
* Options used for select types
|
|
112
126
|
*/
|
|
113
127
|
options?: object
|
|
128
|
+
/**
|
|
129
|
+
* Enum possible values
|
|
130
|
+
*/
|
|
131
|
+
values: string[]
|
|
114
132
|
merge?: (instance: any, data: object) => void
|
|
115
133
|
reset?: (instance: any) => void
|
|
116
134
|
merge_validation?: (value: any) => boolean
|
|
@@ -119,20 +137,23 @@ interface PropertyOptions {
|
|
|
119
137
|
* Creates a new property on the specified target class
|
|
120
138
|
*/
|
|
121
139
|
declare class Property extends Deletable {
|
|
122
|
-
constructor(target_class: any, type:
|
|
140
|
+
constructor(target_class: any, type: PropertyType, name: string, options?: PropertyOptions);
|
|
123
141
|
class: any;
|
|
124
142
|
name: string;
|
|
125
|
-
type:
|
|
143
|
+
type: PropertyType;
|
|
126
144
|
default: any;
|
|
127
145
|
|
|
128
146
|
isString: boolean;
|
|
147
|
+
isEnum: boolean;
|
|
129
148
|
isMolang: boolean;
|
|
130
149
|
isNumber: boolean;
|
|
131
150
|
isBoolean: boolean;
|
|
132
151
|
isArray: boolean;
|
|
133
152
|
isVector: boolean;
|
|
134
153
|
isVector2: boolean;
|
|
154
|
+
isInstance: boolean;
|
|
135
155
|
|
|
156
|
+
enum_values?: string[]
|
|
136
157
|
merge_validation: undefined | ((value: any) => boolean);
|
|
137
158
|
condition: ConditionResolvable;
|
|
138
159
|
exposed: boolean;
|
package/types/outliner.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ type ArrayVector2 = [number, number]
|
|
|
9
9
|
declare class OutlinerNode {
|
|
10
10
|
constructor ()
|
|
11
11
|
uuid: UUID
|
|
12
|
+
name: string
|
|
12
13
|
export: boolean
|
|
13
14
|
locked: boolean
|
|
14
15
|
parent: Group | 'root'
|
|
@@ -53,6 +54,10 @@ declare class OutlinerNode {
|
|
|
53
54
|
* @param event Mouse event, determines where the context menu spawns.
|
|
54
55
|
*/
|
|
55
56
|
showContexnu(event: Event | HTMLElement): this
|
|
57
|
+
|
|
58
|
+
static uuids: {
|
|
59
|
+
[uuid: UUID]: OutlinerNode
|
|
60
|
+
}
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
/**
|
|
@@ -81,6 +86,10 @@ declare class Locator extends OutlinerElement {
|
|
|
81
86
|
|
|
82
87
|
static all: Locator[]
|
|
83
88
|
static selected: Locator[]
|
|
89
|
+
/**Check if any elements of the type are in the project */
|
|
90
|
+
static hasAny: () => boolean
|
|
91
|
+
/**Check if any elements of the type are currently selected */
|
|
92
|
+
static hasSelected: () => boolean
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
|
|
@@ -103,6 +112,10 @@ declare class NullObject extends OutlinerElement {
|
|
|
103
112
|
|
|
104
113
|
static all: NullObject[]
|
|
105
114
|
static selected: NullObject[]
|
|
115
|
+
/**Check if any elements of the type are in the project */
|
|
116
|
+
static hasAny: () => boolean
|
|
117
|
+
/**Check if any elements of the type are currently selected */
|
|
118
|
+
static hasSelected: () => boolean
|
|
106
119
|
}
|
|
107
120
|
|
|
108
121
|
|
package/types/painter.d.ts
CHANGED
package/types/panel.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
type PanelSlot = 'left_bar' | 'right_bar' | 'top' | 'bottom' | 'float'
|
|
2
|
+
|
|
1
3
|
interface PanelOptions {
|
|
2
4
|
id: string
|
|
3
5
|
name: string
|
|
@@ -10,9 +12,9 @@ interface PanelOptions {
|
|
|
10
12
|
expand_button: boolean
|
|
11
13
|
toolbars: {
|
|
12
14
|
[id: string]: Toolbar
|
|
13
|
-
}
|
|
15
|
+
} | Toolbar[]
|
|
14
16
|
default_position: {
|
|
15
|
-
slot:
|
|
17
|
+
slot: PanelSlot
|
|
16
18
|
float_position: [number, number]
|
|
17
19
|
float_size: [number, number]
|
|
18
20
|
height: number
|
|
@@ -27,25 +29,38 @@ interface PanelOptions {
|
|
|
27
29
|
}
|
|
28
30
|
type PanelEvent = 'drag' | 'fold' | 'change_zindex' | 'move_to' | 'moved_to' | 'update'
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Panels are interface sections in Blockbench, that are always visible (in a specific format and mode), and can be added to the sidebars, above or below the 3D viewport, or used as free floating above the UI. Examples are the Outliner or the UV editor.
|
|
34
|
+
*/
|
|
30
35
|
declare class Panel {
|
|
31
36
|
constructor (id: string, options: PanelOptions)
|
|
32
37
|
constructor (options: PanelOptions)
|
|
33
38
|
isVisible(): boolean
|
|
34
39
|
isInSidebar(): boolean
|
|
35
|
-
slot:
|
|
40
|
+
slot: PanelSlot
|
|
36
41
|
folded: boolean
|
|
42
|
+
inside_vue: Vue
|
|
43
|
+
|
|
44
|
+
|
|
37
45
|
fold(state?: boolean): this
|
|
38
46
|
/**
|
|
39
47
|
* If the panel is floating, move it up to the front
|
|
40
48
|
*/
|
|
41
49
|
moveToFront(): this
|
|
42
|
-
moveTo(slot:
|
|
50
|
+
moveTo(slot: PanelSlot, ref_panel?: Panel, before?: boolean): this
|
|
43
51
|
update(dragging?: boolean): this
|
|
44
52
|
dispatchEvent(event_name: PanelEvent, data?: any): void
|
|
45
53
|
/**
|
|
46
54
|
* Add an event listener
|
|
47
55
|
*/
|
|
48
56
|
on(event_name: PanelEvent, callback: (data?) => void): void
|
|
57
|
+
/**
|
|
58
|
+
* Adds a single-use event listener
|
|
59
|
+
*/
|
|
60
|
+
once(event_name: PanelEvent, callback: (data?) => void): void
|
|
61
|
+
/**
|
|
62
|
+
* Removes an event listener
|
|
63
|
+
*/
|
|
49
64
|
removeListener(event_name: PanelEvent, callback: (data?) => void): void
|
|
50
65
|
delete(): void
|
|
51
66
|
}
|
package/types/plugin.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ interface PluginOptions {
|
|
|
30
30
|
* Set to true if the plugin must finish loading before a project is opened, i. e. because it adds a format
|
|
31
31
|
*/
|
|
32
32
|
await_loading?: string
|
|
33
|
+
/**
|
|
34
|
+
* Use the new repository format where plugin, iron, and about are stored in a separate folder
|
|
35
|
+
*/
|
|
36
|
+
new_repository_format?: boolean
|
|
33
37
|
/**
|
|
34
38
|
* Runs when the plugin loads
|
|
35
39
|
*/
|
package/types/preview.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ type RaycastResult = {
|
|
|
23
23
|
keyframe: Keyframe
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Previews are 3D viewports, that can either be used as a viewport for the user, or as an offscreen view to record media.
|
|
28
|
+
*/
|
|
26
29
|
declare class Preview extends Deletable {
|
|
27
30
|
constructor(options: PreviewOptions)
|
|
28
31
|
|
package/types/project.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ interface ModelProjectOptions {
|
|
|
2
2
|
format: ModelFormat
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A project instance. The tab bar can be used to switch between projects.
|
|
7
|
+
*/
|
|
5
8
|
declare class ModelProject {
|
|
6
9
|
constructor(options: ModelProjectOptions)
|
|
7
10
|
|
|
@@ -82,13 +85,19 @@ declare class ModelProject {
|
|
|
82
85
|
static all: ModelProject[]
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Global variable and shortcut to get the currently opened project. If no project is open, or the New Tab is open, this value is falsy.
|
|
90
|
+
*/
|
|
91
|
+
declare const Project: ModelProject | 0
|
|
86
92
|
|
|
87
93
|
declare function setupProject(format: ModelFormat | string): boolean;
|
|
88
94
|
declare function newProject(format: ModelFormat | string): boolean;
|
|
89
95
|
declare function setProjectResolution(width: number, height: number, modify_uv?: boolean): void;
|
|
90
96
|
declare function updateProjectResolution(): void;
|
|
91
97
|
|
|
98
|
+
/**
|
|
99
|
+
* An edit session instance. Edit sessions can be attached to a project to collaborate on it with multiple users via P2P connections.
|
|
100
|
+
*/
|
|
92
101
|
declare class EditSession {
|
|
93
102
|
constructor()
|
|
94
103
|
|
package/types/screencam.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ interface RecordTimelapseOptions {
|
|
|
28
28
|
}
|
|
29
29
|
type ScreenshotReturn = (dataURL: string) => void
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A global namespace handling screenshot and GIF recording utilities.
|
|
33
|
+
*/
|
|
31
34
|
declare namespace Screencam {
|
|
32
35
|
/**
|
|
33
36
|
* Provided preview with anti aliasing disabled that can be used for screenshots
|
package/types/settings.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
declare const settings: {
|
|
2
|
-
[id: string]: Setting
|
|
3
|
-
};
|
|
4
|
-
|
|
5
1
|
interface SettingOptions {
|
|
6
2
|
name: string
|
|
7
3
|
type?: 'number' | 'string' | 'boolean' | 'password' | 'select' | 'click'
|
|
@@ -21,10 +17,58 @@ interface SettingOptions {
|
|
|
21
17
|
onChange?: (value: any) => void
|
|
22
18
|
}
|
|
23
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Settings can be used to add global configuration options to Blockbench. All settings are listed under File > Preferences > Settings.
|
|
22
|
+
*/
|
|
24
23
|
declare class Setting extends Deletable {
|
|
25
24
|
constructor(id: string, options: SettingOptions);
|
|
26
25
|
|
|
26
|
+
id: string
|
|
27
|
+
type: string
|
|
28
|
+
condition: any
|
|
29
|
+
/**
|
|
30
|
+
* The master value, not affected by profiles
|
|
31
|
+
*/
|
|
32
|
+
master_value: any
|
|
33
|
+
/**
|
|
34
|
+
* The active value
|
|
35
|
+
*/
|
|
36
|
+
value: any
|
|
37
|
+
/**
|
|
38
|
+
* The value that is displayed in the settings dialog
|
|
39
|
+
*/
|
|
40
|
+
ui_value: any
|
|
41
|
+
name: string
|
|
42
|
+
description: string
|
|
43
|
+
category: string
|
|
44
|
+
/**
|
|
45
|
+
* If true, the setting can be used by the main process before initializing the Blockbench window. This is not available to custom settings created by plugins.
|
|
46
|
+
*/
|
|
47
|
+
launch_setting: boolean
|
|
48
|
+
min?: number
|
|
49
|
+
max?: number
|
|
50
|
+
step?: number
|
|
51
|
+
icon?: string
|
|
52
|
+
options?: {
|
|
53
|
+
[id: string]: string
|
|
54
|
+
}
|
|
55
|
+
hidden?: boolean
|
|
56
|
+
onChange?: () => {}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Sets the value of the setting, while triggering the onChange function if available, and saving the change.
|
|
60
|
+
*/
|
|
61
|
+
set(value): void
|
|
62
|
+
/**
|
|
63
|
+
* Triggers the setting, as if selected in action control. This toggles boolean settings, opens a dialog for string or numeric settings, etc.
|
|
64
|
+
*/
|
|
65
|
+
trigger(event?: Event): void
|
|
66
|
+
|
|
67
|
+
|
|
27
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Global namespace handling data and functionality related to settings.
|
|
71
|
+
*/
|
|
28
72
|
declare namespace Settings {
|
|
29
73
|
const structure: {};
|
|
30
74
|
const stored: {};
|
|
@@ -48,4 +92,8 @@ declare namespace Settings {
|
|
|
48
92
|
* Returns the value of the specified setting
|
|
49
93
|
*/
|
|
50
94
|
function get(setting_id: string): any;
|
|
51
|
-
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare const settings: {
|
|
98
|
+
[id: string]: Setting
|
|
99
|
+
};
|
package/types/textures.d.ts
CHANGED
|
@@ -38,12 +38,61 @@ interface TextureEditOptions {
|
|
|
38
38
|
no_undo_finish?: boolean
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* A texture combines the functionality of material, texture, and image, in one. Textures can be linked to files on the local hard drive, or hold the information in RAM.
|
|
43
|
+
*/
|
|
41
44
|
declare class Texture {
|
|
42
45
|
constructor(data: TextureData, uuid?: string);
|
|
43
46
|
readonly frameCount: number | undefined;
|
|
44
47
|
readonly display_height: number;
|
|
45
48
|
readonly ratio: number;
|
|
46
49
|
|
|
50
|
+
path: string
|
|
51
|
+
name: string
|
|
52
|
+
/** Relative path to the file's directory, used by some formats such as Java Block/Item*/
|
|
53
|
+
folder: string
|
|
54
|
+
namespace: string
|
|
55
|
+
/** Texture ID or key, used by some formats. By default this is a number that increases with every texture that is added */
|
|
56
|
+
id: string
|
|
57
|
+
/** Whether the texture is used for the models particle system. Used by some formats such as Java Block/Item */
|
|
58
|
+
particle: boolean
|
|
59
|
+
render_mode: 'default' | 'emissive' | 'additive' | 'layered' | string
|
|
60
|
+
render_sides: 'auto' | 'front' | 'double' | string
|
|
61
|
+
|
|
62
|
+
/** Texture animation frame time */
|
|
63
|
+
frame_time: number
|
|
64
|
+
frame_order_type: 'custom' | 'loop' | 'backwards' | 'back_and_forth'
|
|
65
|
+
/** Custom frame order */
|
|
66
|
+
frame_order: string
|
|
67
|
+
/** Interpolate between frames */
|
|
68
|
+
frame_interpolate: boolean
|
|
69
|
+
|
|
70
|
+
/** HTML-style source of the texture's displayed data. Can be a path (desktop app only), or a base64 data URL */
|
|
71
|
+
source: string
|
|
72
|
+
selected: boolean
|
|
73
|
+
show_icon: boolean
|
|
74
|
+
error: number
|
|
75
|
+
/** Whether the texture is visible. Used for layered textures mode */
|
|
76
|
+
visible: boolean
|
|
77
|
+
/** Whether the texture canvas is displayed in the UV/2D editor, for live feedback */
|
|
78
|
+
display_canvas: boolean
|
|
79
|
+
width: number
|
|
80
|
+
height: number
|
|
81
|
+
currentFrame: number
|
|
82
|
+
saved: boolean
|
|
83
|
+
/** Whether the latest version of the texture is currently loaded from and linked to a file on disk, or held in memory as bitmap data */
|
|
84
|
+
mode: 'link' | 'bitmap'
|
|
85
|
+
uuid: UUID
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The texture's associated canvas. Note: This may not always be up to date with the texture data
|
|
89
|
+
*/
|
|
90
|
+
canvas: HTMLCanvasElement
|
|
91
|
+
/**
|
|
92
|
+
* Texture image element
|
|
93
|
+
*/
|
|
94
|
+
img: HTMLImageElement
|
|
95
|
+
|
|
47
96
|
getErrorMessage(): string;
|
|
48
97
|
extend(data: TextureData): this;
|
|
49
98
|
/**
|
package/types/undo.d.ts
CHANGED
|
@@ -55,11 +55,11 @@ type UndoEntry = {
|
|
|
55
55
|
}
|
|
56
56
|
interface AmendEditForm {
|
|
57
57
|
condition?: ConditionResolvable
|
|
58
|
-
type?: 'number'
|
|
58
|
+
type?: 'number' | 'checkbox'
|
|
59
59
|
label: string
|
|
60
60
|
interval_type: 'position' | 'rotation'
|
|
61
61
|
getInterval?: (Event) => number
|
|
62
|
-
value?: number | string,
|
|
62
|
+
value?: number | string | 'boolean',
|
|
63
63
|
min?: number,
|
|
64
64
|
max?: number,
|
|
65
65
|
step?: number,
|
package/types/util.d.ts
CHANGED
|
@@ -54,6 +54,9 @@ declare function getAxisLetter(axisNumber: number): string
|
|
|
54
54
|
declare function getAxisNumber(axisLetter: string): number
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Reusable data types that can be used by anything, but should not be used to store data between function calls. Can be used to save memory on frequent function calls.
|
|
59
|
+
*/
|
|
57
60
|
declare namespace Reusable {
|
|
58
61
|
const vec1: THREE.Vector3
|
|
59
62
|
const vec2: THREE.Vector3
|
|
@@ -68,3 +71,15 @@ declare namespace Reusable {
|
|
|
68
71
|
const euler1: THREE.Euler
|
|
69
72
|
const euler2: THREE.Euler
|
|
70
73
|
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Merge the value under a certain key from one object into another
|
|
77
|
+
*/
|
|
78
|
+
declare namespace Merge {
|
|
79
|
+
function number(target: object, source: object, key: string|number): void
|
|
80
|
+
function string(target: object, source: object, key: string|number, validate?: ((value) => boolean)): void
|
|
81
|
+
function molang(target: object, source: object, key: string|number): void
|
|
82
|
+
function boolean(target: object, source: object, key: string|number, validate?: ((value) => boolean)): void
|
|
83
|
+
function arrayVector(target: object, source: object, key: string|number, validate?: ((value) => boolean)): void
|
|
84
|
+
function arrayVector2(target: object, source: object, key: string|number, validate?: ((value) => boolean)): void
|
|
85
|
+
}
|
package/types/validator.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The validator in Blockbench provides feedback about the model and can detect issues in real time, based on a list of checks that can be added. This is a good way to ensure model files are valid, and to teach users about best practices.
|
|
3
|
+
*/
|
|
1
4
|
declare namespace Validator {
|
|
2
5
|
const checks: ValidatorCheck[]
|
|
3
6
|
|
|
@@ -42,6 +45,38 @@ interface WarningOrError {
|
|
|
42
45
|
click(): void
|
|
43
46
|
}[]
|
|
44
47
|
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A check for the validator. A check can be triggered by certain things, and updates the list of warnings and errors that can be displayed in the status bar.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Example:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
new ValidatorCheck('special_cube_name_rule', {
|
|
57
|
+
update_triggers: ['update_selection'],
|
|
58
|
+
run() {
|
|
59
|
+
Cube.all.forEach(cube => {
|
|
60
|
+
if (cube.name == 'sphere') {
|
|
61
|
+
this.warn({
|
|
62
|
+
message: `The cube "${cube.name}" has an invalid names. Cubes may not be called "sphere".`,
|
|
63
|
+
buttons: [
|
|
64
|
+
{
|
|
65
|
+
name: 'Select Cube',
|
|
66
|
+
icon: 'fa-cube',
|
|
67
|
+
click() {
|
|
68
|
+
Validator.dialog.hide();
|
|
69
|
+
cube.select();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
*/
|
|
45
80
|
declare class ValidatorCheck extends Deletable {
|
|
46
81
|
constructor(id: string, options: ValidatorCheckOptions)
|
|
47
82
|
|