blockbench-types 4.2.0 → 4.4.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/types/action.d.ts +109 -1
- package/types/canvas.d.ts +25 -0
- package/types/dialog.d.ts +154 -0
- package/types/file_system.d.ts +1 -1
- package/types/format.d.ts +126 -22
- package/types/index.d.ts +37 -2
- package/types/interface.d.ts +68 -141
- package/types/menu.d.ts +14 -5
- package/types/outliner.d.ts +1 -0
- package/types/preview.d.ts +12 -10
- package/types/preview_scene.d.ts +109 -0
- package/types/project.d.ts +1 -0
- package/types/validator.d.ts +60 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockbench-types",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Blockbench typescript types",
|
|
5
5
|
"main": "",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"homepage": "https://github.com/JannisX11/blockbench-types#readme",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@types/jquery": "^3.5.4",
|
|
22
|
+
"@types/tinycolor2": "^1.4.3",
|
|
22
23
|
"three": "^0.129.0",
|
|
23
24
|
"vue": "^2.6.14",
|
|
24
25
|
"wintersky": "^1.1.0"
|
package/types/action.d.ts
CHANGED
|
@@ -54,20 +54,128 @@ interface ActionOptions extends BarItemOptions {
|
|
|
54
54
|
}
|
|
55
55
|
declare class Action extends BarItem {
|
|
56
56
|
constructor(id: string, options: ActionOptions);
|
|
57
|
+
/**
|
|
58
|
+
* Trigger to run or select the action. This is the equivalent of clicking or using a keybind to trigger it. Also checks if the condition is met.
|
|
59
|
+
*/
|
|
57
60
|
trigger(event: Event): boolean;
|
|
58
61
|
updateKeybindingLabel(): this;
|
|
59
|
-
|
|
62
|
+
/** Change the icon of the action */
|
|
63
|
+
setIcon(icon: IconString): void;
|
|
60
64
|
toggleLinkedSetting(change: any): void;
|
|
61
65
|
nodes: HTMLElement[]
|
|
66
|
+
/**
|
|
67
|
+
* Provide a menu that belongs to the action, and gets displayed as a small arrow next to it in toolbars.
|
|
68
|
+
*/
|
|
69
|
+
side_menu?: Menu
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type RGBAColor = {r: number, g: number, b: number, a: number}
|
|
73
|
+
type ViewMode = 'textured' | 'solid' | 'wireframe' | 'uv' | 'normal'
|
|
74
|
+
type PaintContext = {
|
|
75
|
+
/**
|
|
76
|
+
* Brush color, set by the Blockbench color panel
|
|
77
|
+
*/
|
|
78
|
+
color: string,
|
|
79
|
+
/**
|
|
80
|
+
* Opacity, as set by the Opacity slider
|
|
81
|
+
*/
|
|
82
|
+
opacity: number,
|
|
83
|
+
/**
|
|
84
|
+
* 2D Canvas context of the texture that is being edited
|
|
85
|
+
*/
|
|
86
|
+
ctx: CanvasRenderingContext2D,
|
|
87
|
+
/**X Coordinate of the position of the brush stroke */
|
|
88
|
+
x: number,
|
|
89
|
+
/**Y Coordinate of the position of the brush stroke */
|
|
90
|
+
y: number,
|
|
91
|
+
/**
|
|
92
|
+
* Brush size, as set by the Brush Size slider
|
|
93
|
+
*/
|
|
94
|
+
size: number,
|
|
95
|
+
/**
|
|
96
|
+
* Brush softness, as set by the Brush Softness slider
|
|
97
|
+
*/
|
|
98
|
+
softness: number,
|
|
99
|
+
/**
|
|
100
|
+
* Blockbench texture that is being edited
|
|
101
|
+
*/
|
|
102
|
+
texture: Texture,
|
|
103
|
+
/**
|
|
104
|
+
* Javascript pointer event that the brush stroke originated from
|
|
105
|
+
*/
|
|
106
|
+
event: PointerEvent
|
|
62
107
|
}
|
|
108
|
+
interface BrushOptions {
|
|
109
|
+
/**
|
|
110
|
+
* Enable the input for blend modes when this tool is selected
|
|
111
|
+
*/
|
|
112
|
+
blend_modes: boolean
|
|
113
|
+
/**
|
|
114
|
+
* Enable the input for shapes when this tool is selected
|
|
115
|
+
*/
|
|
116
|
+
shapes: boolean
|
|
117
|
+
/**
|
|
118
|
+
* Enable the input for brush size when this tool is selected
|
|
119
|
+
*/
|
|
120
|
+
size: boolean
|
|
121
|
+
/**
|
|
122
|
+
* Enable the input for softness when this tool is selected
|
|
123
|
+
*/
|
|
124
|
+
softness: boolean
|
|
125
|
+
/**
|
|
126
|
+
* Enable the input for opacity when this tool is selected
|
|
127
|
+
*/
|
|
128
|
+
opacity: boolean
|
|
129
|
+
/**
|
|
130
|
+
* When the brush size is an even number, offset the snapping by half a pixel so that even size brush strokes can be correctly centered
|
|
131
|
+
*/
|
|
132
|
+
offset_even_radius: boolean
|
|
133
|
+
/**
|
|
134
|
+
* Set whether the brush coordinates get floored to snap to the nearest pixel.
|
|
135
|
+
*/
|
|
136
|
+
floor_coordinates: boolean | (() => boolean)
|
|
137
|
+
/**
|
|
138
|
+
* Function that runs per pixel when the brush is used. Mutually exclusive with draw().
|
|
139
|
+
* @param pixel_x Local X coordinate relative to the brush center
|
|
140
|
+
* @param pixel_y Local Y coordinate relative to the brush center
|
|
141
|
+
* @param pixel_color Current color of the pixel on the texture
|
|
142
|
+
* @param local_opacity Local opacity of the current pixel on the brush, between 0 and 1. Opacity falls of to the sides of the brush if the brush is set to smooth. Opacity from the Opacity slider is not factored in yet.
|
|
143
|
+
* @param PaintContext Additional context to the paint stroke
|
|
144
|
+
*/
|
|
145
|
+
changePixel(pixel_x: number, pixel_y, pixel_color: RGBAColor, local_opacity: number, PaintContext: PaintContext): RGBAColor
|
|
146
|
+
/**
|
|
147
|
+
* Function that runs when a new brush stroke starts. Return false to cancel the brush stroke
|
|
148
|
+
* @param context
|
|
149
|
+
*/
|
|
150
|
+
onStrokeStart(context: {texture: Texture, x: number, y: number, uv?: object, event: PointerEvent, raycast_data: RaycastResult}): boolean
|
|
151
|
+
/**
|
|
152
|
+
* Function that runs when a new brush stroke starts. Return false to cancel the brush stroke
|
|
153
|
+
* @param context
|
|
154
|
+
*/
|
|
155
|
+
onStrokeMove(context: {texture: Texture, x: number, y: number, uv?: object, event: PointerEvent, raycast_data: RaycastResult}): boolean
|
|
156
|
+
/**
|
|
157
|
+
* Function that runs when a new brush stroke starts.
|
|
158
|
+
* @param context
|
|
159
|
+
*/
|
|
160
|
+
onStrokeEnd(context: {texture: Texture, x: number, y: number, uv?: object, raycast_data: RaycastResult})
|
|
161
|
+
/**
|
|
162
|
+
* Alternative way to create a custom brush, mutually exclusive with the changePixel() function. Draw runs once every time the brush starts or moves, and also along the bath on lines.
|
|
163
|
+
* @param context
|
|
164
|
+
*/
|
|
165
|
+
draw(context: {ctx: CanvasRenderingContext2D, x: number, y: number, size: number, softness: number, texture: Texture, event: PointerEvent})
|
|
63
166
|
|
|
167
|
+
}
|
|
64
168
|
interface ToolOptions extends ActionOptions {
|
|
65
169
|
selectFace?: boolean
|
|
170
|
+
selectElements?: boolean
|
|
66
171
|
transformerMode?: 'translate' | ''
|
|
67
172
|
animation_channel?: string
|
|
68
173
|
toolbar?: string
|
|
69
174
|
alt_tool?: string
|
|
70
175
|
modes?: string[]
|
|
176
|
+
allowed_view_modes?: ViewMode
|
|
177
|
+
paintTool?: boolean
|
|
178
|
+
brush?: BrushOptions
|
|
71
179
|
}
|
|
72
180
|
declare class Tool extends Action {
|
|
73
181
|
constructor(id: string, options: ToolOptions);
|
package/types/canvas.d.ts
CHANGED
|
@@ -48,18 +48,37 @@ declare const Canvas: {
|
|
|
48
48
|
bones: {
|
|
49
49
|
[uuid: UUID]: THREE.Object3D
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Main scene, shared across all tabs
|
|
53
|
+
*/
|
|
54
|
+
scene: THREE.Scene
|
|
55
|
+
/**
|
|
56
|
+
* List of the gizmos (control and UI elements) in the 3D scene
|
|
57
|
+
*/
|
|
58
|
+
gizmos: []
|
|
51
59
|
/**
|
|
52
60
|
* The material used for all selection outlines
|
|
53
61
|
*/
|
|
54
62
|
outlineMaterial: THREE.LineBasicMaterial;
|
|
63
|
+
meshOutlineMaterial: THREE.LineBasicMaterial;
|
|
55
64
|
/**
|
|
56
65
|
* The material used for the wireframe view
|
|
57
66
|
*/
|
|
58
67
|
wireframeMaterial: THREE.MeshBasicMaterial;
|
|
68
|
+
solidMaterial: THREE.ShaderMaterial;
|
|
69
|
+
normalHelperMaterial: THREE.ShaderMaterial;
|
|
70
|
+
uvHelperMaterial: THREE.ShaderMaterial;
|
|
71
|
+
meshVertexMaterial: THREE.PointsMaterial;
|
|
59
72
|
/**
|
|
60
73
|
* The material used for the grids
|
|
61
74
|
*/
|
|
62
75
|
gridMaterial: THREE.LineBasicMaterial;
|
|
76
|
+
|
|
77
|
+
pivot_marker: THREE.Object3D
|
|
78
|
+
|
|
79
|
+
global_light_color: THREE.Color
|
|
80
|
+
global_light_side: number
|
|
81
|
+
|
|
63
82
|
face_order: string[];
|
|
64
83
|
|
|
65
84
|
/**
|
|
@@ -74,6 +93,8 @@ declare const Canvas: {
|
|
|
74
93
|
* Clear all elements from the scene
|
|
75
94
|
*/
|
|
76
95
|
clear(): void;
|
|
96
|
+
buildGrid(): void;
|
|
97
|
+
updateShading(): void;
|
|
77
98
|
/**
|
|
78
99
|
* Updates selected aspects of the preview
|
|
79
100
|
* @param options
|
|
@@ -161,6 +182,10 @@ declare const Canvas: {
|
|
|
161
182
|
* @param animation Whether to display the current animated texture frame
|
|
162
183
|
*/
|
|
163
184
|
updateUV(cube: Cube, animation?: boolean): any;
|
|
185
|
+
/**
|
|
186
|
+
* Update the materials of marker colors if new colors were added
|
|
187
|
+
*/
|
|
188
|
+
updateMarkerColorMaterials(): void;
|
|
164
189
|
/**
|
|
165
190
|
* Create an additional outline around the specified cubes
|
|
166
191
|
* @param arr List of cubes to outline
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
interface DialogFormElement {
|
|
2
|
+
label: string
|
|
3
|
+
description?: string
|
|
4
|
+
type: 'text' | 'number' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info'
|
|
5
|
+
nocolon?: boolean
|
|
6
|
+
readonly?: boolean
|
|
7
|
+
value?: any
|
|
8
|
+
placeholder?: string
|
|
9
|
+
text?: string
|
|
10
|
+
colorpicker?: any
|
|
11
|
+
min?: number
|
|
12
|
+
max?: number
|
|
13
|
+
step?: number
|
|
14
|
+
height?: number
|
|
15
|
+
options?: object
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type FormResultValue = string|number|boolean|[]
|
|
19
|
+
|
|
20
|
+
interface ActionInterface {
|
|
21
|
+
name: string
|
|
22
|
+
description?: string
|
|
23
|
+
icon: string,
|
|
24
|
+
click: (event: Event) => void
|
|
25
|
+
condition: Condition
|
|
26
|
+
}
|
|
27
|
+
interface DialogOptions {
|
|
28
|
+
title: string
|
|
29
|
+
id: string
|
|
30
|
+
/**
|
|
31
|
+
* Default button to press to confirm the dialog. Defaults to the first button.
|
|
32
|
+
*/
|
|
33
|
+
confirmIndex?: number
|
|
34
|
+
/**
|
|
35
|
+
* Default button to press to cancel the dialog. Defaults to the last button.
|
|
36
|
+
*/
|
|
37
|
+
cancelIndex?: number
|
|
38
|
+
/**
|
|
39
|
+
* Function to execute when the user confirms the dialog
|
|
40
|
+
*/
|
|
41
|
+
onConfirm?: (formResult: object) => void
|
|
42
|
+
/**
|
|
43
|
+
* Function to execute when the user cancels the dialog
|
|
44
|
+
*/
|
|
45
|
+
onCancel?: () => void
|
|
46
|
+
/**
|
|
47
|
+
* Triggered when the user presses a specific button
|
|
48
|
+
*/
|
|
49
|
+
onButton?: (button_index: number, event?: Event) => void
|
|
50
|
+
/**
|
|
51
|
+
* Function to run when anything in the form is changed
|
|
52
|
+
*/
|
|
53
|
+
onFormChange?: (form_result: {[key: string]: FormResultValue}) => void
|
|
54
|
+
/**
|
|
55
|
+
* Array of HTML object strings for each line of content in the dialog.
|
|
56
|
+
*/
|
|
57
|
+
lines?: (string|HTMLElement)[]
|
|
58
|
+
/**
|
|
59
|
+
* Creates a form in the dialog
|
|
60
|
+
*/
|
|
61
|
+
form?: {
|
|
62
|
+
[formElement: string]: '_' | DialogFormElement
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Vue component
|
|
66
|
+
*/
|
|
67
|
+
component?: Vue.Component
|
|
68
|
+
/**
|
|
69
|
+
* Order that the different interface types appear in the dialog. Default is 'form', 'lines', 'component'.
|
|
70
|
+
*/
|
|
71
|
+
part_order?: string[]
|
|
72
|
+
form_first?: boolean
|
|
73
|
+
/**
|
|
74
|
+
* Creates a dialog sidebar
|
|
75
|
+
*/
|
|
76
|
+
sidebar?: DialogSidebarOptions
|
|
77
|
+
/**
|
|
78
|
+
* Menu in the handle bar
|
|
79
|
+
*/
|
|
80
|
+
title_menu?: Menu
|
|
81
|
+
/**
|
|
82
|
+
* If true, the dialog will only have one button to close it
|
|
83
|
+
*/
|
|
84
|
+
singleButton?: boolean
|
|
85
|
+
/**
|
|
86
|
+
* List of buttons
|
|
87
|
+
*/
|
|
88
|
+
buttons?: string[]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface DialogSidebarOptions {
|
|
92
|
+
pages?: {
|
|
93
|
+
[key: string]: string | {label: string, icon: IconString, color?: string}
|
|
94
|
+
}
|
|
95
|
+
page?: string
|
|
96
|
+
actions?: (Action|ActionInterface|string)[],
|
|
97
|
+
onPageSwitch?: (page: string) => void
|
|
98
|
+
}
|
|
99
|
+
declare class DialogSidebar {
|
|
100
|
+
constructor(options: DialogSidebarOptions)
|
|
101
|
+
|
|
102
|
+
pages: {
|
|
103
|
+
[key: string]: string
|
|
104
|
+
}
|
|
105
|
+
page: string
|
|
106
|
+
actions: (Action|string)[]
|
|
107
|
+
onPageSwitch(page: string): void
|
|
108
|
+
build(): void
|
|
109
|
+
toggle(state?: boolean): void
|
|
110
|
+
setPage(page: string): void
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare class Dialog {
|
|
114
|
+
constructor (options: DialogOptions)
|
|
115
|
+
|
|
116
|
+
id: string
|
|
117
|
+
component: Vue.Component
|
|
118
|
+
sidebar: DialogSidebar | null
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
show: () => Dialog
|
|
122
|
+
hide: () => Dialog
|
|
123
|
+
/**
|
|
124
|
+
* Triggers the confirm event of the dialog.
|
|
125
|
+
*/
|
|
126
|
+
confirm: (event?: Event) => void
|
|
127
|
+
/**
|
|
128
|
+
* Triggers the cancel event of the dialog.
|
|
129
|
+
*/
|
|
130
|
+
cancel: (event?: Event) => void
|
|
131
|
+
/**
|
|
132
|
+
* Closes the dialog using the index of the pressed button
|
|
133
|
+
*/
|
|
134
|
+
close: (button: number, event?: Event) => void
|
|
135
|
+
/**
|
|
136
|
+
* If the dialog contains a form, return the current values of the form
|
|
137
|
+
*/
|
|
138
|
+
getFormResult(): {
|
|
139
|
+
[key: string]: FormResultValue
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Set the values of the dialog form inputs
|
|
143
|
+
*/
|
|
144
|
+
setFormValues(values: {[key: string]: FormResultValue}): void
|
|
145
|
+
/**
|
|
146
|
+
* Delete the dialog object, causing it to be re-build from scratch on next open
|
|
147
|
+
*/
|
|
148
|
+
delete(): void
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Currently opened dialog
|
|
152
|
+
*/
|
|
153
|
+
static open: Dialog | null
|
|
154
|
+
}
|
package/types/file_system.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ declare namespace Blockbench {
|
|
|
135
135
|
*/
|
|
136
136
|
propagate?: boolean
|
|
137
137
|
}
|
|
138
|
-
export function addDragHandler(id: string, options: DragHandlerOptions, callback?: () => void):
|
|
138
|
+
export function addDragHandler(id: string, options: DragHandlerOptions, callback?: () => void): Deletable
|
|
139
139
|
export function removeDragHandler(id: string): void
|
|
140
140
|
|
|
141
141
|
}
|
package/types/format.d.ts
CHANGED
|
@@ -1,29 +1,79 @@
|
|
|
1
|
+
interface FormatPage {
|
|
2
|
+
component?: Vue.Component
|
|
3
|
+
content?: ({
|
|
4
|
+
type: 'image' | 'h2' | 'h3' | 'h4' | 'text' | 'label' | 'image' | ''
|
|
5
|
+
text?: string
|
|
6
|
+
source?: string
|
|
7
|
+
width?: number
|
|
8
|
+
height?: number
|
|
9
|
+
} | string)[]
|
|
10
|
+
button_text?: string
|
|
11
|
+
}
|
|
12
|
+
interface CubeSizeLimiter {
|
|
13
|
+
/**
|
|
14
|
+
* Test whether the cube with the optionally provided values violates the size restrictions
|
|
15
|
+
*/
|
|
16
|
+
test: (cube: Cube, values?: {from: ArrayVector3, to: ArrayVector3, inflate: number}) => boolean
|
|
17
|
+
/**
|
|
18
|
+
* Move the cube back into the restructions
|
|
19
|
+
*/
|
|
20
|
+
move: (cube: Cube, values?: {from: ArrayVector3, to: ArrayVector3, inflate: number}) => void
|
|
21
|
+
/**
|
|
22
|
+
* Clamp the cube to fit into the restrictions. When an axis and direction is provided, clamp the element on that side to prevent wandering.
|
|
23
|
+
*/
|
|
24
|
+
clamp: (cube: Cube, values?: {from: ArrayVector3, to: ArrayVector3, inflate: number}, axis?: number, direction?: boolean | null) => void
|
|
25
|
+
/**
|
|
26
|
+
* Set to true to tell Blockbench to check and adjust the cube limit after rotating a cube
|
|
27
|
+
*/
|
|
28
|
+
rotation_affected?: boolean,
|
|
29
|
+
/**
|
|
30
|
+
* Optionally set the coordinate limits of cubes in local space
|
|
31
|
+
*/
|
|
32
|
+
coordinate_limits?: [number, number]
|
|
33
|
+
}
|
|
34
|
+
|
|
1
35
|
interface FormatOptions {
|
|
2
36
|
id: string
|
|
3
37
|
icon: string
|
|
4
38
|
name?: string
|
|
5
39
|
description?: string
|
|
40
|
+
category?: string
|
|
41
|
+
target?: string | string[]
|
|
42
|
+
confidential?: boolean
|
|
43
|
+
condition?: Condition
|
|
6
44
|
show_on_start_screen?: boolean
|
|
45
|
+
format_page?: FormatPage
|
|
46
|
+
onFormatPage?(): void
|
|
47
|
+
onStart?(): void
|
|
7
48
|
|
|
8
|
-
box_uv
|
|
9
|
-
optional_box_uv
|
|
10
|
-
single_texture
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
49
|
+
box_uv: boolean
|
|
50
|
+
optional_box_uv: boolean
|
|
51
|
+
single_texture: boolean
|
|
52
|
+
model_identifier: boolean
|
|
53
|
+
parent_model_id: boolean
|
|
54
|
+
vertex_color_ambient_occlusion: boolean
|
|
55
|
+
animated_textures: boolean
|
|
56
|
+
bone_rig: boolean
|
|
57
|
+
centered_grid: boolean
|
|
58
|
+
rotate_cubes: boolean
|
|
59
|
+
integer_size: boolean
|
|
60
|
+
meshes: boolean
|
|
61
|
+
texture_meshes: boolean
|
|
62
|
+
locators: boolean
|
|
63
|
+
rotation_limit: boolean
|
|
64
|
+
uv_rotation: boolean
|
|
65
|
+
java_face_properties: boolean
|
|
66
|
+
select_texture_for_particles: boolean
|
|
67
|
+
bone_binding_expression: boolean
|
|
68
|
+
animation_files: boolean
|
|
69
|
+
texture_folder: boolean
|
|
70
|
+
edit_mode?: boolean
|
|
71
|
+
paint_mode?: boolean
|
|
22
72
|
display_mode?: boolean
|
|
23
73
|
animation_mode?: boolean
|
|
24
|
-
animation_files?: boolean
|
|
25
74
|
pose_mode?: boolean
|
|
26
|
-
|
|
75
|
+
|
|
76
|
+
cube_size_limiter?: CubeSizeLimiter
|
|
27
77
|
|
|
28
78
|
codec?: Codec
|
|
29
79
|
onActivation?(): void
|
|
@@ -31,29 +81,50 @@ interface FormatOptions {
|
|
|
31
81
|
}
|
|
32
82
|
|
|
33
83
|
declare class ModelFormat extends Deletable {
|
|
84
|
+
constructor(id: string, options: FormatOptions)
|
|
34
85
|
constructor(options: FormatOptions)
|
|
35
86
|
|
|
36
87
|
id: string
|
|
37
88
|
icon: string
|
|
38
|
-
name
|
|
39
|
-
description
|
|
40
|
-
|
|
89
|
+
name: string
|
|
90
|
+
description: string
|
|
91
|
+
category: string
|
|
92
|
+
target: string | string[]
|
|
93
|
+
confidential: boolean
|
|
94
|
+
condition?: Condition
|
|
95
|
+
show_on_start_screen: boolean
|
|
96
|
+
format_page?: FormatPage
|
|
97
|
+
onFormatPage?(): void
|
|
98
|
+
onStart?(): void
|
|
41
99
|
|
|
42
100
|
box_uv: boolean
|
|
43
101
|
optional_box_uv: boolean
|
|
44
102
|
single_texture: boolean
|
|
103
|
+
model_identifier: boolean
|
|
104
|
+
parent_model_id: boolean
|
|
105
|
+
vertex_color_ambient_occlusion: boolean
|
|
45
106
|
animated_textures: boolean
|
|
46
107
|
bone_rig: boolean
|
|
47
108
|
centered_grid: boolean
|
|
48
109
|
rotate_cubes: boolean
|
|
49
110
|
integer_size: boolean
|
|
111
|
+
meshes: boolean
|
|
112
|
+
texture_meshes: boolean
|
|
50
113
|
locators: boolean
|
|
51
|
-
canvas_limit: boolean
|
|
52
114
|
rotation_limit: boolean
|
|
53
115
|
uv_rotation: boolean
|
|
54
|
-
|
|
55
|
-
|
|
116
|
+
java_face_properties: boolean
|
|
117
|
+
select_texture_for_particles: boolean
|
|
118
|
+
bone_binding_expression: boolean
|
|
119
|
+
animation_files: boolean
|
|
120
|
+
texture_folder: boolean
|
|
121
|
+
edit_mode?: boolean
|
|
122
|
+
paint_mode?: boolean
|
|
123
|
+
display_mode?: boolean
|
|
124
|
+
animation_mode?: boolean
|
|
125
|
+
pose_mode?: boolean
|
|
56
126
|
|
|
127
|
+
cube_size_limiter?: CubeSizeLimiter
|
|
57
128
|
/**
|
|
58
129
|
* Selects the format
|
|
59
130
|
*/
|
|
@@ -72,3 +143,36 @@ declare class ModelFormat extends Deletable {
|
|
|
72
143
|
* The current format
|
|
73
144
|
*/
|
|
74
145
|
declare const Format: ModelFormat
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
interface ModelLoaderOptions {
|
|
149
|
+
id?: string
|
|
150
|
+
icon: string
|
|
151
|
+
name?: string
|
|
152
|
+
description?: string
|
|
153
|
+
category?: string
|
|
154
|
+
target?: string | string[]
|
|
155
|
+
confidential?: boolean
|
|
156
|
+
condition?: Condition
|
|
157
|
+
format_page?: FormatPage
|
|
158
|
+
onFormatPage?(): void
|
|
159
|
+
onStart?(): void
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare class ModelLoader extends Deletable {
|
|
163
|
+
constructor(id: string, options: ModelLoaderOptions)
|
|
164
|
+
constructor(options: ModelLoaderOptions)
|
|
165
|
+
|
|
166
|
+
id: string
|
|
167
|
+
icon: string
|
|
168
|
+
name: string
|
|
169
|
+
description: string
|
|
170
|
+
category: string
|
|
171
|
+
target: string | string[]
|
|
172
|
+
confidential: boolean
|
|
173
|
+
condition?: Condition
|
|
174
|
+
show_on_start_screen: boolean
|
|
175
|
+
format_page?: FormatPage
|
|
176
|
+
onFormatPage?(): void
|
|
177
|
+
onStart?(): void
|
|
178
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="vue" />
|
|
2
2
|
/// <reference types="three" />
|
|
3
|
+
/// <reference types="@types/tinycolor2" />
|
|
3
4
|
/// <reference types="@types/jquery" />
|
|
4
5
|
/// <reference types="wintersky" />
|
|
5
6
|
|
|
7
|
+
/// <reference types="./textures" />
|
|
6
8
|
/// <reference types="./action" />
|
|
7
9
|
/// <reference types="./animation" />
|
|
8
10
|
/// <reference types="./canvas" />
|
|
@@ -11,6 +13,7 @@
|
|
|
11
13
|
/// <reference types="./format" />
|
|
12
14
|
/// <reference types="./global" />
|
|
13
15
|
/// <reference types="./interface" />
|
|
16
|
+
/// <reference types="./dialog" />
|
|
14
17
|
/// <reference types="./panel" />
|
|
15
18
|
/// <reference types="./keyframe" />
|
|
16
19
|
/// <reference types="./legacy" />
|
|
@@ -20,9 +23,9 @@
|
|
|
20
23
|
/// <reference types="./preview" />
|
|
21
24
|
/// <reference types="./project" />
|
|
22
25
|
/// <reference types="./settings" />
|
|
23
|
-
/// <reference types="./textures" />
|
|
24
26
|
/// <reference types="./timeline" />
|
|
25
27
|
/// <reference types="./undo" />
|
|
28
|
+
/// <reference types="./validator" />
|
|
26
29
|
/// <reference types="./util" />
|
|
27
30
|
|
|
28
31
|
|
|
@@ -55,7 +58,10 @@ type EventName = 'remove_animation'
|
|
|
55
58
|
| 'reset_project'
|
|
56
59
|
| 'close_project'
|
|
57
60
|
| 'add_cube'
|
|
61
|
+
| 'add_mesh'
|
|
58
62
|
| 'add_group'
|
|
63
|
+
| 'add_texture_mesh'
|
|
64
|
+
| 'group_elements'
|
|
59
65
|
| 'update_selection'
|
|
60
66
|
| 'update_keyframe_selection'
|
|
61
67
|
| 'select_all'
|
|
@@ -72,6 +78,29 @@ type EventName = 'remove_animation'
|
|
|
72
78
|
| 'load_undo_save'
|
|
73
79
|
| 'select_mode'
|
|
74
80
|
| 'unselect_mode'
|
|
81
|
+
| 'change_active_panel'
|
|
82
|
+
| 'resize_window'
|
|
83
|
+
| 'press_key'
|
|
84
|
+
| 'select_format'
|
|
85
|
+
| 'convert_format'
|
|
86
|
+
| 'construct_format'
|
|
87
|
+
| 'delete_format'
|
|
88
|
+
| 'select_project'
|
|
89
|
+
| 'unselect_project'
|
|
90
|
+
| 'setup_project'
|
|
91
|
+
| 'update_project_resolution'
|
|
92
|
+
| 'merge_project'
|
|
93
|
+
| 'update_view'
|
|
94
|
+
| 'update_camera_position'
|
|
95
|
+
| 'render_frame'
|
|
96
|
+
| 'construct_model_loader'
|
|
97
|
+
| 'delete_model_loader'
|
|
98
|
+
| 'update_recent_project_data'
|
|
99
|
+
| 'update_recent_project_thumbnail'
|
|
100
|
+
| 'load_from_recent_project_data'
|
|
101
|
+
| 'edit_animation_properties'
|
|
102
|
+
| 'select_preview_scene'
|
|
103
|
+
| 'unselect_preview_scene'
|
|
75
104
|
|
|
76
105
|
type IconString = string;
|
|
77
106
|
|
|
@@ -90,6 +119,12 @@ interface MessageBoxOptions {
|
|
|
90
119
|
message?: string
|
|
91
120
|
icon?: string
|
|
92
121
|
width: number
|
|
122
|
+
/**
|
|
123
|
+
* Display a list of actions to do in the dialog. When clicked, the message box closes with the string ID of the command as first argument.
|
|
124
|
+
*/
|
|
125
|
+
commands?: {
|
|
126
|
+
[id: string]: string | {text: string}
|
|
127
|
+
}
|
|
93
128
|
}
|
|
94
129
|
|
|
95
130
|
declare namespace Blockbench {
|
|
@@ -150,7 +185,7 @@ declare namespace Blockbench {
|
|
|
150
185
|
/**
|
|
151
186
|
* Opens a message box
|
|
152
187
|
*/
|
|
153
|
-
function showMessageBox(options: MessageBoxOptions, callback: (buttonID: number) => void): void
|
|
188
|
+
function showMessageBox(options: MessageBoxOptions, callback: (buttonID: number | string) => void): void
|
|
154
189
|
|
|
155
190
|
function textPrompt(title: string, value: string, callback: (value: string) => void): void
|
|
156
191
|
/**
|
package/types/interface.d.ts
CHANGED
|
@@ -1,154 +1,81 @@
|
|
|
1
|
-
interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
value?: any
|
|
8
|
-
placeholder?: string
|
|
9
|
-
text?: string
|
|
10
|
-
colorpicker?: any
|
|
11
|
-
min?: number
|
|
12
|
-
max?: number
|
|
13
|
-
step?: number
|
|
14
|
-
height?: number
|
|
15
|
-
options?: object
|
|
1
|
+
interface ResizeLineOptions {
|
|
2
|
+
condition?: Condition
|
|
3
|
+
horizontal?: boolean
|
|
4
|
+
position(): void
|
|
5
|
+
get(): void
|
|
6
|
+
set(): void
|
|
16
7
|
}
|
|
8
|
+
declare class ResizeLine {
|
|
9
|
+
constructor(id: string, options: ResizeLineOptions)
|
|
17
10
|
|
|
18
|
-
type FormResultValue = string|number|boolean|[]
|
|
19
|
-
|
|
20
|
-
interface ActionInterface {
|
|
21
|
-
name: string
|
|
22
|
-
description?: string
|
|
23
|
-
icon: string,
|
|
24
|
-
click: (event: Event) => void
|
|
25
|
-
condition: Condition
|
|
26
|
-
}
|
|
27
|
-
interface DialogOptions {
|
|
28
|
-
title: string
|
|
29
11
|
id: string
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Function to execute when the user confirms the dialog
|
|
40
|
-
*/
|
|
41
|
-
onConfirm?: (formResult: object) => void
|
|
42
|
-
/**
|
|
43
|
-
* Function to execute when the user cancels the dialog
|
|
44
|
-
*/
|
|
45
|
-
onCancel?: () => void
|
|
46
|
-
/**
|
|
47
|
-
* Triggered when the user presses a specific button
|
|
48
|
-
*/
|
|
49
|
-
onButton?: (button_index: number, event?: Event) => void
|
|
50
|
-
/**
|
|
51
|
-
* Function to run when anything in the form is changed
|
|
52
|
-
*/
|
|
53
|
-
onFormChange?: (form_result: {[key: string]: FormResultValue}) => void
|
|
54
|
-
/**
|
|
55
|
-
* Array of HTML object strings for each line of content in the dialog.
|
|
56
|
-
*/
|
|
57
|
-
lines?: (string|HTMLElement)[]
|
|
58
|
-
/**
|
|
59
|
-
* Creates a form in the dialog
|
|
60
|
-
*/
|
|
61
|
-
form?: {
|
|
62
|
-
[formElement: string]: '_' | DialogFormElement
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Vue component
|
|
66
|
-
*/
|
|
67
|
-
component?: Vue.Component
|
|
68
|
-
/**
|
|
69
|
-
* Order that the different interface types appear in the dialog. Default is 'form', 'lines', 'component'.
|
|
70
|
-
*/
|
|
71
|
-
part_order?: string[]
|
|
72
|
-
form_first?: boolean
|
|
73
|
-
/**
|
|
74
|
-
* Creates a dialog sidebar
|
|
75
|
-
*/
|
|
76
|
-
sidebar?: DialogSidebarOptions
|
|
77
|
-
/**
|
|
78
|
-
* Menu in the handle bar
|
|
79
|
-
*/
|
|
80
|
-
title_menu?: Menu
|
|
81
|
-
/**
|
|
82
|
-
* If true, the dialog will only have one button to close it
|
|
83
|
-
*/
|
|
84
|
-
singleButton?: boolean
|
|
85
|
-
/**
|
|
86
|
-
* List of buttons
|
|
87
|
-
*/
|
|
88
|
-
buttons?: string[]
|
|
12
|
+
horizontal: boolean
|
|
13
|
+
condition?: Condition
|
|
14
|
+
width: number
|
|
15
|
+
get(): void
|
|
16
|
+
set(): void
|
|
17
|
+
node: HTMLElement
|
|
18
|
+
update(): void
|
|
19
|
+
setPosition(data: {top?: number, bottom?: number, left?: number, right?: number}): void
|
|
89
20
|
}
|
|
90
21
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
[key: string]: string | {label: string, icon: IconString, color?: string}
|
|
94
|
-
}
|
|
95
|
-
page?: string
|
|
96
|
-
actions?: (Action|ActionInterface|string)[],
|
|
97
|
-
onPageSwitch?: (page: string) => void
|
|
98
|
-
}
|
|
99
|
-
declare class DialogSidebar {
|
|
100
|
-
constructor(options: DialogSidebarOptions)
|
|
22
|
+
declare namespace Interface {
|
|
23
|
+
function createElement(type: keyof HTMLElementTagNameMap, attributes?: {}, content?: string | HTMLElement | HTMLElement[]): HTMLElement
|
|
101
24
|
|
|
102
|
-
|
|
103
|
-
|
|
25
|
+
const data: {
|
|
26
|
+
left_bar_width: number
|
|
27
|
+
right_bar_width: number
|
|
28
|
+
quad_view_x: number
|
|
29
|
+
quad_view_y: number
|
|
30
|
+
timeline_head: number
|
|
31
|
+
left_bar: string[]
|
|
32
|
+
right_bar: string[]
|
|
104
33
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
34
|
+
let left_bar_width: number
|
|
35
|
+
let right_bar_width: number
|
|
36
|
+
let top_panel_height: number
|
|
37
|
+
let bottom_panel_height: number
|
|
38
|
+
function getTopPanel(): Panel[]
|
|
39
|
+
function getBottomPanel(): Panel[]
|
|
40
|
+
function getLeftPanels(): Panel[]
|
|
41
|
+
function getRightPanels(): Panel[]
|
|
42
|
+
const Resizers: {
|
|
43
|
+
left: ResizeLine
|
|
44
|
+
right: ResizeLine
|
|
45
|
+
quad_view_x: ResizeLine
|
|
46
|
+
quad_view_y: ResizeLine
|
|
47
|
+
top: ResizeLine
|
|
48
|
+
bottom: ResizeLine
|
|
49
|
+
timeline_head: ResizeLine
|
|
50
|
+
}
|
|
51
|
+
const status_bar: {
|
|
52
|
+
menu: Menu
|
|
53
|
+
vue: Vue
|
|
54
|
+
}
|
|
55
|
+
const Panels: {
|
|
56
|
+
(key: string): Panel
|
|
57
|
+
}
|
|
58
|
+
function toggleSidebar(side, status): void
|
|
112
59
|
|
|
113
|
-
|
|
114
|
-
constructor (options: DialogOptions)
|
|
60
|
+
const text_edit_menu: Menu
|
|
115
61
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
sidebar: DialogSidebar | null
|
|
62
|
+
function addSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
|
|
63
|
+
function removeSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
|
|
119
64
|
|
|
65
|
+
const center_screen: HTMLElement
|
|
66
|
+
const page_wrapper: HTMLElement
|
|
67
|
+
const preview: HTMLElement
|
|
68
|
+
const work_screen: HTMLElement
|
|
69
|
+
const right_bar: HTMLElement
|
|
70
|
+
const left_bar: HTMLElement
|
|
120
71
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*/
|
|
130
|
-
cancel: (event?: Event) => void
|
|
131
|
-
/**
|
|
132
|
-
* Closes the dialog using the index of the pressed button
|
|
133
|
-
*/
|
|
134
|
-
close: (button: number, event?: Event) => void
|
|
135
|
-
/**
|
|
136
|
-
* If the dialog contains a form, return the current values of the form
|
|
137
|
-
*/
|
|
138
|
-
getFormResult(): {
|
|
139
|
-
[key: string]: FormResultValue
|
|
72
|
+
namespace CustomElements {
|
|
73
|
+
function SelectInput(id: string, options: {
|
|
74
|
+
value?: string
|
|
75
|
+
default?: string
|
|
76
|
+
options: {key: string, value: string}
|
|
77
|
+
onChange?(): void
|
|
78
|
+
}): HTMLElement
|
|
79
|
+
const ResizeLine;
|
|
140
80
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Set the values of the dialog form inputs
|
|
143
|
-
*/
|
|
144
|
-
setFormValues(values: {[key: string]: FormResultValue}): void
|
|
145
|
-
/**
|
|
146
|
-
* Delete the dialog object, causing it to be re-build from scratch on next open
|
|
147
|
-
*/
|
|
148
|
-
delete(): void
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Currently opened dialog
|
|
152
|
-
*/
|
|
153
|
-
static open: Dialog | null
|
|
154
81
|
}
|
package/types/menu.d.ts
CHANGED
|
@@ -13,15 +13,21 @@ interface CustomMenuItem {
|
|
|
13
13
|
*/
|
|
14
14
|
searchable?: boolean
|
|
15
15
|
children?: MenuItem[] | (() => MenuItem[])
|
|
16
|
-
click?: (context?: any, event
|
|
16
|
+
click?: (context?: any, event?: Event) => void
|
|
17
17
|
}
|
|
18
18
|
type MenuItem = CustomMenuItem | Action | BarSelect | string;
|
|
19
|
-
|
|
19
|
+
interface MenuOptions {
|
|
20
|
+
onOpen?: (position: MouseEvent | HTMLElement, context?: any) => void
|
|
21
|
+
onClose?: () => void
|
|
22
|
+
keep_open?: boolean
|
|
23
|
+
searchable?: boolean
|
|
24
|
+
}
|
|
20
25
|
/**
|
|
21
26
|
* Creates a new context menu
|
|
22
27
|
*/
|
|
23
28
|
declare class Menu extends Deletable {
|
|
24
|
-
constructor(template: MenuItem[])
|
|
29
|
+
constructor(id: string, template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
30
|
+
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
33
|
* Opens the menu somewhere
|
|
@@ -62,9 +68,12 @@ declare namespace MenuBar {
|
|
|
62
68
|
file: Menu
|
|
63
69
|
edit: Menu
|
|
64
70
|
transform: Menu
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
uv: Menu
|
|
72
|
+
texture: Menu
|
|
67
73
|
animation: Menu
|
|
74
|
+
keyframe: Menu
|
|
75
|
+
display: Menu
|
|
76
|
+
tools: Menu
|
|
68
77
|
view: Menu
|
|
69
78
|
help: Menu
|
|
70
79
|
[id: string]: Menu
|
package/types/outliner.d.ts
CHANGED
package/types/preview.d.ts
CHANGED
|
@@ -13,7 +13,17 @@ interface PreviewOptions {
|
|
|
13
13
|
antialias?: boolean
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type RaycastResult = {
|
|
17
|
+
type: 'keyframe' | 'vertex' | 'cube'
|
|
18
|
+
event: Event
|
|
19
|
+
cube?: Cube
|
|
20
|
+
intersects?: object[]
|
|
21
|
+
face?: string
|
|
22
|
+
vertex: any
|
|
23
|
+
keyframe: Keyframe
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class Preview extends Deletable {
|
|
17
27
|
constructor(options: PreviewOptions)
|
|
18
28
|
|
|
19
29
|
id: string
|
|
@@ -45,15 +55,7 @@ class Preview extends Deletable {
|
|
|
45
55
|
}
|
|
46
56
|
raycaster: THREE.Raycaster
|
|
47
57
|
|
|
48
|
-
raycast(event: MouseEvent): false |
|
|
49
|
-
type: 'keyframe' | 'vertex' | 'cube'
|
|
50
|
-
event: Event
|
|
51
|
-
cube?: Cube
|
|
52
|
-
intersects?: object[]
|
|
53
|
-
face?: string
|
|
54
|
-
vertex: any
|
|
55
|
-
keyframe: Keyframe
|
|
56
|
-
}
|
|
58
|
+
raycast(event: MouseEvent): false | RaycastResult
|
|
57
59
|
render(): void
|
|
58
60
|
setProjectionMode(orthographic: boolean): this
|
|
59
61
|
setFOV(fov: number): void
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
interface PreviewModelCubeTemplate {
|
|
2
|
+
position: ArrayVector3
|
|
3
|
+
size: ArrayVector3
|
|
4
|
+
origin?: ArrayVector3
|
|
5
|
+
rotation?: ArrayVector3
|
|
6
|
+
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}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface PreviewModelOptions {
|
|
17
|
+
condition?: Condition
|
|
18
|
+
cubes: PreviewModelCubeTemplate[]
|
|
19
|
+
/**
|
|
20
|
+
* Source of the model's texture
|
|
21
|
+
*/
|
|
22
|
+
texture?: string
|
|
23
|
+
/**
|
|
24
|
+
* Model tint color
|
|
25
|
+
*/
|
|
26
|
+
color?: string
|
|
27
|
+
/**
|
|
28
|
+
* Enable shading on the material
|
|
29
|
+
*/
|
|
30
|
+
shading?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* THREE.JS material render side
|
|
33
|
+
*/
|
|
34
|
+
render_side?: number
|
|
35
|
+
texture_size?: [number, number]
|
|
36
|
+
onUpdate?(): void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare class PreviewModel extends Deletable {
|
|
40
|
+
constructor(id: string, options: PreviewModelOptions)
|
|
41
|
+
|
|
42
|
+
static models: {
|
|
43
|
+
(id: string): PreviewModel
|
|
44
|
+
}
|
|
45
|
+
static getActiveModels(): PreviewModel[]
|
|
46
|
+
|
|
47
|
+
id: string
|
|
48
|
+
model_3d: THREE.Object3D
|
|
49
|
+
cubes: PreviewModelCubeTemplate[]
|
|
50
|
+
texture?: string
|
|
51
|
+
color?: string
|
|
52
|
+
shading: boolean
|
|
53
|
+
render_side: number
|
|
54
|
+
texture_size: [number, number]
|
|
55
|
+
onUpdate?:() => void
|
|
56
|
+
/**
|
|
57
|
+
* Enables the model in the preview
|
|
58
|
+
*/
|
|
59
|
+
enable(): void
|
|
60
|
+
/**
|
|
61
|
+
* Disables the model in the preview
|
|
62
|
+
*/
|
|
63
|
+
disable(): boolean
|
|
64
|
+
/**
|
|
65
|
+
* Update the appearance and visibility of the model
|
|
66
|
+
*/
|
|
67
|
+
update(): void
|
|
68
|
+
buildModel(): void
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
interface PreviewSceneOptions {
|
|
74
|
+
name?: string
|
|
75
|
+
description?: string
|
|
76
|
+
light_color?: string
|
|
77
|
+
light_side?: number
|
|
78
|
+
condition?: Condition
|
|
79
|
+
preview_models?: string[]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare class PreviewScene extends Deletable {
|
|
83
|
+
constructor(id: string, options: PreviewSceneOptions)
|
|
84
|
+
|
|
85
|
+
static scenes: {
|
|
86
|
+
(id: string): PreviewScene
|
|
87
|
+
}
|
|
88
|
+
static active: PreviewScene | null
|
|
89
|
+
select_options: {
|
|
90
|
+
(id: string): string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
id: string
|
|
94
|
+
name: string
|
|
95
|
+
description: string
|
|
96
|
+
light_color: string
|
|
97
|
+
light_side: number
|
|
98
|
+
condition?: Condition
|
|
99
|
+
preview_models: string[]
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Selects this preview scene
|
|
103
|
+
*/
|
|
104
|
+
select(): void
|
|
105
|
+
/**
|
|
106
|
+
* Unselects this preview scene
|
|
107
|
+
*/
|
|
108
|
+
unselect(): void
|
|
109
|
+
}
|
package/types/project.d.ts
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
declare namespace Validator {
|
|
2
|
+
const checks: ValidatorCheck[]
|
|
3
|
+
|
|
4
|
+
const warnings: []
|
|
5
|
+
const errors: []
|
|
6
|
+
/**
|
|
7
|
+
* Run the validator
|
|
8
|
+
* @param trigger ID of the Blockbench event that triggered the call
|
|
9
|
+
*/
|
|
10
|
+
function validate(trigger?: EventName): void
|
|
11
|
+
/**
|
|
12
|
+
* Opens the Validator dialog
|
|
13
|
+
*/
|
|
14
|
+
function openDialog(): void
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Cached trigger IDs
|
|
18
|
+
*/
|
|
19
|
+
const triggers: EventName[]
|
|
20
|
+
/**
|
|
21
|
+
* Update the cached triggers list
|
|
22
|
+
*/
|
|
23
|
+
function updateCashedTriggers(): void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ValidatorCheckOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Function that runs when the validator check runs
|
|
29
|
+
*/
|
|
30
|
+
run(): void
|
|
31
|
+
/**
|
|
32
|
+
* Names of events that automatically trigger this check
|
|
33
|
+
*/
|
|
34
|
+
update_triggers?: EventName[]
|
|
35
|
+
condition?: Condition
|
|
36
|
+
}
|
|
37
|
+
interface WarningOrError {
|
|
38
|
+
message: string
|
|
39
|
+
buttons?: {
|
|
40
|
+
name: string
|
|
41
|
+
icon: IconString
|
|
42
|
+
click(): void
|
|
43
|
+
}[]
|
|
44
|
+
}
|
|
45
|
+
declare class ValidatorCheck extends Deletable {
|
|
46
|
+
constructor(id: string, options: ValidatorCheckOptions)
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Manually run this check
|
|
50
|
+
*/
|
|
51
|
+
update(): void
|
|
52
|
+
/**
|
|
53
|
+
* Throw a warning. This is intended to be used inside the run() method
|
|
54
|
+
*/
|
|
55
|
+
warn(...warnings: WarningOrError[]): void
|
|
56
|
+
/**
|
|
57
|
+
* Throw an error. This is intended to be used inside the run() method
|
|
58
|
+
*/
|
|
59
|
+
fail(...warnings: WarningOrError[]): void
|
|
60
|
+
}
|