blockbench-types 4.11.0 → 4.12.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 +3 -3
- package/scripts/generate_docs.js +2 -0
- package/tsconfig.json +2 -1
- package/types/action.d.ts +154 -23
- package/types/animation.d.ts +6 -6
- package/types/blockbench.d.ts +16 -7
- package/types/canvas.d.ts +23 -12
- package/types/codec.d.ts +6 -2
- package/types/collection.d.ts +76 -0
- package/types/cube.d.ts +8 -4
- package/types/dialog.d.ts +85 -7
- package/types/format.d.ts +156 -70
- package/types/global.d.ts +10 -3
- package/types/group.d.ts +16 -1
- package/types/keyframe.d.ts +4 -1
- package/types/menu.d.ts +1 -1
- package/types/mesh.d.ts +3 -1
- package/types/misc.d.ts +25 -6
- package/types/mode.d.ts +6 -0
- package/types/molang.d.ts +141 -0
- package/types/outliner.d.ts +36 -9
- package/types/panel.d.ts +3 -2
- package/types/plugin.d.ts +43 -4
- package/types/preview.d.ts +6 -3
- package/types/project.d.ts +0 -3
- package/types/settings.d.ts +1 -1
- package/types/texture_group.d.ts +73 -0
- package/types/textures.d.ts +47 -3
- package/types/three.d.ts +13 -0
- package/types/undo.d.ts +80 -19
- package/types/util.d.ts +15 -0
- package/types/vue.d.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockbench-types",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "Blockbench typescript types",
|
|
5
5
|
"main": "",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"@types/three": "^0.129.2",
|
|
31
31
|
"@types/tinycolor2": "^1.4.6",
|
|
32
32
|
"dompurify": "^3.0.1",
|
|
33
|
-
"electron": "^
|
|
33
|
+
"electron": "^33.3.1",
|
|
34
34
|
"prismjs": "^1.29.0",
|
|
35
35
|
"tinycolor2": "^1.6.0",
|
|
36
36
|
"typescript": "^4.9.5",
|
|
37
|
-
"vue": "
|
|
37
|
+
"vue": "2.7.14",
|
|
38
38
|
"wintersky": "^1.3.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
package/scripts/generate_docs.js
CHANGED
|
@@ -25,6 +25,7 @@ async function main() {
|
|
|
25
25
|
'./types/blockbench.d.ts',
|
|
26
26
|
'./types/textures.d.ts',
|
|
27
27
|
'./types/texture_layers.d.ts',
|
|
28
|
+
'./types/texture_group.d.ts',
|
|
28
29
|
'./types/action.d.ts',
|
|
29
30
|
'./types/animation.d.ts',
|
|
30
31
|
'./types/animation_controller.d.ts',
|
|
@@ -39,6 +40,7 @@ async function main() {
|
|
|
39
40
|
'./types/legacy.d.ts',
|
|
40
41
|
'./types/menu.d.ts',
|
|
41
42
|
'./types/outliner.d.ts',
|
|
43
|
+
'./types/collection.d.ts',
|
|
42
44
|
'./types/group.d.ts',
|
|
43
45
|
'./types/cube.d.ts',
|
|
44
46
|
'./types/mesh.d.ts',
|
package/tsconfig.json
CHANGED
package/types/action.d.ts
CHANGED
|
@@ -11,31 +11,114 @@ declare interface KeybindKeys {
|
|
|
11
11
|
* Main key, can be a numeric keycode or a lower case character
|
|
12
12
|
*/
|
|
13
13
|
key: number | string
|
|
14
|
-
ctrl?: boolean
|
|
15
|
-
shift?: boolean
|
|
16
|
-
alt?: boolean
|
|
17
|
-
meta?: boolean
|
|
14
|
+
ctrl?: boolean
|
|
15
|
+
shift?: boolean
|
|
16
|
+
alt?: boolean
|
|
17
|
+
meta?: boolean
|
|
18
18
|
}
|
|
19
|
+
type VariationModifier = 'always' | 'ctrl' | 'shift' | 'alt' | 'meta' | 'unless_ctrl' | 'unless_shift' | 'unless_alt'
|
|
20
|
+
type ModifierKey = 'ctrl' | 'shift' | 'alt' | 'meta'
|
|
19
21
|
/**
|
|
20
22
|
* A customizable keybind
|
|
21
23
|
*/
|
|
22
24
|
declare class Keybind {
|
|
23
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Create a keybind
|
|
27
|
+
* @param {object} keys Set up the default keys that need to be pressed
|
|
28
|
+
* @param {number|string} keys.key Main key. Check keycode.info to find out the numeric value, or simply use letters for letter keys
|
|
29
|
+
* @param {boolean} keys.ctrl Control key. On MacOS this automatically works for Cmd
|
|
30
|
+
* @param {boolean} keys.shift Shift key
|
|
31
|
+
* @param {boolean} keys.alt Alt key
|
|
32
|
+
* @param {boolean} keys.meta Meta key
|
|
33
|
+
*/
|
|
34
|
+
constructor(keys: KeybindKeys, variations?: Record<string, VariationModifier>)
|
|
24
35
|
key: number
|
|
25
36
|
ctrl?: boolean
|
|
26
37
|
shift?: boolean
|
|
27
38
|
alt?: boolean
|
|
39
|
+
variations?: {
|
|
40
|
+
[key: string]: {name: string, description?: string}
|
|
41
|
+
}
|
|
42
|
+
set(keys: KeybindKeys): this;
|
|
43
|
+
/**
|
|
44
|
+
* Unassign the assigned key
|
|
45
|
+
*/
|
|
46
|
+
clear(): this;
|
|
47
|
+
/**
|
|
48
|
+
* Save any changes to local storage
|
|
49
|
+
* @param save Save all keybinding changes to local storage. Set to fales if updating multiple at once
|
|
50
|
+
*/
|
|
51
|
+
save(save?: false): this;
|
|
52
|
+
/**
|
|
53
|
+
* Assign an action to the keybind
|
|
54
|
+
* @param id ID of the action
|
|
55
|
+
* @param sub_id sub keybind ID
|
|
56
|
+
*/
|
|
57
|
+
setAction(id: string, sub_id?: string): this | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get display text showing the keybind
|
|
60
|
+
* @param formatted If true, the return string will include HTML formatting
|
|
61
|
+
*/
|
|
62
|
+
getText(formatted?: boolean): string;
|
|
28
63
|
/**
|
|
29
64
|
* Get the name of the bound key
|
|
30
65
|
*/
|
|
31
|
-
getCode(): string
|
|
66
|
+
getCode(key: string): string
|
|
67
|
+
/**
|
|
68
|
+
* Check if a key is assigned
|
|
69
|
+
*/
|
|
70
|
+
hasKey(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Test if the keybind would be triggered by the event
|
|
73
|
+
*/
|
|
74
|
+
isTriggered(event: Event): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Test which variation would be triggered by the event. Returns the ID of the variation if triggered
|
|
77
|
+
* @param event The event to test
|
|
78
|
+
*/
|
|
79
|
+
additionalModifierTriggered(event: Event): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Test if a variation would be triggered by the event
|
|
82
|
+
* @param event The event to test
|
|
83
|
+
* @param variation The variation to test againts
|
|
84
|
+
*/
|
|
85
|
+
additionalModifierTriggered(event: Event, variation: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Open a UI to let the user record a new key combination
|
|
88
|
+
*/
|
|
89
|
+
record(): this;
|
|
90
|
+
/**
|
|
91
|
+
* Stop recording a new key combination
|
|
92
|
+
*/
|
|
93
|
+
stopRecording(): this;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the label of the keybinding
|
|
96
|
+
*/
|
|
97
|
+
toString(): string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Load an included keymap by ID
|
|
101
|
+
* @param id
|
|
102
|
+
* @param from_start_screen
|
|
103
|
+
*/
|
|
104
|
+
static loadKeymap(id: string, from_start_screen?: boolean): void | true
|
|
105
|
+
/**
|
|
106
|
+
* Check if two KeybindItems are mutually exclusive, so only one can be available at the time. This is only the case if they each have a ConditionResolvable that is structured to support this
|
|
107
|
+
*/
|
|
108
|
+
static no_overlap(k1: KeybindItem, k2: KeybindItem): boolean
|
|
32
109
|
}
|
|
33
110
|
interface KeybindItemOptions {
|
|
34
111
|
keybind?: Keybind
|
|
112
|
+
variations?: {
|
|
113
|
+
[key: string]: {name: string, description?: string}
|
|
114
|
+
}
|
|
35
115
|
}
|
|
36
116
|
declare class KeybindItem extends Deletable {
|
|
37
117
|
constructor(id: string, options: KeybindItemOptions)
|
|
38
118
|
keybind: Keybind
|
|
119
|
+
variations?: {
|
|
120
|
+
[key: string]: {name: string, description?: string}
|
|
121
|
+
}
|
|
39
122
|
}
|
|
40
123
|
|
|
41
124
|
declare class MenuSeparator {
|
|
@@ -55,7 +138,7 @@ type ActionEventName =
|
|
|
55
138
|
interface BarItemOptions extends KeybindItemOptions {
|
|
56
139
|
name?: string
|
|
57
140
|
description?: string
|
|
58
|
-
icon
|
|
141
|
+
icon?: string
|
|
59
142
|
condition?: ConditionResolvable
|
|
60
143
|
category?: string
|
|
61
144
|
keybind?: Keybind
|
|
@@ -66,6 +149,8 @@ interface BarItemOptions extends KeybindItemOptions {
|
|
|
66
149
|
declare class BarItem extends KeybindItem {
|
|
67
150
|
constructor(id: string, options: BarItemOptions)
|
|
68
151
|
id: string
|
|
152
|
+
node: HTMLElement
|
|
153
|
+
nodes: HTMLElement[]
|
|
69
154
|
conditionMet(): boolean
|
|
70
155
|
/**
|
|
71
156
|
* Adds a label to the HTML element of the bar item
|
|
@@ -101,7 +186,6 @@ declare class BarItem extends KeybindItem {
|
|
|
101
186
|
* @param callback
|
|
102
187
|
*/
|
|
103
188
|
removeListener(event_name: ActionEventName, callback: (data: object) => void): void
|
|
104
|
-
dispatchEvent(data: object): void
|
|
105
189
|
constructor(id: string, options: BarItemOptions)
|
|
106
190
|
conditionMet(): boolean
|
|
107
191
|
/**
|
|
@@ -119,6 +203,8 @@ declare class BarItem extends KeybindItem {
|
|
|
119
203
|
*/
|
|
120
204
|
toElement(destination: HTMLElement): this
|
|
121
205
|
pushToolbar(bar: any): void
|
|
206
|
+
|
|
207
|
+
dispatchEvent<T = EventName>(event: T, ...args: any[]): void
|
|
122
208
|
}
|
|
123
209
|
|
|
124
210
|
interface ActionOptions extends BarItemOptions {
|
|
@@ -139,6 +225,14 @@ interface ActionOptions extends BarItemOptions {
|
|
|
139
225
|
* Show the full label in toolbars
|
|
140
226
|
*/
|
|
141
227
|
label?: boolean
|
|
228
|
+
/**
|
|
229
|
+
* Provide a menu that belongs to the action, and gets displayed as a small arrow next to it in toolbars.
|
|
230
|
+
*/
|
|
231
|
+
side_menu?: Menu
|
|
232
|
+
/**
|
|
233
|
+
* Provide a window with additional configutation related to the action
|
|
234
|
+
*/
|
|
235
|
+
tool_config?: ToolConfig
|
|
142
236
|
}
|
|
143
237
|
/**
|
|
144
238
|
* Actions can be triggered to run something, they can be added to menus, toolbars, assigned a keybinding, or run via Action Control
|
|
@@ -149,7 +243,11 @@ declare class Action extends BarItem {
|
|
|
149
243
|
/**
|
|
150
244
|
* Provide a menu that belongs to the action, and gets displayed as a small arrow next to it in toolbars.
|
|
151
245
|
*/
|
|
152
|
-
side_menu?: Menu
|
|
246
|
+
side_menu?: Menu | ToolConfig
|
|
247
|
+
/**
|
|
248
|
+
* Provide a window with additional configutation related to the action
|
|
249
|
+
*/
|
|
250
|
+
tool_config?: ToolConfig
|
|
153
251
|
click: ActionOptions['click']
|
|
154
252
|
|
|
155
253
|
condition?(): boolean
|
|
@@ -176,11 +274,14 @@ interface ToggleOptions extends ActionOptions {
|
|
|
176
274
|
* A toggle is a type of action that can be on or off. The state is not persistent between restarts by default.
|
|
177
275
|
*/
|
|
178
276
|
declare class Toggle extends Action {
|
|
277
|
+
value: boolean
|
|
179
278
|
constructor(id: string, options: ToggleOptions)
|
|
180
279
|
/**
|
|
181
280
|
* Updates the state of the toggle in the UI
|
|
182
281
|
*/
|
|
183
282
|
updateEnabledState(): void
|
|
283
|
+
set(value: boolean): this
|
|
284
|
+
setIcon(icon: IconString): void
|
|
184
285
|
}
|
|
185
286
|
|
|
186
287
|
type RGBAColor = { r: number; g: number; b: number; a: number }
|
|
@@ -324,6 +425,9 @@ interface ToolOptions extends ActionOptions {
|
|
|
324
425
|
paintTool?: boolean
|
|
325
426
|
brush?: BrushOptions
|
|
326
427
|
}
|
|
428
|
+
interface WidgetOptions extends BarItemOptions {
|
|
429
|
+
id?: string
|
|
430
|
+
}
|
|
327
431
|
/**
|
|
328
432
|
* A tool, such as move tool, vertex snap tool, or paint brush
|
|
329
433
|
*/
|
|
@@ -334,10 +438,21 @@ declare class Tool extends Action {
|
|
|
334
438
|
trigger(event: Event): boolean
|
|
335
439
|
}
|
|
336
440
|
declare class Widget extends BarItem {
|
|
337
|
-
constructor(id: string, options:
|
|
441
|
+
constructor(id: string, options: WidgetOptions)
|
|
442
|
+
}
|
|
443
|
+
type NumSliderOptions = WidgetOptions & {
|
|
444
|
+
settings?: {
|
|
445
|
+
default?: number
|
|
446
|
+
min?: number
|
|
447
|
+
max?: number
|
|
448
|
+
interval?: number
|
|
449
|
+
step?: number
|
|
450
|
+
}
|
|
451
|
+
change?(value: (n: number) => number): void
|
|
452
|
+
get?(): number
|
|
338
453
|
}
|
|
339
454
|
declare class NumSlider extends Widget {
|
|
340
|
-
constructor(id: string, options:
|
|
455
|
+
constructor(id: string, options: NumSliderOptions)
|
|
341
456
|
startInput(event: Event): void
|
|
342
457
|
setWidth(width: any): this
|
|
343
458
|
getInterval(event: Event): number
|
|
@@ -346,42 +461,57 @@ declare class NumSlider extends Widget {
|
|
|
346
461
|
stopInput(): void
|
|
347
462
|
arrow(difference: any, event: Event): void
|
|
348
463
|
trigger(event: Event): boolean
|
|
349
|
-
setValue(value: number, trim
|
|
350
|
-
change(modify:
|
|
464
|
+
setValue(value: number, trim?: any): this
|
|
465
|
+
change(modify: (n: number) => number): void
|
|
351
466
|
get(): number
|
|
352
467
|
update(): void
|
|
353
468
|
}
|
|
354
469
|
declare class BarSlider extends Widget {
|
|
355
|
-
constructor(id: string, options:
|
|
470
|
+
constructor(id: string, options: NumSliderOptions)
|
|
356
471
|
change(event: Event): void
|
|
357
472
|
set(value: number): void
|
|
358
473
|
get(): number
|
|
359
474
|
}
|
|
360
|
-
|
|
361
|
-
|
|
475
|
+
interface BarSelectOptions<T> extends WidgetOptions {
|
|
476
|
+
value?: T
|
|
477
|
+
options: Record<string, T>
|
|
478
|
+
}
|
|
479
|
+
declare class BarSelect<T> extends Widget {
|
|
480
|
+
constructor(id: string, options: BarSelectOptions<T>)
|
|
362
481
|
open(event: Event): void
|
|
363
482
|
trigger(event: Event): boolean | undefined
|
|
364
|
-
change(event: Event): this
|
|
483
|
+
change(value: T, event: Event): this
|
|
365
484
|
getNameFor(key: string): string
|
|
366
485
|
set(key: string): this
|
|
367
486
|
get(): string
|
|
487
|
+
value: T
|
|
368
488
|
}
|
|
369
489
|
declare class BarText extends Widget {
|
|
370
|
-
constructor(
|
|
490
|
+
constructor(
|
|
491
|
+
id: string,
|
|
492
|
+
options: WidgetOptions & {
|
|
493
|
+
text: string
|
|
494
|
+
}
|
|
495
|
+
)
|
|
371
496
|
set(text: any): this
|
|
372
497
|
update(): this
|
|
373
498
|
trigger(event: Event): boolean
|
|
374
499
|
}
|
|
375
|
-
interface ColorPickerOptions {
|
|
376
|
-
|
|
500
|
+
interface ColorPickerOptions extends WidgetOptions {
|
|
501
|
+
value?: string
|
|
502
|
+
palette?: boolean
|
|
503
|
+
onChange?: (color: tinycolor.Instance) => void
|
|
377
504
|
}
|
|
378
505
|
declare class ColorPicker extends Widget {
|
|
379
|
-
|
|
380
|
-
|
|
506
|
+
value: tinycolor.Instance
|
|
507
|
+
jq: JQuery
|
|
508
|
+
constructor(options: ColorPickerOptions)
|
|
509
|
+
constructor(id: string, options: ColorPickerOptions)
|
|
510
|
+
change(color: tinycolor.Instance): void
|
|
381
511
|
hide(): void
|
|
382
512
|
confirm(): void
|
|
383
513
|
set(color: any): this
|
|
384
|
-
get():
|
|
514
|
+
get(): tinycolor.Instance
|
|
385
515
|
}
|
|
386
516
|
interface ToolbarOptions {
|
|
387
517
|
id: string
|
|
@@ -413,6 +543,7 @@ declare class Toolbar {
|
|
|
413
543
|
toPlace(place: any): this
|
|
414
544
|
save(): this
|
|
415
545
|
reset(): this
|
|
546
|
+
condition(): boolean
|
|
416
547
|
}
|
|
417
548
|
declare namespace BARS {
|
|
418
549
|
const stored: {}
|
package/types/animation.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ interface AnimationOptions {
|
|
|
16
16
|
blend_weight?: string
|
|
17
17
|
length?: number
|
|
18
18
|
snapping?: number
|
|
19
|
+
animators?: any
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
interface AnimationUndoCopy {
|
|
@@ -85,7 +86,7 @@ declare class _Animation extends AnimationItem {
|
|
|
85
86
|
|
|
86
87
|
markers: TimelineMarker[]
|
|
87
88
|
animators: {
|
|
88
|
-
[id: string]: GeneralAnimator
|
|
89
|
+
[id: string]: GeneralAnimator
|
|
89
90
|
}
|
|
90
91
|
saved_name?: string
|
|
91
92
|
selected: boolean
|
|
@@ -176,10 +177,10 @@ declare class BoneAnimator extends GeneralAnimator {
|
|
|
176
177
|
fillValues(): void
|
|
177
178
|
pushKeyframe(): void
|
|
178
179
|
doRender(): boolean
|
|
179
|
-
displayRotation(): void
|
|
180
|
-
displayPosition():
|
|
181
|
-
displayScale(): void
|
|
182
|
-
interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3
|
|
180
|
+
displayRotation(arr?: ArrayVector3 | ArrayVector4, multiplier?: number): void
|
|
181
|
+
displayPosition(arr?: ArrayVector3, multiplier?: number): this
|
|
182
|
+
displayScale(arr?: ArrayVector3, multiplier?: number): void
|
|
183
|
+
interpolate(channel: string, allow_expression?: boolean, axis?: string): ArrayVector3 | false
|
|
183
184
|
displayFrame(multiplier?: number): void
|
|
184
185
|
}
|
|
185
186
|
declare class NullObjectAnimator extends GeneralAnimator {
|
|
@@ -190,7 +191,6 @@ declare class NullObjectAnimator extends GeneralAnimator {
|
|
|
190
191
|
scale: _Keyframe[]
|
|
191
192
|
getElement(): NullObject
|
|
192
193
|
doRender(): void
|
|
193
|
-
displayPosition(): void
|
|
194
194
|
displayIK(): void
|
|
195
195
|
displayFrame(): void
|
|
196
196
|
}
|
package/types/blockbench.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="vue" />
|
|
2
|
-
/// <reference types="
|
|
2
|
+
/// <reference types="./three.d.ts" />
|
|
3
3
|
/// <reference types="@types/prismjs" />
|
|
4
4
|
/// <reference types="@types/jquery" />
|
|
5
5
|
/// <reference types="wintersky" />
|
|
6
6
|
|
|
7
7
|
/// <reference types="./texture_layers" />
|
|
8
|
+
/// <reference types="./texture_group" />
|
|
8
9
|
/// <reference types="./action" />
|
|
9
10
|
/// <reference types="./animation" />
|
|
10
11
|
/// <reference types="./animation_controller" />
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
/// <reference types="./mode" />
|
|
30
31
|
/// <reference types="./molang" />
|
|
31
32
|
/// <reference types="./outliner" />
|
|
33
|
+
/// <reference types="./collection" />
|
|
32
34
|
/// <reference types="./painter" />
|
|
33
35
|
/// <reference types="./panel" />
|
|
34
36
|
/// <reference types="./plugin" />
|
|
@@ -50,7 +52,6 @@
|
|
|
50
52
|
/// <reference types="./math_util" />
|
|
51
53
|
/// <reference types="./canvas_frame" />
|
|
52
54
|
/// <reference types="./io" />
|
|
53
|
-
/// <reference types="./vue" />
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
|
|
@@ -313,7 +314,10 @@ declare namespace Blockbench {
|
|
|
313
314
|
* Blockbench.removeListener<EventName>(...)
|
|
314
315
|
* ```
|
|
315
316
|
*/
|
|
316
|
-
export function removeListener<E extends string>(
|
|
317
|
+
export function removeListener<E extends string>(
|
|
318
|
+
event_names: E,
|
|
319
|
+
callback: (data: any) => void
|
|
320
|
+
): void
|
|
317
321
|
|
|
318
322
|
/**
|
|
319
323
|
* Reads the content from the specified files. Desktop app only.
|
|
@@ -390,6 +394,7 @@ type BlockbenchTypeFace = typeof Face
|
|
|
390
394
|
type BlockbenchTypeCubeFace = typeof CubeFace
|
|
391
395
|
type BlockbenchTypeMeshFace = typeof MeshFace
|
|
392
396
|
type BlockbenchTypeNodePreviewController = typeof NodePreviewController
|
|
397
|
+
type BlockbenchTypeCollection = typeof Collection
|
|
393
398
|
type BlockbenchTypeAnimator = typeof Animator
|
|
394
399
|
type BlockbenchTypeTimeline = typeof Timeline
|
|
395
400
|
type BlockbenchTypeAnimationItem = typeof AnimationItem
|
|
@@ -450,6 +455,7 @@ declare namespace Blockbench {
|
|
|
450
455
|
const CubeFace: BlockbenchTypeCubeFace
|
|
451
456
|
const MeshFace: BlockbenchTypeMeshFace
|
|
452
457
|
const NodePreviewController: BlockbenchTypeNodePreviewController
|
|
458
|
+
const Collection: BlockbenchTypeCollection
|
|
453
459
|
const Animator: BlockbenchTypeAnimator
|
|
454
460
|
const Timeline: BlockbenchTypeTimeline
|
|
455
461
|
const AnimationItem: BlockbenchTypeAnimationItem
|
|
@@ -500,7 +506,10 @@ declare namespace Blockbench {
|
|
|
500
506
|
|
|
501
507
|
declare const NativeGlobals: {
|
|
502
508
|
Animation: {
|
|
503
|
-
new (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
509
|
+
new (
|
|
510
|
+
effect?: AnimationEffect | null | undefined,
|
|
511
|
+
timeline?: AnimationTimeline | null | undefined
|
|
512
|
+
): Animation
|
|
513
|
+
prototype: Animation
|
|
514
|
+
}
|
|
515
|
+
}
|
package/types/canvas.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ declare namespace Canvas {
|
|
|
93
93
|
const global_light_color: THREE.Color
|
|
94
94
|
const global_light_side: number
|
|
95
95
|
|
|
96
|
-
const face_order:
|
|
96
|
+
const face_order: ['east', 'west', 'up', 'down', 'south', 'north']
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Raycast on the currently selected preview
|
|
@@ -152,7 +152,7 @@ declare namespace Canvas {
|
|
|
152
152
|
/**
|
|
153
153
|
* Update positions and shapes of the selected elements
|
|
154
154
|
*/
|
|
155
|
-
function updatePositions(y
|
|
155
|
+
function updatePositions(y?: number): void
|
|
156
156
|
/**
|
|
157
157
|
* Update the faces of all selected elements (material, UV map)
|
|
158
158
|
*/
|
|
@@ -215,16 +215,26 @@ declare namespace Canvas {
|
|
|
215
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.
|
|
216
216
|
*/
|
|
217
217
|
declare namespace TickUpdates {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
let outliner: undefined | true
|
|
219
|
+
let selection: undefined | true
|
|
220
|
+
let main_uv: undefined | true
|
|
221
|
+
let texture_list: undefined | true
|
|
222
|
+
let keyframes: undefined | true
|
|
223
|
+
let keyframe_selection: undefined | true
|
|
224
|
+
let keybind_conflicts: undefined | true
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
interface NodePreviewControllerOptions {
|
|
228
|
+
/**
|
|
229
|
+
* NOTE: This option is just for type checking and should not be set in the options object. It should be set inside of the setup function via `this.mesh`
|
|
230
|
+
*
|
|
231
|
+
* ```
|
|
232
|
+
* setup(element) {
|
|
233
|
+
* this.mesh = new THREE.Mesh()
|
|
234
|
+
* }
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
mesh?: THREE.Object3D | THREE.Mesh
|
|
228
238
|
setup?(element: OutlinerNode): void
|
|
229
239
|
remove?(element: OutlinerNode): void
|
|
230
240
|
updateAll?(element: OutlinerNode): void
|
|
@@ -235,14 +245,15 @@ interface NodePreviewControllerOptions {
|
|
|
235
245
|
updateUV?(element: OutlinerNode): void
|
|
236
246
|
updateFaces?(element: OutlinerNode): void
|
|
237
247
|
updatePaintingGrid?(element: OutlinerNode): void
|
|
238
|
-
updateHighlight?(element: OutlinerNode): void
|
|
248
|
+
updateHighlight?(element: OutlinerNode, ...args: any[]): void
|
|
239
249
|
}
|
|
240
250
|
declare class NodePreviewController {
|
|
241
|
-
constructor(type: typeof OutlinerNode, options: NodePreviewControllerOptions)
|
|
251
|
+
constructor(type: typeof OutlinerElement | typeof OutlinerNode, options: NodePreviewControllerOptions)
|
|
242
252
|
type: typeof OutlinerNode
|
|
243
253
|
events: {
|
|
244
254
|
[event_name: string]: ((data: any) => void)[]
|
|
245
255
|
}
|
|
256
|
+
mesh: THREE.Object3D | THREE.Mesh
|
|
246
257
|
dispatchEvent(event_name: string, data: Record<string, any>): void
|
|
247
258
|
/**
|
|
248
259
|
* Adds an event listener
|
|
@@ -267,5 +278,5 @@ declare class NodePreviewController {
|
|
|
267
278
|
updateUV(instance: OutlinerNode): void
|
|
268
279
|
updateFaces(instance: OutlinerNode): void
|
|
269
280
|
updatePaintingGrid(instance: OutlinerNode): void
|
|
270
|
-
updateHighlight(instance: OutlinerNode): void
|
|
281
|
+
updateHighlight(instance: OutlinerNode, ...args: any[]): void
|
|
271
282
|
}
|
package/types/codec.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ interface CodecOptions {
|
|
|
14
14
|
overwrite?(content: any, path: string, callback: (path: any) => void): void
|
|
15
15
|
afterDownload?(path: any): void
|
|
16
16
|
afterSave?(path: any): void
|
|
17
|
+
exportCollection?(collection: Collection): void
|
|
18
|
+
writeCollection?(collection: Collection): void
|
|
17
19
|
|
|
18
20
|
dispatchEvent?(event_name: string, data: any): void
|
|
19
21
|
|
|
@@ -31,7 +33,7 @@ interface CodecOptions {
|
|
|
31
33
|
* List of export option inputs, based on the Dialog form API
|
|
32
34
|
*/
|
|
33
35
|
export_options?: {
|
|
34
|
-
[key: string]:
|
|
36
|
+
[key: string]: FormElement
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Default action that is used to export to the codec
|
|
@@ -89,6 +91,8 @@ declare class Codec extends Deletable {
|
|
|
89
91
|
overwrite(content: any, path: string, callback: (path: string) => void): void
|
|
90
92
|
afterDownload(path: string): void
|
|
91
93
|
afterSave(path: string): void
|
|
94
|
+
exportCollection(collection: Collection): void
|
|
95
|
+
writeCollection(collection: Collection): void
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* Return the stored export option values of the current project
|
|
@@ -140,7 +144,7 @@ declare class Codec extends Deletable {
|
|
|
140
144
|
* List of export option inputs
|
|
141
145
|
*/
|
|
142
146
|
export_options: {
|
|
143
|
-
[key: string]:
|
|
147
|
+
[key: string]: FormElement
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
format: ModelFormat
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
interface CollectionOptions {
|
|
2
|
+
children?: string[]
|
|
3
|
+
name?: string
|
|
4
|
+
export_codec?: string
|
|
5
|
+
export_path?: string
|
|
6
|
+
visibility?: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Collections are "selection presets" for a set of groups and elements in your project, independent from outliner hierarchy
|
|
11
|
+
*/
|
|
12
|
+
declare class Collection {
|
|
13
|
+
constructor(data?: CollectionOptions, uuid?: string);
|
|
14
|
+
|
|
15
|
+
selected: boolean
|
|
16
|
+
/**
|
|
17
|
+
* List of direct children, referenced by UUIDs
|
|
18
|
+
*/
|
|
19
|
+
children: string[]
|
|
20
|
+
name: string
|
|
21
|
+
export_codec: string
|
|
22
|
+
export_path: string
|
|
23
|
+
visibility: boolean
|
|
24
|
+
|
|
25
|
+
extend(data: CollectionOptions): this;
|
|
26
|
+
select(event?: Event): this;
|
|
27
|
+
clickSelect(event: Event): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get all direct children
|
|
30
|
+
*/
|
|
31
|
+
getChildren(): OutlinerNode[];
|
|
32
|
+
add(): this;
|
|
33
|
+
/**
|
|
34
|
+
* Adds the current outliner selection to this collection
|
|
35
|
+
*/
|
|
36
|
+
addSelection(): this;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the visibility of the first contained node that supports visibility. Otherwise returns true.
|
|
39
|
+
*/
|
|
40
|
+
getVisibility(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get all children, including indirect ones
|
|
43
|
+
*/
|
|
44
|
+
getAllChildren(): any[];
|
|
45
|
+
/**
|
|
46
|
+
* Toggle visibility of everything in the collection
|
|
47
|
+
* @param event If the alt key is pressed, the result is inverted and the visibility of everything but the collection will be toggled
|
|
48
|
+
*/
|
|
49
|
+
toggleVisibility(event: Event): void;
|
|
50
|
+
/**
|
|
51
|
+
* Opens the context menu
|
|
52
|
+
*/
|
|
53
|
+
showContextMenu(event: Event): this;
|
|
54
|
+
getUndoCopy(): {
|
|
55
|
+
uuid: string;
|
|
56
|
+
index: number;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
59
|
+
getSaveCopy(): {
|
|
60
|
+
uuid: string;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Opens the properties dialog
|
|
65
|
+
*/
|
|
66
|
+
propertiesDialog(): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get all collections
|
|
70
|
+
*/
|
|
71
|
+
static all(): Collection[]
|
|
72
|
+
/**
|
|
73
|
+
* Get selected collections
|
|
74
|
+
*/
|
|
75
|
+
static selected(): Collection[]
|
|
76
|
+
}
|