blockbench-types 4.6.1 → 4.9.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 +9 -7
- package/types/action.d.ts +42 -2
- package/types/animation.d.ts +37 -17
- package/types/animation_controller.d.ts +8 -2
- package/types/blockbench.d.ts +45 -5
- 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 +23 -1
- package/types/display_mode.d.ts +7 -0
- package/types/format.d.ts +2 -0
- package/types/global.d.ts +28 -0
- package/types/group.d.ts +2 -0
- package/types/io.d.ts +2 -0
- package/types/keyframe.d.ts +29 -4
- package/types/math_util.d.ts +1 -0
- package/types/menu.d.ts +5 -2
- package/types/mesh.d.ts +6 -1
- package/types/misc.d.ts +25 -4
- package/types/mode.d.ts +1 -0
- 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 +5 -1
- package/types/preview.d.ts +4 -1
- package/types/project.d.ts +16 -2
- package/types/screencam.d.ts +3 -0
- package/types/settings.d.ts +53 -5
- package/types/shared_actions.d.ts +78 -0
- package/types/texture_layers.d.ts +118 -0
- package/types/textures.d.ts +246 -1
- package/types/timeline.d.ts +2 -2
- package/types/undo.d.ts +5 -5
- package/types/util.d.ts +32 -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.9.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
|
@@ -16,6 +16,7 @@ async function main() {
|
|
|
16
16
|
entryPoints: [
|
|
17
17
|
"./types/blockbench.d.ts",
|
|
18
18
|
"./types/textures.d.ts",
|
|
19
|
+
"./types/texture_layers.d.ts",
|
|
19
20
|
"./types/action.d.ts",
|
|
20
21
|
"./types/animation.d.ts",
|
|
21
22
|
"./types/animation_controller.d.ts",
|
|
@@ -43,6 +44,7 @@ async function main() {
|
|
|
43
44
|
"./types/painter.d.ts",
|
|
44
45
|
"./types/screencam.d.ts",
|
|
45
46
|
"./types/validator.d.ts",
|
|
47
|
+
"./types/shared_actions.d.ts",
|
|
46
48
|
"./types/display_mode.d.ts",
|
|
47
49
|
"./types/misc.d.ts",
|
|
48
50
|
"./types/util.d.ts"
|
|
@@ -68,13 +70,13 @@ async function main() {
|
|
|
68
70
|
|
|
69
71
|
'Vue.Component': '[Vue.Component](https://v2.vuejs.org/v2/guide/components.html)',
|
|
70
72
|
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
73
|
+
'Vector3': '[THREE.Vector3](https://threejs.org/docs/index.html#api/en/math/Vector3)',
|
|
74
|
+
'Euler': '[THREE.Euler](https://threejs.org/docs/index.html#api/en/math/Euler)',
|
|
75
|
+
'Quaternion': '[THREE.Quaternion](https://threejs.org/docs/index.html#api/en/math/Quaternion)',
|
|
76
|
+
'Object3D': '[THREE.Object3D](https://threejs.org/docs/index.html#api/en/core/Object3D)',
|
|
77
|
+
'PerspectiveCamera': '[THREE.PerspectiveCamera](https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera)',
|
|
78
|
+
'OrthographicCamera': '[THREE.OrthographicCamera](https://threejs.org/docs/index.html#api/en/cameras/OrthographicCamera)',
|
|
79
|
+
'WebGLRenderer': '[THREE.WebGLRenderer](https://threejs.org/docs/index.html#api/en/renderers/WebGLRenderer)',
|
|
78
80
|
|
|
79
81
|
'HTMLElement': '[HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement)',
|
|
80
82
|
'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
|
@@ -5,6 +5,7 @@ declare class AnimationItem {
|
|
|
5
5
|
|
|
6
6
|
interface AnimationOptions {
|
|
7
7
|
name?: string
|
|
8
|
+
path?: string
|
|
8
9
|
loop?: 'once' | 'hold' | 'loop'
|
|
9
10
|
override?: boolean
|
|
10
11
|
anim_time_update?: string
|
|
@@ -27,20 +28,36 @@ declare class _Animation extends AnimationItem {
|
|
|
27
28
|
snapping: any;
|
|
28
29
|
selected: any;
|
|
29
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Compiles the JSON tree of the animation for the Minecraft Bedrock Edition animation format.
|
|
33
|
+
*/
|
|
30
34
|
compileBedrockAnimation(): object;
|
|
31
35
|
save(): this | undefined;
|
|
32
36
|
select(): this | undefined;
|
|
33
37
|
setLength(length: number): void;
|
|
34
|
-
createUniqueName(references:
|
|
38
|
+
createUniqueName(references: _Animation[]): any;
|
|
35
39
|
rename(): this;
|
|
36
40
|
togglePlayingState(state: any): any;
|
|
37
41
|
showContextMenu(event: any): this;
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Returns (if necessary creates) the animator of a specific bone of the animation
|
|
44
|
+
*/
|
|
45
|
+
getBoneAnimator(group: OutlinerNode): BoneAnimator;
|
|
46
|
+
/**
|
|
47
|
+
* Adds the animation to the current project and to the interface
|
|
48
|
+
* @param undo If true, the addition of the animation will be registered as an edit
|
|
49
|
+
*/
|
|
50
|
+
add(undo?: any): this;
|
|
40
51
|
remove(undo: any, remove_from_file?: boolean): this;
|
|
41
52
|
getMaxLength(): number;
|
|
42
53
|
setLoop(value: any, undo: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* 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)
|
|
56
|
+
*/
|
|
43
57
|
calculateSnappingFromKeyframes(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Opens the properties dialog
|
|
60
|
+
*/
|
|
44
61
|
propertiesDialog(): void;
|
|
45
62
|
|
|
46
63
|
name: string
|
|
@@ -70,6 +87,7 @@ declare class _Animation extends AnimationItem {
|
|
|
70
87
|
declare namespace Animator {
|
|
71
88
|
const open: boolean
|
|
72
89
|
const MolangParser: object
|
|
90
|
+
const possible_channels: unknown[];
|
|
73
91
|
const motion_trail: THREE.Object3D
|
|
74
92
|
const motion_trail_lock: boolean
|
|
75
93
|
const particle_effects: object
|
|
@@ -98,13 +116,14 @@ interface AddChannelOptions {
|
|
|
98
116
|
max_data_points?: number
|
|
99
117
|
}
|
|
100
118
|
declare class GeneralAnimator {
|
|
101
|
-
constructor(uuid: string, animation:
|
|
102
|
-
|
|
119
|
+
constructor(uuid: string, animation: _Animation, name: string)
|
|
120
|
+
uuid: string
|
|
121
|
+
keyframes: _Keyframe[]
|
|
103
122
|
select(): this
|
|
104
123
|
addToTimeline(): this
|
|
105
|
-
addKeyframe(data: KeyframeOptions, uuid
|
|
106
|
-
createKeyframe():
|
|
107
|
-
getOrMakeKeyframe(): {before:
|
|
124
|
+
addKeyframe(data: KeyframeOptions, uuid?: string): _Keyframe
|
|
125
|
+
createKeyframe(): _Keyframe
|
|
126
|
+
getOrMakeKeyframe(): {before: _Keyframe, result: _Keyframe}
|
|
108
127
|
toggleMuted(channel: string): this
|
|
109
128
|
scrollTo(): this
|
|
110
129
|
|
|
@@ -114,9 +133,9 @@ declare class GeneralAnimator {
|
|
|
114
133
|
declare class BoneAnimator extends GeneralAnimator {
|
|
115
134
|
name: string
|
|
116
135
|
uuid: string
|
|
117
|
-
rotations:
|
|
118
|
-
position:
|
|
119
|
-
scale:
|
|
136
|
+
rotations: _Keyframe[]
|
|
137
|
+
position: _Keyframe[]
|
|
138
|
+
scale: _Keyframe[]
|
|
120
139
|
getGroup(): Group
|
|
121
140
|
fillValues(): void
|
|
122
141
|
pushKeyframe(): void
|
|
@@ -130,9 +149,9 @@ declare class BoneAnimator extends GeneralAnimator {
|
|
|
130
149
|
declare class NullObjectAnimator extends GeneralAnimator {
|
|
131
150
|
name: string
|
|
132
151
|
uuid: string
|
|
133
|
-
rotations:
|
|
134
|
-
position:
|
|
135
|
-
scale:
|
|
152
|
+
rotations: _Keyframe[]
|
|
153
|
+
position: _Keyframe[]
|
|
154
|
+
scale: _Keyframe[]
|
|
136
155
|
getElement(): NullObject
|
|
137
156
|
doRender(): void
|
|
138
157
|
displayPosition(): void
|
|
@@ -140,11 +159,12 @@ declare class NullObjectAnimator extends GeneralAnimator {
|
|
|
140
159
|
displayFrame(): void
|
|
141
160
|
}
|
|
142
161
|
declare class EffectAnimator extends GeneralAnimator {
|
|
162
|
+
constructor(animation: _Animation)
|
|
143
163
|
name: string
|
|
144
164
|
uuid: string
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
165
|
+
particle: _Keyframe[]
|
|
166
|
+
sound: _Keyframe[]
|
|
167
|
+
timeline: _Keyframe[]
|
|
148
168
|
pushKeyframe(keyframe): this
|
|
149
169
|
displayFrame(in_loop): this
|
|
150
170
|
startPreviousSounds(): void
|
|
@@ -63,7 +63,7 @@ declare class AnimationControllerState {
|
|
|
63
63
|
remove(undo?: boolean): void
|
|
64
64
|
createUniqueName(): void
|
|
65
65
|
|
|
66
|
-
addAnimation(animation?:
|
|
66
|
+
addAnimation(animation?: _Animation): void
|
|
67
67
|
addTransition(target_uuid?: string): void
|
|
68
68
|
addParticle(options?: {effect: string}): void
|
|
69
69
|
addSound(options?: {effect: string, file: string}): 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,10 +1,11 @@
|
|
|
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" />
|
|
6
6
|
|
|
7
7
|
/// <reference types="./textures" />
|
|
8
|
+
/// <reference types="./texture_layers" />
|
|
8
9
|
/// <reference types="./action" />
|
|
9
10
|
/// <reference types="./animation" />
|
|
10
11
|
/// <reference types="./animation_controller" />
|
|
@@ -32,9 +33,13 @@
|
|
|
32
33
|
/// <reference types="./painter" />
|
|
33
34
|
/// <reference types="./screencam" />
|
|
34
35
|
/// <reference types="./validator" />
|
|
36
|
+
/// <reference types="./shared_actions" />
|
|
35
37
|
/// <reference types="./display_mode" />
|
|
36
38
|
/// <reference types="./misc" />
|
|
37
39
|
/// <reference types="./util" />
|
|
40
|
+
/// <reference types="./math_util" />
|
|
41
|
+
/// <reference types="./canvas_frame" />
|
|
42
|
+
/// <reference types="./io" />
|
|
38
43
|
|
|
39
44
|
|
|
40
45
|
|
|
@@ -58,7 +63,7 @@ type WriteType = 'buffer' | 'text' | 'zip' | 'image'
|
|
|
58
63
|
interface WriteOptions {
|
|
59
64
|
content: string | ArrayBuffer
|
|
60
65
|
savetype?: WriteType | ((file: string) => WriteType)
|
|
61
|
-
custom_writer(content: string | ArrayBuffer, file_path: string): void
|
|
66
|
+
custom_writer?(content: string | ArrayBuffer, file_path: string): void
|
|
62
67
|
}
|
|
63
68
|
interface PickDirOptions {
|
|
64
69
|
/**Location where the file dialog starts off
|
|
@@ -189,6 +194,12 @@ declare namespace Blockbench {
|
|
|
189
194
|
export function showStatusMessage(message: string, time?: number): void
|
|
190
195
|
|
|
191
196
|
export function setStatusBarText(text?: string): void
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Display a tooltip displaying a custom text that appears next to and follows the mouse cursor
|
|
200
|
+
* @param text The text to display. Line breaks are supported. Leave empty to hide the tooltip.
|
|
201
|
+
*/
|
|
202
|
+
export function setCursorTooltip(text?: string): void
|
|
192
203
|
/**
|
|
193
204
|
* Set the value of a progress bar
|
|
194
205
|
*
|
|
@@ -204,9 +215,13 @@ declare namespace Blockbench {
|
|
|
204
215
|
/**
|
|
205
216
|
* Opens a message box
|
|
206
217
|
*/
|
|
207
|
-
export function showMessageBox(options: MessageBoxOptions, callback: (
|
|
218
|
+
export function showMessageBox(options: MessageBoxOptions, callback: (button: number | string, checkbox_results: {[key: string]: boolean} | undefined, event: Event) => void): void
|
|
208
219
|
|
|
209
220
|
export function textPrompt(title: string, value: string, callback: (value: string) => void): void
|
|
221
|
+
/**
|
|
222
|
+
* todo
|
|
223
|
+
*/
|
|
224
|
+
export function showToastMessage(): Deletable
|
|
210
225
|
/**
|
|
211
226
|
* Opens the specified link in the browser or in a new tab
|
|
212
227
|
*/
|
|
@@ -232,9 +247,18 @@ declare namespace Blockbench {
|
|
|
232
247
|
export function dispatchEvent(event_name: EventName, data: object): void
|
|
233
248
|
|
|
234
249
|
export function addListener(event_names: EventName, callback: (data: object) => void): void
|
|
250
|
+
/**
|
|
251
|
+
* Adds an event listener
|
|
252
|
+
*/
|
|
235
253
|
export function on(event_names: EventName, callback: (data: object) => void): void
|
|
236
|
-
|
|
237
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Adds a single-use event listener
|
|
256
|
+
*/
|
|
257
|
+
export function once(event_names: EventName, callback: (data: object) => void): void
|
|
258
|
+
/**
|
|
259
|
+
* Removes an event listener
|
|
260
|
+
*/
|
|
261
|
+
export function removeListener(event_names: EventName, callback: (data: object) => void): void
|
|
238
262
|
|
|
239
263
|
|
|
240
264
|
|
|
@@ -274,6 +298,22 @@ declare namespace Blockbench {
|
|
|
274
298
|
export { _export as export };
|
|
275
299
|
|
|
276
300
|
|
|
301
|
+
interface FindFileFromContentOptions {
|
|
302
|
+
read_file?: boolean
|
|
303
|
+
json?: boolean
|
|
304
|
+
recursive?: boolean
|
|
305
|
+
filter_regex?: RegExp
|
|
306
|
+
priority_regex?: RegExp
|
|
307
|
+
}
|
|
308
|
+
type CheckFileCallback = (path: string, content: (string|object)) => any
|
|
309
|
+
/**
|
|
310
|
+
* Find a file in a directory, based on content. Optimized by prioritizing files with certain names.
|
|
311
|
+
* @param base_directories Base directories to search in
|
|
312
|
+
* @param options Options
|
|
313
|
+
* @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.
|
|
314
|
+
*/
|
|
315
|
+
export function findFileFromContent(base_directories: string[], options: FindFileFromContentOptions, check_file: CheckFileCallback): false | any
|
|
316
|
+
|
|
277
317
|
|
|
278
318
|
/**
|
|
279
319
|
* 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
|
|
@@ -8,9 +8,22 @@ interface DialogFormElement {
|
|
|
8
8
|
readonly?: boolean
|
|
9
9
|
/** Add buttons to allow copying and sharing the text or link */
|
|
10
10
|
share_text?: boolean
|
|
11
|
+
/**
|
|
12
|
+
* The default value
|
|
13
|
+
*/
|
|
11
14
|
value?: any
|
|
15
|
+
/**
|
|
16
|
+
* The default selected option for 'select', 'inline_select' and 'radio' types. Alias for 'value'
|
|
17
|
+
*/
|
|
18
|
+
default?: any
|
|
12
19
|
placeholder?: string
|
|
20
|
+
/**
|
|
21
|
+
* When using 'text' type, the text to display. Markdown is supported
|
|
22
|
+
*/
|
|
13
23
|
text?: string
|
|
24
|
+
/**
|
|
25
|
+
* When using 'range' type, allow users to modify the numeric input
|
|
26
|
+
*/
|
|
14
27
|
editable_range_label?: boolean
|
|
15
28
|
colorpicker?: any
|
|
16
29
|
min?: number
|
|
@@ -19,6 +32,14 @@ interface DialogFormElement {
|
|
|
19
32
|
height?: number
|
|
20
33
|
options?: object
|
|
21
34
|
buttons?: string[]
|
|
35
|
+
/**
|
|
36
|
+
* Allow users to toggle the entire option on or off
|
|
37
|
+
*/
|
|
38
|
+
toggle_enabled?: boolean
|
|
39
|
+
/**
|
|
40
|
+
* Set whether the setting is toggled on or off by default. Requires 'toggle_enabled' field to be set to true
|
|
41
|
+
*/
|
|
42
|
+
toggle_default?: boolean
|
|
22
43
|
click?: (button_index: number) => void
|
|
23
44
|
}
|
|
24
45
|
|
|
@@ -97,6 +118,7 @@ interface DialogOptions {
|
|
|
97
118
|
* Unless set to false, clicking on the darkened area outside of the dialog will cancel the dialog.
|
|
98
119
|
*/
|
|
99
120
|
cancel_on_click_outside?: boolean
|
|
121
|
+
width?: number
|
|
100
122
|
}
|
|
101
123
|
|
|
102
124
|
declare class Dialog {
|
package/types/display_mode.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
declare const DisplayMode: {
|
|
2
|
+
slots: string[]
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
interface DisplaySlotOptions {
|
|
2
6
|
rotation?: ArrayVector3
|
|
3
7
|
translation?: ArrayVector3
|
|
@@ -5,6 +9,9 @@ interface DisplaySlotOptions {
|
|
|
5
9
|
mirror?: [boolean, boolean, boolean]
|
|
6
10
|
}
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Display Slots hold the transform values for a specific item slot in the Minecraft Java Edition "Display Mode" feature
|
|
14
|
+
*/
|
|
8
15
|
declare class DisplaySlot {
|
|
9
16
|
constructor(id: string, data: DisplaySlotOptions)
|
|
10
17
|
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/io.d.ts
ADDED