blockbench-types 5.1.0 → 5.2.0-beta.0-next.1
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/README.md +30 -30
- package/custom/animation.d.ts +256 -256
- package/custom/animation_controller.d.ts +124 -124
- package/custom/blockbench.d.ts +71 -73
- package/custom/canvas.d.ts +307 -307
- package/custom/codec.d.ts +182 -182
- package/custom/copy_paste.d.ts +43 -42
- package/custom/cube.d.ts +151 -151
- package/custom/desktop.d.ts +61 -73
- package/custom/display_mode.d.ts +137 -137
- package/custom/edit_session.d.ts +38 -37
- package/custom/global.d.ts +182 -168
- package/custom/group.d.ts +113 -113
- package/custom/interface.d.ts +83 -78
- package/custom/io.d.ts +12 -12
- package/custom/keyframe.d.ts +94 -94
- package/custom/libs.d.ts +13 -13
- package/custom/menu.d.ts +137 -136
- package/custom/mesh.d.ts +196 -196
- package/custom/misc.d.ts +188 -199
- package/custom/molang.d.ts +159 -159
- package/custom/outliner.d.ts +158 -158
- package/custom/painter.d.ts +70 -69
- package/custom/preview.d.ts +147 -137
- package/custom/preview_scene.d.ts +120 -120
- package/custom/screencam.d.ts +71 -71
- package/custom/spline_mesh.d.ts +189 -189
- package/custom/texture_group.d.ts +68 -68
- package/custom/textures.d.ts +524 -515
- package/custom/timeline.d.ts +66 -66
- package/custom/toolbars.d.ts +222 -221
- package/custom/undo.d.ts +209 -208
- package/custom/util/version_util.d.ts +32 -32
- package/custom/util.d.ts +235 -235
- package/custom/uveditor.d.ts +3 -3
- package/custom/validator.d.ts +99 -99
- package/documentation.md +12 -12
- package/generated/animations/mirror_animating.d.ts +7 -0
- package/generated/api.d.ts +6 -0
- package/generated/file_system.d.ts +1 -1
- package/generated/formats/standards/obj.d.ts +9 -11
- package/generated/interface/actions.d.ts +6 -3
- package/generated/interface/form.d.ts +2 -1
- package/generated/interface/resize_lines.d.ts +2 -0
- package/generated/interface/settings.d.ts +6 -2
- package/generated/interface/start_screen.d.ts +62 -42
- package/generated/io/project.d.ts +9 -1
- package/generated/lib/CanvasFrame.d.ts +1 -0
- package/generated/main.d.ts +1 -1
- package/generated/modeling/mesh/proportional_edit.d.ts +15 -13
- package/generated/modeling/mirror_modeling.d.ts +4 -0
- package/generated/modeling/weight_paint.d.ts +11 -0
- package/generated/texturing/layers.d.ts +140 -0
- package/generated/util/state_memory.d.ts +1 -1
- package/index.d.ts +2 -2
- package/package.json +39 -39
- package/tsconfig.json +19 -19
- package/type_config.json +45 -46
- package/custom/start_screen.d.ts +0 -15
- package/custom/texture_layers.d.ts +0 -117
- package/generated/global_types.d.ts +0 -47
- package/generated/io/formats/bedrock.d.ts +0 -4
- package/generated/io/formats/bedrock_old.d.ts +0 -4
- package/generated/io/formats/collada.d.ts +0 -4
- package/generated/io/formats/fbx.d.ts +0 -17
- package/generated/io/formats/gltf.d.ts +0 -6
- package/generated/io/formats/java_block.d.ts +0 -4
- package/generated/io/formats/modded_entity.d.ts +0 -139
- package/generated/io/formats/obj.d.ts +0 -12
- package/generated/io/formats/optifine_jem.d.ts +0 -3
- package/generated/io/formats/optifine_jpm.d.ts +0 -3
- package/generated/io/formats/skin.d.ts +0 -22
package/custom/painter.d.ts
CHANGED
|
@@ -1,69 +1,70 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
/**
|
|
3
|
-
* A global namespace containing various functionality for Blockbench's 2D and 3D paint tools and texture editor
|
|
4
|
-
*/
|
|
5
|
-
declare namespace Painter {
|
|
6
|
-
const currentPixel: ArrayVector2
|
|
7
|
-
const brushChanges: boolean
|
|
8
|
-
let current: any
|
|
9
|
-
const selection: any
|
|
10
|
-
const mirror_painting: boolean
|
|
11
|
-
const lock_alpha: boolean
|
|
12
|
-
const erase_mode: boolean
|
|
13
|
-
const default_brush_presets: any[]
|
|
14
|
-
|
|
15
|
-
function edit(
|
|
16
|
-
texture: Texture,
|
|
17
|
-
callback: (canvas: HTMLCanvasElement) => void,
|
|
18
|
-
options: TextureEditOptions
|
|
19
|
-
): void
|
|
20
|
-
function setAlphaMatrix(texture: Texture, x: number, y: number, val: number): void
|
|
21
|
-
function getAlphaMatrix(texture: Texture, x: number, y: number): number
|
|
22
|
-
|
|
23
|
-
function combineColors(base: RGBAColor, added: RGBAColor, opacity: number): RGBAColor
|
|
24
|
-
function blendColors(
|
|
25
|
-
base: RGBAColor,
|
|
26
|
-
added: RGBAColor,
|
|
27
|
-
opacity: number,
|
|
28
|
-
blend_mode: string
|
|
29
|
-
): RGBAColor
|
|
30
|
-
function getMirrorElement(element: OutlinerElement, symmetry_axes: number[]): void
|
|
31
|
-
function updateNslideValues(): void
|
|
32
|
-
function getBlendModeCompositeOperation(): string
|
|
33
|
-
function getCanvas(texture: Texture): HTMLCanvasElement
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
/**
|
|
3
|
+
* A global namespace containing various functionality for Blockbench's 2D and 3D paint tools and texture editor
|
|
4
|
+
*/
|
|
5
|
+
declare namespace Painter {
|
|
6
|
+
const currentPixel: ArrayVector2
|
|
7
|
+
const brushChanges: boolean
|
|
8
|
+
let current: any
|
|
9
|
+
const selection: any
|
|
10
|
+
const mirror_painting: boolean
|
|
11
|
+
const lock_alpha: boolean
|
|
12
|
+
const erase_mode: boolean
|
|
13
|
+
const default_brush_presets: any[]
|
|
14
|
+
|
|
15
|
+
function edit(
|
|
16
|
+
texture: Texture,
|
|
17
|
+
callback: (canvas: HTMLCanvasElement) => void,
|
|
18
|
+
options: TextureEditOptions
|
|
19
|
+
): void
|
|
20
|
+
function setAlphaMatrix(texture: Texture, x: number, y: number, val: number): void
|
|
21
|
+
function getAlphaMatrix(texture: Texture, x: number, y: number): number
|
|
22
|
+
|
|
23
|
+
function combineColors(base: RGBAColor, added: RGBAColor, opacity: number): RGBAColor
|
|
24
|
+
function blendColors(
|
|
25
|
+
base: RGBAColor,
|
|
26
|
+
added: RGBAColor,
|
|
27
|
+
opacity: number,
|
|
28
|
+
blend_mode: string
|
|
29
|
+
): RGBAColor
|
|
30
|
+
function getMirrorElement(element: OutlinerElement, symmetry_axes: number[]): void
|
|
31
|
+
function updateNslideValues(): void
|
|
32
|
+
function getBlendModeCompositeOperation(blend_mode?: string): string
|
|
33
|
+
function getCanvas(texture: Texture): HTMLCanvasElement
|
|
34
|
+
function copyCanvas(original_canvas: HTMLCanvasElement): HTMLCanvasElement
|
|
35
|
+
function scanCanvas(
|
|
36
|
+
ctx: CanvasRenderingContext2D,
|
|
37
|
+
x: number,
|
|
38
|
+
y: number,
|
|
39
|
+
w: number,
|
|
40
|
+
h: number,
|
|
41
|
+
cb: ((px: number, py: number, color: [r: number, g: number, b: number, a: number]) => [number, number, number, number] | void)
|
|
42
|
+
): void
|
|
43
|
+
function getPixelColor(ctx: CanvasRenderingContext2D, x: number, y: number): void
|
|
44
|
+
function modifyCanvasSection(
|
|
45
|
+
ctx: CanvasRenderingContext2D,
|
|
46
|
+
x: number,
|
|
47
|
+
y: number,
|
|
48
|
+
w: number,
|
|
49
|
+
h: number,
|
|
50
|
+
cb: () => void
|
|
51
|
+
): void
|
|
52
|
+
function editCircle(
|
|
53
|
+
ctx: CanvasRenderingContext2D,
|
|
54
|
+
x: number,
|
|
55
|
+
y: number,
|
|
56
|
+
r: number,
|
|
57
|
+
softness: number,
|
|
58
|
+
editPx: (RGBAColor: any, opacity: number, px: number, py: number) => RGBAColor
|
|
59
|
+
): void
|
|
60
|
+
function editSquare(
|
|
61
|
+
ctx: CanvasRenderingContext2D,
|
|
62
|
+
x: number,
|
|
63
|
+
y: number,
|
|
64
|
+
r: number,
|
|
65
|
+
softness: number,
|
|
66
|
+
editPx: (RGBAColor: any, opacity: number, px: number, py: number) => RGBAColor
|
|
67
|
+
): void
|
|
68
|
+
function openBrushOptions(): void
|
|
69
|
+
function loadBrushPreset(preset: any): void
|
|
70
|
+
}
|
package/custom/preview.d.ts
CHANGED
|
@@ -1,137 +1,147 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
interface AnglePreset {
|
|
3
|
-
position: ArrayVector3
|
|
4
|
-
target?: ArrayVector3
|
|
5
|
-
rotation?: ArrayVector3
|
|
6
|
-
projection: 'unset' | 'orthographic' | 'perspective'
|
|
7
|
-
zoom?: number
|
|
8
|
-
focal_length?: number
|
|
9
|
-
fov?: number
|
|
10
|
-
aspect_ratio?: number
|
|
11
|
-
lockedAngle?: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface PreviewOptions {
|
|
15
|
-
id: string
|
|
16
|
-
antialias?: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type RaycastResult = {
|
|
20
|
-
type: 'element' | 'keyframe' | 'vertex' | 'cube' | 'line' | 'none'
|
|
21
|
-
event: PointerEvent | MouseEvent | TouchEvent
|
|
22
|
-
cube?: Cube
|
|
23
|
-
intersects?: any[]
|
|
24
|
-
face?: string
|
|
25
|
-
vertex?: any
|
|
26
|
-
keyframe?: _Keyframe
|
|
27
|
-
element?: OutlinerElement
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type SplitScreenMode = 'single'|'double_horizontal'|'double_vertical'|'quad'|'triple_left'|'triple_right'|'triple_top'|'triple_bottom'
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Previews are 3D viewports, that can either be used as a viewport for the user, or as an offscreen view to record media.
|
|
34
|
-
*/
|
|
35
|
-
declare class Preview extends Deletable {
|
|
36
|
-
constructor(options: PreviewOptions)
|
|
37
|
-
|
|
38
|
-
id: string
|
|
39
|
-
canvas: HTMLCanvasElement
|
|
40
|
-
height: number
|
|
41
|
-
width: number
|
|
42
|
-
aspect_ratio?: number
|
|
43
|
-
node: HTMLElement
|
|
44
|
-
label: HTMLLabelElement
|
|
45
|
-
/**
|
|
46
|
-
* True if the preview is in orthographic camera mode
|
|
47
|
-
*/
|
|
48
|
-
isOrtho: boolean
|
|
49
|
-
/**
|
|
50
|
-
* Angle, when in a specific side view
|
|
51
|
-
*/
|
|
52
|
-
angle: null | number
|
|
53
|
-
default_angle?: AnglePreset
|
|
54
|
-
readonly camera: THREE.PerspectiveCamera | THREE.OrthographicCamera
|
|
55
|
-
camPers: THREE.PerspectiveCamera
|
|
56
|
-
camOrtho: THREE.OrthographicCamera
|
|
57
|
-
controls: any
|
|
58
|
-
annotations: any
|
|
59
|
-
renderer: THREE.WebGLRenderer
|
|
60
|
-
background: {
|
|
61
|
-
name: string
|
|
62
|
-
image: any
|
|
63
|
-
size: number
|
|
64
|
-
x: number
|
|
65
|
-
y: number
|
|
66
|
-
lock: boolean
|
|
67
|
-
}
|
|
68
|
-
raycaster: THREE.Raycaster
|
|
69
|
-
|
|
70
|
-
mouse: THREE.Vector2
|
|
71
|
-
|
|
72
|
-
split_screen: {
|
|
73
|
-
before: undefined | null
|
|
74
|
-
enabled: boolean
|
|
75
|
-
lazyLoadPreview: () => void
|
|
76
|
-
mode: string
|
|
77
|
-
previews: Preview[]
|
|
78
|
-
setMode(mode: string): void
|
|
79
|
-
updateSize(): void
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
raycast(event: MouseEvent): false | RaycastResult
|
|
83
|
-
render(): void
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
interface AnglePreset {
|
|
3
|
+
position: ArrayVector3
|
|
4
|
+
target?: ArrayVector3
|
|
5
|
+
rotation?: ArrayVector3
|
|
6
|
+
projection: 'unset' | 'orthographic' | 'perspective'
|
|
7
|
+
zoom?: number
|
|
8
|
+
focal_length?: number
|
|
9
|
+
fov?: number
|
|
10
|
+
aspect_ratio?: number
|
|
11
|
+
lockedAngle?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface PreviewOptions {
|
|
15
|
+
id: string
|
|
16
|
+
antialias?: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type RaycastResult = {
|
|
20
|
+
type: 'element' | 'keyframe' | 'vertex' | 'cube' | 'line' | 'none'
|
|
21
|
+
event: PointerEvent | MouseEvent | TouchEvent
|
|
22
|
+
cube?: Cube
|
|
23
|
+
intersects?: any[]
|
|
24
|
+
face?: string
|
|
25
|
+
vertex?: any
|
|
26
|
+
keyframe?: _Keyframe
|
|
27
|
+
element?: OutlinerElement
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type SplitScreenMode = 'single'|'double_horizontal'|'double_vertical'|'quad'|'triple_left'|'triple_right'|'triple_top'|'triple_bottom'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Previews are 3D viewports, that can either be used as a viewport for the user, or as an offscreen view to record media.
|
|
34
|
+
*/
|
|
35
|
+
declare class Preview extends Deletable {
|
|
36
|
+
constructor(options: PreviewOptions)
|
|
37
|
+
|
|
38
|
+
id: string
|
|
39
|
+
canvas: HTMLCanvasElement
|
|
40
|
+
height: number
|
|
41
|
+
width: number
|
|
42
|
+
aspect_ratio?: number
|
|
43
|
+
node: HTMLElement
|
|
44
|
+
label: HTMLLabelElement
|
|
45
|
+
/**
|
|
46
|
+
* True if the preview is in orthographic camera mode
|
|
47
|
+
*/
|
|
48
|
+
isOrtho: boolean
|
|
49
|
+
/**
|
|
50
|
+
* Angle, when in a specific side view
|
|
51
|
+
*/
|
|
52
|
+
angle: null | number
|
|
53
|
+
default_angle?: AnglePreset
|
|
54
|
+
readonly camera: THREE.PerspectiveCamera | THREE.OrthographicCamera
|
|
55
|
+
camPers: THREE.PerspectiveCamera
|
|
56
|
+
camOrtho: THREE.OrthographicCamera
|
|
57
|
+
controls: any
|
|
58
|
+
annotations: any
|
|
59
|
+
renderer: THREE.WebGLRenderer
|
|
60
|
+
background: {
|
|
61
|
+
name: string
|
|
62
|
+
image: any
|
|
63
|
+
size: number
|
|
64
|
+
x: number
|
|
65
|
+
y: number
|
|
66
|
+
lock: boolean
|
|
67
|
+
}
|
|
68
|
+
raycaster: THREE.Raycaster
|
|
69
|
+
|
|
70
|
+
mouse: THREE.Vector2
|
|
71
|
+
|
|
72
|
+
split_screen: {
|
|
73
|
+
before: undefined | null
|
|
74
|
+
enabled: boolean
|
|
75
|
+
lazyLoadPreview: () => void
|
|
76
|
+
mode: string
|
|
77
|
+
previews: Preview[]
|
|
78
|
+
setMode(mode: string): void
|
|
79
|
+
updateSize(): void
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
raycast(event: MouseEvent): false | RaycastResult
|
|
83
|
+
render(): void
|
|
84
|
+
/**
|
|
85
|
+
* Set a size of the preview in pixels. With no arguments, and if the preview node is connected to the DOM, it will adjust to the size of the parent element
|
|
86
|
+
*/
|
|
87
|
+
resize(width?: number, height?: number): void
|
|
88
|
+
setProjectionMode(orthographic: boolean): this
|
|
89
|
+
setFOV(fov: number): void
|
|
90
|
+
setLockedAngle(angle: number): this
|
|
91
|
+
|
|
92
|
+
loadAnglePreset(angle_preset: AnglePreset): this
|
|
93
|
+
/**
|
|
94
|
+
* Opens a dialog to create and save a new angle preset
|
|
95
|
+
*/
|
|
96
|
+
newAnglePreset(): this
|
|
97
|
+
|
|
98
|
+
getFacingDirection(): 'north' | 'south' | 'east' | 'west'
|
|
99
|
+
getFacingHeight(): 'up' | 'middle' | 'down'
|
|
100
|
+
|
|
101
|
+
occupyTransformer(): this
|
|
102
|
+
showContextMenu(event: Event | HTMLElement): this
|
|
103
|
+
loadBackground(): void
|
|
104
|
+
/**
|
|
105
|
+
* Take a screenshot of the current view of the preview
|
|
106
|
+
*/
|
|
107
|
+
screenshot(options: ScreenshotOptions, callback: ScreenshotReturn): void
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* List of all previews
|
|
111
|
+
*/
|
|
112
|
+
static all: Preview[]
|
|
113
|
+
/**
|
|
114
|
+
* The last used preview
|
|
115
|
+
*/
|
|
116
|
+
static selected: Preview
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Utility regarding split screen preview mode
|
|
120
|
+
*/
|
|
121
|
+
static split_screen: {
|
|
122
|
+
/**
|
|
123
|
+
* Whether the split screen is enabled
|
|
124
|
+
*/
|
|
125
|
+
enabled: boolean
|
|
126
|
+
/**
|
|
127
|
+
* The current split screen mode
|
|
128
|
+
*/
|
|
129
|
+
mode: SplitScreenMode
|
|
130
|
+
previews: Preview[]
|
|
131
|
+
lazyLoadPreview(index: number, camera_preset): Preview
|
|
132
|
+
/**
|
|
133
|
+
* Set a split screen mode
|
|
134
|
+
*/
|
|
135
|
+
setMode(mode: SplitScreenMode = 'single')
|
|
136
|
+
/**
|
|
137
|
+
* Update the size of the split screens
|
|
138
|
+
*/
|
|
139
|
+
updateSize()
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
declare const DefaultCameraPresets: AnglePreset[]
|
|
144
|
+
|
|
145
|
+
declare const MediaPreview: Preview
|
|
146
|
+
|
|
147
|
+
declare function animate(): void
|
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
interface PreviewModelCubeTemplate {
|
|
3
|
-
position: ArrayVector3
|
|
4
|
-
size: ArrayVector3
|
|
5
|
-
origin?: ArrayVector3
|
|
6
|
-
rotation?: ArrayVector3
|
|
7
|
-
faces: {
|
|
8
|
-
north?: { uv: ArrayVector4 }
|
|
9
|
-
east?: { uv: ArrayVector4 }
|
|
10
|
-
west?: { uv: ArrayVector4 }
|
|
11
|
-
south?: { uv: ArrayVector4 }
|
|
12
|
-
up?: { uv: ArrayVector4 }
|
|
13
|
-
down?: { uv: ArrayVector4 }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface PreviewModelOptions {
|
|
18
|
-
condition?: ConditionResolvable
|
|
19
|
-
cubes: PreviewModelCubeTemplate[]
|
|
20
|
-
/**
|
|
21
|
-
* Source of the model's texture
|
|
22
|
-
*/
|
|
23
|
-
texture?: string
|
|
24
|
-
/**
|
|
25
|
-
* Model tint color
|
|
26
|
-
*/
|
|
27
|
-
color?: string
|
|
28
|
-
/**
|
|
29
|
-
* Enable shading on the material
|
|
30
|
-
*/
|
|
31
|
-
shading?: boolean
|
|
32
|
-
/**
|
|
33
|
-
* THREE.JS material render side
|
|
34
|
-
*/
|
|
35
|
-
render_side?: number
|
|
36
|
-
texture_size?: [number, number]
|
|
37
|
-
onUpdate?(): void
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare class PreviewModel extends Deletable {
|
|
41
|
-
constructor(id: string, options: PreviewModelOptions)
|
|
42
|
-
|
|
43
|
-
static models: {
|
|
44
|
-
[id: string]: PreviewModel
|
|
45
|
-
}
|
|
46
|
-
static getActiveModels(): PreviewModel[]
|
|
47
|
-
|
|
48
|
-
id: string
|
|
49
|
-
model_3d: THREE.Object3D
|
|
50
|
-
cubes: PreviewModelCubeTemplate[]
|
|
51
|
-
texture?: string
|
|
52
|
-
color?: string
|
|
53
|
-
shading: boolean
|
|
54
|
-
render_side: number
|
|
55
|
-
texture_size: [number, number]
|
|
56
|
-
onUpdate?: () => void
|
|
57
|
-
/**
|
|
58
|
-
* Enables the model in the preview
|
|
59
|
-
*/
|
|
60
|
-
enable(): void
|
|
61
|
-
/**
|
|
62
|
-
* Disables the model in the preview
|
|
63
|
-
*/
|
|
64
|
-
disable(): boolean
|
|
65
|
-
/**
|
|
66
|
-
* Update the appearance and visibility of the model
|
|
67
|
-
*/
|
|
68
|
-
update(): void
|
|
69
|
-
buildModel(): void
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
interface PreviewSceneOptions {
|
|
73
|
-
name?: string
|
|
74
|
-
description?: string
|
|
75
|
-
category?: string
|
|
76
|
-
light_color?: string
|
|
77
|
-
light_side?: number
|
|
78
|
-
condition?: ConditionResolvable
|
|
79
|
-
preview_models?: string[]
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare class PreviewScene extends Deletable {
|
|
83
|
-
constructor(id: string, options: PreviewSceneOptions)
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* All preview scenes, listed by ID
|
|
87
|
-
*/
|
|
88
|
-
static scenes: Record<string, PreviewScene>
|
|
89
|
-
/**
|
|
90
|
-
* The currently active scene
|
|
91
|
-
*/
|
|
92
|
-
static active: PreviewScene | null
|
|
93
|
-
/**
|
|
94
|
-
* The URL to the source repository that scenes are pulled from
|
|
95
|
-
*/
|
|
96
|
-
static source_repository: string
|
|
97
|
-
static menu_categories: {
|
|
98
|
-
[category_id: string]: {
|
|
99
|
-
[id: string]: string
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
id: string
|
|
104
|
-
name: string
|
|
105
|
-
description: string
|
|
106
|
-
category?: string
|
|
107
|
-
light_color: string
|
|
108
|
-
light_side: number
|
|
109
|
-
condition?: ConditionResolvable
|
|
110
|
-
preview_models: string[]
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Selects this preview scene
|
|
114
|
-
*/
|
|
115
|
-
select(): void
|
|
116
|
-
/**
|
|
117
|
-
* Unselects this preview scene
|
|
118
|
-
*/
|
|
119
|
-
unselect(): void
|
|
120
|
-
}
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
interface PreviewModelCubeTemplate {
|
|
3
|
+
position: ArrayVector3
|
|
4
|
+
size: ArrayVector3
|
|
5
|
+
origin?: ArrayVector3
|
|
6
|
+
rotation?: ArrayVector3
|
|
7
|
+
faces: {
|
|
8
|
+
north?: { uv: ArrayVector4 }
|
|
9
|
+
east?: { uv: ArrayVector4 }
|
|
10
|
+
west?: { uv: ArrayVector4 }
|
|
11
|
+
south?: { uv: ArrayVector4 }
|
|
12
|
+
up?: { uv: ArrayVector4 }
|
|
13
|
+
down?: { uv: ArrayVector4 }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface PreviewModelOptions {
|
|
18
|
+
condition?: ConditionResolvable
|
|
19
|
+
cubes: PreviewModelCubeTemplate[]
|
|
20
|
+
/**
|
|
21
|
+
* Source of the model's texture
|
|
22
|
+
*/
|
|
23
|
+
texture?: string
|
|
24
|
+
/**
|
|
25
|
+
* Model tint color
|
|
26
|
+
*/
|
|
27
|
+
color?: string
|
|
28
|
+
/**
|
|
29
|
+
* Enable shading on the material
|
|
30
|
+
*/
|
|
31
|
+
shading?: boolean
|
|
32
|
+
/**
|
|
33
|
+
* THREE.JS material render side
|
|
34
|
+
*/
|
|
35
|
+
render_side?: number
|
|
36
|
+
texture_size?: [number, number]
|
|
37
|
+
onUpdate?(): void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare class PreviewModel extends Deletable {
|
|
41
|
+
constructor(id: string, options: PreviewModelOptions)
|
|
42
|
+
|
|
43
|
+
static models: {
|
|
44
|
+
[id: string]: PreviewModel
|
|
45
|
+
}
|
|
46
|
+
static getActiveModels(): PreviewModel[]
|
|
47
|
+
|
|
48
|
+
id: string
|
|
49
|
+
model_3d: THREE.Object3D
|
|
50
|
+
cubes: PreviewModelCubeTemplate[]
|
|
51
|
+
texture?: string
|
|
52
|
+
color?: string
|
|
53
|
+
shading: boolean
|
|
54
|
+
render_side: number
|
|
55
|
+
texture_size: [number, number]
|
|
56
|
+
onUpdate?: () => void
|
|
57
|
+
/**
|
|
58
|
+
* Enables the model in the preview
|
|
59
|
+
*/
|
|
60
|
+
enable(): void
|
|
61
|
+
/**
|
|
62
|
+
* Disables the model in the preview
|
|
63
|
+
*/
|
|
64
|
+
disable(): boolean
|
|
65
|
+
/**
|
|
66
|
+
* Update the appearance and visibility of the model
|
|
67
|
+
*/
|
|
68
|
+
update(): void
|
|
69
|
+
buildModel(): void
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface PreviewSceneOptions {
|
|
73
|
+
name?: string
|
|
74
|
+
description?: string
|
|
75
|
+
category?: string
|
|
76
|
+
light_color?: string
|
|
77
|
+
light_side?: number
|
|
78
|
+
condition?: ConditionResolvable
|
|
79
|
+
preview_models?: string[]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare class PreviewScene extends Deletable {
|
|
83
|
+
constructor(id: string, options: PreviewSceneOptions)
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* All preview scenes, listed by ID
|
|
87
|
+
*/
|
|
88
|
+
static scenes: Record<string, PreviewScene>
|
|
89
|
+
/**
|
|
90
|
+
* The currently active scene
|
|
91
|
+
*/
|
|
92
|
+
static active: PreviewScene | null
|
|
93
|
+
/**
|
|
94
|
+
* The URL to the source repository that scenes are pulled from
|
|
95
|
+
*/
|
|
96
|
+
static source_repository: string
|
|
97
|
+
static menu_categories: {
|
|
98
|
+
[category_id: string]: {
|
|
99
|
+
[id: string]: string
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
id: string
|
|
104
|
+
name: string
|
|
105
|
+
description: string
|
|
106
|
+
category?: string
|
|
107
|
+
light_color: string
|
|
108
|
+
light_side: number
|
|
109
|
+
condition?: ConditionResolvable
|
|
110
|
+
preview_models: string[]
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Selects this preview scene
|
|
114
|
+
*/
|
|
115
|
+
select(): void
|
|
116
|
+
/**
|
|
117
|
+
* Unselects this preview scene
|
|
118
|
+
*/
|
|
119
|
+
unselect(): void
|
|
120
|
+
}
|