blockbench-types 4.9.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +1 -0
- package/.prettierrc.json +9 -0
- package/README.md +1 -0
- package/package.json +43 -33
- package/scripts/generate_docs.js +243 -196
- package/tsconfig.json +13 -14
- package/types/action.d.ts +358 -279
- package/types/animation.d.ts +181 -147
- package/types/animation_controller.d.ts +105 -99
- package/types/blockbench.d.ts +136 -76
- package/types/canvas.d.ts +239 -228
- package/types/canvas_frame.d.ts +2 -2
- package/types/codec.d.ts +36 -32
- package/types/cube.d.ts +32 -11
- package/types/desktop.d.ts +14 -0
- package/types/dialog.d.ts +143 -38
- package/types/display_mode.d.ts +9 -6
- package/types/file_system.d.ts +159 -0
- package/types/format.d.ts +46 -12
- package/types/global.d.ts +49 -3
- package/types/group.d.ts +16 -5
- package/types/index.d.ts +1 -0
- package/types/interface.d.ts +21 -12
- package/types/io.d.ts +2 -2
- package/types/keyframe.d.ts +72 -58
- package/types/legacy.d.ts +2 -1
- package/types/math_util.d.ts +1 -1
- package/types/menu.d.ts +93 -78
- package/types/mesh.d.ts +89 -64
- package/types/misc.d.ts +114 -47
- package/types/mode.d.ts +14 -1
- package/types/molang.d.ts +17 -0
- package/types/outliner.d.ts +42 -23
- package/types/painter.d.ts +49 -11
- package/types/panel.d.ts +49 -21
- package/types/plugin.d.ts +28 -0
- package/types/preview.d.ts +71 -69
- package/types/preview_scene.d.ts +11 -12
- package/types/project.d.ts +54 -37
- package/types/screencam.d.ts +11 -6
- package/types/settings.d.ts +87 -85
- package/types/shared_actions.d.ts +25 -9
- package/types/texture_layers.d.ts +104 -105
- package/types/textures.d.ts +322 -313
- package/types/timeline.d.ts +60 -60
- package/types/undo.d.ts +107 -103
- package/types/util.d.ts +152 -37
- package/types/uveditor.d.ts +3 -0
- package/types/validator.d.ts +3 -2
- package/types/vue.d.ts +7 -0
package/types/outliner.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
type ArrayVector4 = [number, number, number, number]
|
|
2
3
|
type ArrayVector3 = [number, number, number]
|
|
3
4
|
type ArrayVector2 = [number, number]
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
declare const elements: OutlinerNode[]
|
|
6
7
|
/**
|
|
7
8
|
* @private
|
|
8
9
|
*/
|
|
9
10
|
declare class OutlinerNode {
|
|
10
|
-
|
|
11
|
-
uuid: UUID
|
|
11
|
+
static properties: Record<string, Property<any>>
|
|
12
|
+
constructor(uuid: UUID)
|
|
12
13
|
name: string
|
|
14
|
+
uuid: UUID
|
|
13
15
|
export: boolean
|
|
14
16
|
locked: boolean
|
|
15
|
-
parent
|
|
17
|
+
parent?: Group | 'root'
|
|
18
|
+
menu?: Menu
|
|
16
19
|
/**
|
|
17
20
|
* Initializes the node. This should always be called when creating nodes that will be used in the outliner.
|
|
18
21
|
*/
|
|
@@ -39,21 +42,23 @@ declare class OutlinerNode {
|
|
|
39
42
|
/**
|
|
40
43
|
* Saves the changed name of the element by creating an undo point and making the name unique if necessary.
|
|
41
44
|
*/
|
|
42
|
-
saveName(): this
|
|
45
|
+
saveName(save?: boolean): this
|
|
43
46
|
/**
|
|
44
47
|
* Create a unique name for the group or element by adding a number at the end or increasing it.
|
|
45
48
|
*/
|
|
46
|
-
createUniqueName(): this
|
|
49
|
+
createUniqueName(others?: OutlinerNode[]): this
|
|
47
50
|
/**
|
|
48
51
|
* Checks of the group or element is a child of `group`.
|
|
49
52
|
* @param max_levels The maximum number of generations that can be between the element and the group
|
|
50
53
|
*/
|
|
51
|
-
isChildOf(
|
|
54
|
+
isChildOf(group: Group, max_levels: number): boolean
|
|
52
55
|
/**
|
|
53
56
|
* Displays the context menu of the element
|
|
54
57
|
* @param event Mouse event, determines where the context menu spawns.
|
|
55
58
|
*/
|
|
56
59
|
showContexnu(event: Event | HTMLElement): this
|
|
60
|
+
getSaveCopy?(project?: boolean): OutlinerNode
|
|
61
|
+
sanitizeName(): string
|
|
57
62
|
|
|
58
63
|
static uuids: {
|
|
59
64
|
[uuid: UUID]: OutlinerNode
|
|
@@ -64,23 +69,29 @@ declare class OutlinerNode {
|
|
|
64
69
|
* @private
|
|
65
70
|
*/
|
|
66
71
|
declare class OutlinerElement extends OutlinerNode {
|
|
67
|
-
|
|
72
|
+
static animator?: BoneAnimator
|
|
73
|
+
constructor(data: any, uuid: string)
|
|
68
74
|
selected: boolean
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
static fromSave: (data: object, keep_uuid?: boolean) => OutlinerElement
|
|
75
|
+
mesh: THREE.Object3D | THREE.Mesh
|
|
76
|
+
static fromSave(data: any, keep_uuid?: boolean): OutlinerElement
|
|
72
77
|
static isParent: false
|
|
78
|
+
static types: Record<string, typeof OutlinerElement>
|
|
79
|
+
static all: OutlinerElement[]
|
|
80
|
+
static selected: OutlinerElement[]
|
|
81
|
+
static registerType(constructor: any, id: string): void
|
|
82
|
+
select(event?: any, isOutlinerClick?: boolean): this | void
|
|
83
|
+
unselect(...args: any[]): this | void
|
|
73
84
|
}
|
|
74
85
|
|
|
75
86
|
interface LocatorOptions {
|
|
76
87
|
name: string
|
|
77
88
|
from: ArrayVector3
|
|
78
|
-
|
|
79
89
|
}
|
|
80
90
|
declare class Locator extends OutlinerElement {
|
|
81
|
-
constructor
|
|
91
|
+
constructor(options: Partial<LocatorOptions>, uuid?: string)
|
|
92
|
+
name: string
|
|
82
93
|
|
|
83
|
-
extend(options: Partial<LocatorOptions>)
|
|
94
|
+
extend(options: Partial<LocatorOptions>): void
|
|
84
95
|
flip(axis: number, center: number): this
|
|
85
96
|
getWorldCenter(): THREE.Vector3
|
|
86
97
|
|
|
@@ -92,21 +103,19 @@ declare class Locator extends OutlinerElement {
|
|
|
92
103
|
static hasSelected: () => boolean
|
|
93
104
|
}
|
|
94
105
|
|
|
95
|
-
|
|
96
106
|
interface NullObjectOptions {
|
|
97
107
|
name?: string
|
|
98
108
|
position?: ArrayVector3
|
|
99
109
|
ik_target?: string
|
|
100
110
|
lock_ik_target_rotation?: boolean
|
|
101
|
-
|
|
102
111
|
}
|
|
103
112
|
declare class NullObject extends OutlinerElement {
|
|
104
|
-
constructor
|
|
113
|
+
constructor(options: Partial<NullObjectOptions>, uuid?: string)
|
|
105
114
|
position: ArrayVector3
|
|
106
115
|
ik_target: string
|
|
107
116
|
lock_ik_target_rotation: boolean
|
|
108
117
|
|
|
109
|
-
extend(options: Partial<NullObjectOptions>)
|
|
118
|
+
extend(options: Partial<NullObjectOptions>): void
|
|
110
119
|
flip(axis: number, center: number): this
|
|
111
120
|
getWorldCenter(): THREE.Vector3
|
|
112
121
|
|
|
@@ -118,7 +127,6 @@ declare class NullObject extends OutlinerElement {
|
|
|
118
127
|
static hasSelected: () => boolean
|
|
119
128
|
}
|
|
120
129
|
|
|
121
|
-
|
|
122
130
|
interface TextureMeshOptions {
|
|
123
131
|
name?: string
|
|
124
132
|
texture_name?: string
|
|
@@ -128,12 +136,12 @@ interface TextureMeshOptions {
|
|
|
128
136
|
scale?: ArrayVector3
|
|
129
137
|
}
|
|
130
138
|
declare class TextureMesh extends OutlinerElement {
|
|
131
|
-
constructor
|
|
139
|
+
constructor(options: Partial<TextureMeshOptions>, uuid?: string)
|
|
132
140
|
texture_name: string
|
|
133
141
|
local_pivot: ArrayVector3
|
|
134
142
|
scale: ArrayVector3
|
|
135
143
|
|
|
136
|
-
extend(options: Partial<TextureMeshOptions>)
|
|
144
|
+
extend(options: Partial<TextureMeshOptions>): void
|
|
137
145
|
flip(axis: number, center: number): this
|
|
138
146
|
getWorldCenter(): THREE.Vector3
|
|
139
147
|
moveVector(offset: ArrayVector3 | THREE.Vector3, axis: number, update?: boolean): void
|
|
@@ -142,12 +150,19 @@ declare class TextureMesh extends OutlinerElement {
|
|
|
142
150
|
static selected: TextureMesh[]
|
|
143
151
|
}
|
|
144
152
|
|
|
145
|
-
|
|
146
|
-
|
|
147
153
|
declare namespace Outliner {
|
|
148
154
|
const root: OutlinerNode[]
|
|
149
155
|
const elements: OutlinerElement[]
|
|
150
156
|
const selected: OutlinerElement[]
|
|
157
|
+
let control_menu_group: MenuItem[]
|
|
158
|
+
const buttons: {
|
|
159
|
+
autouv: any
|
|
160
|
+
export: any
|
|
161
|
+
locked: any
|
|
162
|
+
mirror_uv: any
|
|
163
|
+
shade: any
|
|
164
|
+
visibility: any
|
|
165
|
+
}
|
|
151
166
|
}
|
|
152
167
|
|
|
153
168
|
declare const markerColors: {
|
|
@@ -155,3 +170,7 @@ declare const markerColors: {
|
|
|
155
170
|
standard: string
|
|
156
171
|
name: string
|
|
157
172
|
}[]
|
|
173
|
+
|
|
174
|
+
declare function compileGroups(undo: boolean, lut?: { [index: number]: number }): any[]
|
|
175
|
+
|
|
176
|
+
declare function parseGroups(array: any[], import_reference?: any, startIndex?: number): void
|
package/types/painter.d.ts
CHANGED
|
@@ -1,31 +1,69 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
/**
|
|
2
3
|
* A global namespace containing various functionality for Blockbench's 2D and 3D paint tools and texture editor
|
|
3
4
|
*/
|
|
4
5
|
declare namespace Painter {
|
|
5
6
|
const currentPixel: ArrayVector2
|
|
6
7
|
const brushChanges: boolean
|
|
7
|
-
const current:
|
|
8
|
-
const selection:
|
|
8
|
+
const current: any
|
|
9
|
+
const selection: any
|
|
9
10
|
const mirror_painting: boolean
|
|
10
11
|
const lock_alpha: boolean
|
|
11
12
|
const erase_mode: boolean
|
|
12
|
-
const default_brush_presets:
|
|
13
|
+
const default_brush_presets: any[]
|
|
13
14
|
|
|
14
|
-
function edit(
|
|
15
|
+
function edit(
|
|
16
|
+
texture: Texture,
|
|
17
|
+
callback: (canvas: HTMLCanvasElement) => void,
|
|
18
|
+
options: TextureEditOptions
|
|
19
|
+
): void
|
|
15
20
|
function setAlphaMatrix(texture: Texture, x: number, y: number, val: number): void
|
|
16
21
|
function getAlphaMatrix(texture: Texture, x: number, y: number): number
|
|
17
22
|
|
|
18
23
|
function combineColors(base: RGBAColor, added: RGBAColor, opacity: number): RGBAColor
|
|
19
|
-
function blendColors(
|
|
24
|
+
function blendColors(
|
|
25
|
+
base: RGBAColor,
|
|
26
|
+
added: RGBAColor,
|
|
27
|
+
opacity: number,
|
|
28
|
+
blend_mode: string
|
|
29
|
+
): RGBAColor
|
|
20
30
|
function getMirrorElement(element: OutlinerElement, symmetry_axes: number[]): void
|
|
21
31
|
function updateNslideValues(): void
|
|
22
32
|
function getBlendModeCompositeOperation(): string
|
|
23
33
|
function getCanvas(texture: Texture): HTMLCanvasElement
|
|
24
|
-
function scanCanvas(
|
|
34
|
+
function scanCanvas(
|
|
35
|
+
ctx: CanvasRenderingContext2D,
|
|
36
|
+
x: number,
|
|
37
|
+
y: number,
|
|
38
|
+
w: number,
|
|
39
|
+
h: number,
|
|
40
|
+
cb: () => void
|
|
41
|
+
): void
|
|
25
42
|
function getPixelColor(ctx: CanvasRenderingContext2D, x: number, y: number): void
|
|
26
|
-
function modifyCanvasSection(
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
function modifyCanvasSection(
|
|
44
|
+
ctx: CanvasRenderingContext2D,
|
|
45
|
+
x: number,
|
|
46
|
+
y: number,
|
|
47
|
+
w: number,
|
|
48
|
+
h: number,
|
|
49
|
+
cb: () => void
|
|
50
|
+
): void
|
|
51
|
+
function editCircle(
|
|
52
|
+
ctx: CanvasRenderingContext2D,
|
|
53
|
+
x: number,
|
|
54
|
+
y: number,
|
|
55
|
+
r: number,
|
|
56
|
+
softness: number,
|
|
57
|
+
editPx: (RGBAColor: any, opacity: number, px: number, py: number) => RGBAColor
|
|
58
|
+
): void
|
|
59
|
+
function editSquare(
|
|
60
|
+
ctx: CanvasRenderingContext2D,
|
|
61
|
+
x: number,
|
|
62
|
+
y: number,
|
|
63
|
+
r: number,
|
|
64
|
+
softness: number,
|
|
65
|
+
editPx: (RGBAColor: any, opacity: number, px: number, py: number) => RGBAColor
|
|
66
|
+
): void
|
|
29
67
|
function openBrushOptions(): void
|
|
30
|
-
function loadBrushPreset(preset:
|
|
31
|
-
}
|
|
68
|
+
function loadBrushPreset(preset: any): void
|
|
69
|
+
}
|
package/types/panel.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
2
|
+
/// <reference path="./vue.d.ts"/>
|
|
1
3
|
type PanelSlot = 'left_bar' | 'right_bar' | 'top' | 'bottom' | 'float'
|
|
2
4
|
|
|
3
5
|
interface PanelOptions {
|
|
@@ -5,27 +7,47 @@ interface PanelOptions {
|
|
|
5
7
|
name: string
|
|
6
8
|
icon: string
|
|
7
9
|
menu?: any
|
|
10
|
+
/**
|
|
11
|
+
* If true, the panel can automatically become smaller or larger than its initial size in the sidebar
|
|
12
|
+
*/
|
|
8
13
|
growable?: boolean
|
|
14
|
+
/**
|
|
15
|
+
* When true, the height of the panel can be adjusted in the sidebar
|
|
16
|
+
*/
|
|
17
|
+
resizable?: true
|
|
9
18
|
selection_only?: boolean
|
|
10
19
|
condition?: ConditionResolvable
|
|
11
20
|
display_condition?: ConditionResolvable
|
|
21
|
+
/**
|
|
22
|
+
* Adds a button to the panel that allows users to pop-out and expand the panel on click
|
|
23
|
+
*/
|
|
12
24
|
expand_button: boolean
|
|
13
|
-
toolbars
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
toolbars?:
|
|
26
|
+
| {
|
|
27
|
+
[id: string]: Toolbar
|
|
28
|
+
}
|
|
29
|
+
| Toolbar[]
|
|
30
|
+
default_position?:
|
|
31
|
+
| {
|
|
32
|
+
slot: PanelSlot
|
|
33
|
+
float_position: [number, number]
|
|
34
|
+
float_size: [number, number]
|
|
35
|
+
height: number
|
|
36
|
+
folded: boolean
|
|
37
|
+
}
|
|
38
|
+
| number
|
|
39
|
+
component?: Vue.Component
|
|
24
40
|
default_side: 'right' | 'left'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Identifier of another panel to insert this one above
|
|
43
|
+
*/
|
|
44
|
+
insert_before?: string
|
|
45
|
+
/**
|
|
46
|
+
* Identifier of another panel to insert this one below
|
|
47
|
+
*/
|
|
48
|
+
insert_after?: string
|
|
49
|
+
onResize?(): void
|
|
50
|
+
onFold?(): void
|
|
29
51
|
}
|
|
30
52
|
type PanelEvent = 'drag' | 'fold' | 'change_zindex' | 'move_to' | 'moved_to' | 'update'
|
|
31
53
|
|
|
@@ -33,16 +55,18 @@ type PanelEvent = 'drag' | 'fold' | 'change_zindex' | 'move_to' | 'moved_to' | '
|
|
|
33
55
|
* 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
56
|
*/
|
|
35
57
|
declare class Panel {
|
|
36
|
-
constructor
|
|
37
|
-
constructor
|
|
58
|
+
constructor(id: string, options: PanelOptions)
|
|
59
|
+
constructor(options: PanelOptions)
|
|
38
60
|
isVisible(): boolean
|
|
39
61
|
isInSidebar(): boolean
|
|
40
62
|
slot: PanelSlot
|
|
41
63
|
folded: boolean
|
|
42
64
|
inside_vue: Vue
|
|
43
|
-
|
|
65
|
+
resizable: boolean
|
|
44
66
|
|
|
45
67
|
fold(state?: boolean): this
|
|
68
|
+
vue: Vue.Component
|
|
69
|
+
menu: Menu
|
|
46
70
|
/**
|
|
47
71
|
* If the panel is floating, move it up to the front
|
|
48
72
|
*/
|
|
@@ -53,17 +77,21 @@ declare class Panel {
|
|
|
53
77
|
/**
|
|
54
78
|
* Add an event listener
|
|
55
79
|
*/
|
|
56
|
-
on(event_name: PanelEvent, callback: (data
|
|
80
|
+
on(event_name: PanelEvent, callback: (data?: any) => void): void
|
|
57
81
|
/**
|
|
58
82
|
* Adds a single-use event listener
|
|
59
83
|
*/
|
|
60
|
-
once(event_name: PanelEvent, callback: (data
|
|
84
|
+
once(event_name: PanelEvent, callback: (data?: any) => void): void
|
|
61
85
|
/**
|
|
62
86
|
* Removes an event listener
|
|
63
87
|
*/
|
|
64
|
-
removeListener(event_name: PanelEvent, callback: (data
|
|
88
|
+
removeListener(event_name: PanelEvent, callback: (data?: any) => void): void
|
|
65
89
|
delete(): void
|
|
66
90
|
}
|
|
67
91
|
|
|
92
|
+
declare const Panels: {
|
|
93
|
+
[id: string]: Panel
|
|
94
|
+
}
|
|
95
|
+
|
|
68
96
|
declare function updateInterfacePanels(): void
|
|
69
97
|
declare function setActivePanel(panel_id: string): void
|
package/types/plugin.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
interface PluginOptions {
|
|
2
3
|
title: string
|
|
3
4
|
author: string
|
|
@@ -9,6 +10,10 @@ interface PluginOptions {
|
|
|
9
10
|
* The about text appears when the user unfolds the plugin in the plugin browser. It can contain additional information and usage instructions
|
|
10
11
|
*/
|
|
11
12
|
about?: string
|
|
13
|
+
/**
|
|
14
|
+
* The version of the plugin.
|
|
15
|
+
*/
|
|
16
|
+
version?: string
|
|
12
17
|
icon: string
|
|
13
18
|
/**
|
|
14
19
|
* Plugin tags that will show up in the plugin store. You can provide up to 3 tags.
|
|
@@ -34,6 +39,17 @@ interface PluginOptions {
|
|
|
34
39
|
* Use the new repository format where plugin, iron, and about are stored in a separate folder
|
|
35
40
|
*/
|
|
36
41
|
new_repository_format?: boolean
|
|
42
|
+
/**
|
|
43
|
+
* Can be used to specify which features a plugin adds. This allows Blockbench to be aware of and suggest even plugins that are not installed.
|
|
44
|
+
*/
|
|
45
|
+
contributes?: {
|
|
46
|
+
formats: string[]
|
|
47
|
+
}
|
|
48
|
+
has_changelog?: boolean
|
|
49
|
+
/**
|
|
50
|
+
* In combination with a "Deprecated" tag, this can be used to provide context on why a plugin is deprecated
|
|
51
|
+
*/
|
|
52
|
+
deprecation_note?: string
|
|
37
53
|
/**
|
|
38
54
|
* Runs when the plugin loads
|
|
39
55
|
*/
|
|
@@ -74,9 +90,21 @@ declare class BBPlugin {
|
|
|
74
90
|
about: string
|
|
75
91
|
icon: string
|
|
76
92
|
variant: 'both' | 'desktop' | 'web'
|
|
93
|
+
version: string
|
|
77
94
|
min_version: string
|
|
78
95
|
max_version: string
|
|
79
96
|
tags: string[]
|
|
97
|
+
/**
|
|
98
|
+
* Can be used to specify which features a plugin adds. This allows Blockbench to be aware of and suggest even plugins that are not installed.
|
|
99
|
+
*/
|
|
100
|
+
contributes?: {
|
|
101
|
+
formats: string[]
|
|
102
|
+
}
|
|
103
|
+
has_changelog: boolean
|
|
104
|
+
/**
|
|
105
|
+
* In combination with a "Deprecated" tag, this can be used to provide context on why a plugin is deprecated
|
|
106
|
+
*/
|
|
107
|
+
deprecation_note?: string
|
|
80
108
|
onload(): void
|
|
81
109
|
onunload(): void
|
|
82
110
|
oninstall(): void
|
package/types/preview.d.ts
CHANGED
|
@@ -1,89 +1,91 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
interface AnglePreset {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
position: ArrayVector3
|
|
4
|
+
target?: ArrayVector3
|
|
5
|
+
rotation?: ArrayVector3
|
|
6
|
+
projection: 'unset' | 'orthographic' | 'perspective'
|
|
7
|
+
zoom?: number
|
|
8
|
+
focal_length?: number
|
|
9
|
+
lockedAngle?: number
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
interface PreviewOptions {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
id: string
|
|
14
|
+
antialias?: boolean
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
type RaycastResult = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
type: 'keyframe' | 'vertex' | 'cube'
|
|
19
|
+
event: Event
|
|
20
|
+
cube?: Cube
|
|
21
|
+
intersects?: any[]
|
|
22
|
+
face?: string
|
|
23
|
+
vertex: any
|
|
24
|
+
keyframe: _Keyframe
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Previews are 3D viewports, that can either be used as a viewport for the user, or as an offscreen view to record media.
|
|
28
29
|
*/
|
|
29
30
|
declare class Preview extends Deletable {
|
|
30
|
-
|
|
31
|
+
constructor(options: PreviewOptions)
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
33
|
+
id: string
|
|
34
|
+
canvas: HTMLCanvasElement
|
|
35
|
+
height: number
|
|
36
|
+
width: number
|
|
37
|
+
node: HTMLElement
|
|
38
|
+
/**
|
|
39
|
+
* True if the preview is in orthographic camera mode
|
|
40
|
+
*/
|
|
41
|
+
isOrtho: boolean
|
|
42
|
+
/**
|
|
43
|
+
* Angle, when in a specific side view
|
|
44
|
+
*/
|
|
45
|
+
angle: null | number
|
|
46
|
+
readonly camera: THREE.PerspectiveCamera | THREE.OrthographicCamera
|
|
47
|
+
camPers: THREE.PerspectiveCamera
|
|
48
|
+
camOrtho: THREE.OrthographicCamera
|
|
49
|
+
controls: any
|
|
50
|
+
annotations: any
|
|
51
|
+
renderer: THREE.WebGLRenderer
|
|
52
|
+
background: {
|
|
53
|
+
name: string
|
|
54
|
+
image: any
|
|
55
|
+
size: number
|
|
56
|
+
x: number
|
|
57
|
+
y: number
|
|
58
|
+
lock: boolean
|
|
59
|
+
}
|
|
60
|
+
raycaster: THREE.Raycaster
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
raycast(event: MouseEvent): false | RaycastResult
|
|
63
|
+
render(): void
|
|
64
|
+
setProjectionMode(orthographic: boolean): this
|
|
65
|
+
setFOV(fov: number): void
|
|
66
|
+
setLockedAngle(angle: number): this
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
loadAnglePreset(angle_preset: AnglePreset): this
|
|
69
|
+
/**
|
|
70
|
+
* Opens a dialog to create and save a new angle preset
|
|
71
|
+
*/
|
|
72
|
+
newAnglePreset(): this
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
getFacingDirection(): 'north' | 'south' | 'east' | 'west'
|
|
75
|
+
getFacingHeight(): 'up' | 'middle' | 'down'
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
occupyTransformer(): this
|
|
78
|
+
showContextMenu(event: Event | HTMLElement): this
|
|
79
|
+
loadBackground(): void
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*/
|
|
88
|
-
static selected: Preview
|
|
81
|
+
/**
|
|
82
|
+
* List of all previews
|
|
83
|
+
*/
|
|
84
|
+
static all: Preview[]
|
|
85
|
+
/**
|
|
86
|
+
* The last used preview
|
|
87
|
+
*/
|
|
88
|
+
static selected: Preview
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
declare function animate(): void
|
package/types/preview_scene.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
/// <reference path="./blockbench.d.ts"/>
|
|
1
2
|
interface PreviewModelCubeTemplate {
|
|
2
3
|
position: ArrayVector3
|
|
3
4
|
size: ArrayVector3
|
|
4
5
|
origin?: ArrayVector3
|
|
5
6
|
rotation?: ArrayVector3
|
|
6
7
|
faces: {
|
|
7
|
-
north?: {uv: ArrayVector4}
|
|
8
|
-
east?: {uv: ArrayVector4}
|
|
9
|
-
west?: {uv: ArrayVector4}
|
|
10
|
-
south?: {uv: ArrayVector4}
|
|
11
|
-
up?: {uv: ArrayVector4}
|
|
12
|
-
down?: {uv: ArrayVector4}
|
|
8
|
+
north?: { uv: ArrayVector4 }
|
|
9
|
+
east?: { uv: ArrayVector4 }
|
|
10
|
+
west?: { uv: ArrayVector4 }
|
|
11
|
+
south?: { uv: ArrayVector4 }
|
|
12
|
+
up?: { uv: ArrayVector4 }
|
|
13
|
+
down?: { uv: ArrayVector4 }
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -38,12 +39,12 @@ interface PreviewModelOptions {
|
|
|
38
39
|
|
|
39
40
|
declare class PreviewModel extends Deletable {
|
|
40
41
|
constructor(id: string, options: PreviewModelOptions)
|
|
41
|
-
|
|
42
|
+
|
|
42
43
|
static models: {
|
|
43
44
|
(id: string): PreviewModel
|
|
44
45
|
}
|
|
45
46
|
static getActiveModels(): PreviewModel[]
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
id: string
|
|
48
49
|
model_3d: THREE.Object3D
|
|
49
50
|
cubes: PreviewModelCubeTemplate[]
|
|
@@ -52,7 +53,7 @@ declare class PreviewModel extends Deletable {
|
|
|
52
53
|
shading: boolean
|
|
53
54
|
render_side: number
|
|
54
55
|
texture_size: [number, number]
|
|
55
|
-
onUpdate?:() => void
|
|
56
|
+
onUpdate?: () => void
|
|
56
57
|
/**
|
|
57
58
|
* Enables the model in the preview
|
|
58
59
|
*/
|
|
@@ -68,8 +69,6 @@ declare class PreviewModel extends Deletable {
|
|
|
68
69
|
buildModel(): void
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
73
72
|
interface PreviewSceneOptions {
|
|
74
73
|
name?: string
|
|
75
74
|
description?: string
|
|
@@ -89,7 +88,7 @@ declare class PreviewScene extends Deletable {
|
|
|
89
88
|
select_options: {
|
|
90
89
|
(id: string): string
|
|
91
90
|
}
|
|
92
|
-
|
|
91
|
+
|
|
93
92
|
id: string
|
|
94
93
|
name: string
|
|
95
94
|
description: string
|