blockbench-types 4.5.0 → 4.6.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/package.json +10 -3
- package/scripts/generate_docs.js +368 -0
- package/tsconfig.json +16 -0
- package/types/action.d.ts +75 -11
- package/types/animation.d.ts +53 -22
- package/types/animation_controller.d.ts +112 -0
- package/types/blockbench.d.ts +406 -0
- package/types/canvas.d.ts +90 -54
- package/types/codec.d.ts +62 -1
- package/types/cube.d.ts +132 -0
- package/types/dialog.d.ts +109 -32
- package/types/display_mode.d.ts +37 -0
- package/types/format.d.ts +4 -4
- package/types/group.d.ts +74 -0
- package/types/interface.d.ts +4 -4
- package/types/keyframe.d.ts +18 -11
- package/types/menu.d.ts +2 -5
- package/types/mesh.d.ts +138 -0
- package/types/misc.d.ts +172 -0
- package/types/mode.d.ts +34 -0
- package/types/outliner.d.ts +61 -123
- package/types/painter.d.ts +29 -0
- package/types/panel.d.ts +4 -4
- package/types/plugin.d.ts +4 -0
- package/types/preview_scene.d.ts +3 -3
- package/types/project.d.ts +7 -3
- package/types/screencam.d.ts +63 -0
- package/types/settings.d.ts +10 -10
- package/types/textures.d.ts +4 -2
- package/types/timeline.d.ts +4 -1
- package/types/undo.d.ts +29 -9
- package/types/util.d.ts +35 -4
- package/types/validator.d.ts +3 -3
- package/types/file_system.d.ts +0 -145
- package/types/index.d.ts +0 -312
package/types/canvas.d.ts
CHANGED
|
@@ -38,174 +38,210 @@ interface UpdateViewOptions {
|
|
|
38
38
|
selection?: boolean
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
declare
|
|
42
|
-
materials: {
|
|
41
|
+
declare namespace Canvas {
|
|
42
|
+
const materials: {
|
|
43
43
|
[uuid: UUID]: THREE.Material
|
|
44
44
|
};
|
|
45
|
-
meshes: {
|
|
45
|
+
const meshes: {
|
|
46
46
|
[uuid: UUID]: THREE.Mesh
|
|
47
47
|
};
|
|
48
|
-
bones: {
|
|
48
|
+
const bones: {
|
|
49
49
|
[uuid: UUID]: THREE.Object3D
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
52
52
|
* Main scene, shared across all tabs
|
|
53
53
|
*/
|
|
54
|
-
scene: THREE.Scene
|
|
54
|
+
const scene: THREE.Scene
|
|
55
55
|
/**
|
|
56
56
|
* List of the gizmos (control and UI elements) in the 3D scene
|
|
57
57
|
*/
|
|
58
|
-
gizmos: []
|
|
58
|
+
const gizmos: []
|
|
59
59
|
/**
|
|
60
60
|
* The material used for all selection outlines
|
|
61
61
|
*/
|
|
62
|
-
outlineMaterial: THREE.LineBasicMaterial;
|
|
63
|
-
meshOutlineMaterial: THREE.LineBasicMaterial;
|
|
62
|
+
const outlineMaterial: THREE.LineBasicMaterial;
|
|
63
|
+
const meshOutlineMaterial: THREE.LineBasicMaterial;
|
|
64
64
|
/**
|
|
65
65
|
* The material used for the wireframe view
|
|
66
66
|
*/
|
|
67
|
-
wireframeMaterial: THREE.MeshBasicMaterial;
|
|
68
|
-
solidMaterial: THREE.ShaderMaterial;
|
|
69
|
-
normalHelperMaterial: THREE.ShaderMaterial;
|
|
70
|
-
uvHelperMaterial: THREE.ShaderMaterial;
|
|
71
|
-
meshVertexMaterial: THREE.PointsMaterial;
|
|
67
|
+
const wireframeMaterial: THREE.MeshBasicMaterial;
|
|
68
|
+
const solidMaterial: THREE.ShaderMaterial;
|
|
69
|
+
const normalHelperMaterial: THREE.ShaderMaterial;
|
|
70
|
+
const uvHelperMaterial: THREE.ShaderMaterial;
|
|
71
|
+
const meshVertexMaterial: THREE.PointsMaterial;
|
|
72
72
|
/**
|
|
73
73
|
* The material used for the grids
|
|
74
74
|
*/
|
|
75
|
-
gridMaterial: THREE.LineBasicMaterial;
|
|
75
|
+
const gridMaterial: THREE.LineBasicMaterial;
|
|
76
76
|
|
|
77
|
-
pivot_marker: THREE.Object3D
|
|
77
|
+
const pivot_marker: THREE.Object3D
|
|
78
78
|
|
|
79
|
-
global_light_color: THREE.Color
|
|
80
|
-
global_light_side: number
|
|
79
|
+
const global_light_color: THREE.Color
|
|
80
|
+
const global_light_side: number
|
|
81
81
|
|
|
82
|
-
face_order: string[];
|
|
82
|
+
const face_order: string[];
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Raycast on the currently selected preview
|
|
86
86
|
*/
|
|
87
|
-
raycast(event: MouseEvent): any;
|
|
87
|
+
function raycast(event: MouseEvent): any;
|
|
88
88
|
/**
|
|
89
89
|
* Execute the callback function without any gizmos, grids and helpers visible
|
|
90
90
|
*/
|
|
91
|
-
withoutGizmos(cb: () => void): void;
|
|
91
|
+
function withoutGizmos(cb: () => void): void;
|
|
92
92
|
/**
|
|
93
93
|
* Clear all elements from the scene
|
|
94
94
|
*/
|
|
95
|
-
clear(): void;
|
|
96
|
-
buildGrid(): void;
|
|
97
|
-
updateShading(): void;
|
|
95
|
+
function clear(): void;
|
|
96
|
+
function buildGrid(): void;
|
|
97
|
+
function updateShading(): void;
|
|
98
98
|
/**
|
|
99
99
|
* Updates selected aspects of the preview
|
|
100
100
|
* @param options
|
|
101
101
|
*/
|
|
102
|
-
updateView(options: UpdateViewOptions): void;
|
|
102
|
+
function updateView(options: UpdateViewOptions): void;
|
|
103
103
|
/**
|
|
104
104
|
* Regenerate all elements in the scene. Very unoptimized, use with care
|
|
105
105
|
*/
|
|
106
|
-
updateAll(): void;
|
|
106
|
+
function updateAll(): void;
|
|
107
107
|
/**
|
|
108
108
|
* Update the position and shape of all elements
|
|
109
109
|
*/
|
|
110
|
-
updateAllPositions(): void;
|
|
110
|
+
function updateAllPositions(): void;
|
|
111
111
|
/**
|
|
112
112
|
* Update the visibility of all elements
|
|
113
113
|
*/
|
|
114
|
-
updateVisibility(): void;
|
|
114
|
+
function updateVisibility(): void;
|
|
115
115
|
/**
|
|
116
116
|
* Update all faces in the scene
|
|
117
117
|
* @param texture Texture filter. If specified, only faces with this texture will be updated
|
|
118
118
|
*/
|
|
119
|
-
updateAllFaces(texture: Texture): void;
|
|
119
|
+
function updateAllFaces(texture: Texture): void;
|
|
120
120
|
/**
|
|
121
121
|
* Update all UV maps in the scene
|
|
122
122
|
*/
|
|
123
|
-
updateAllUVs(): void;
|
|
123
|
+
function updateAllUVs(): void;
|
|
124
124
|
/**
|
|
125
125
|
* Returns the three.js render sides based on the current settings and state
|
|
126
126
|
*/
|
|
127
|
-
getRenderSide(): number;
|
|
127
|
+
function getRenderSide(): number;
|
|
128
128
|
/**
|
|
129
129
|
* Update render sides of all materials
|
|
130
130
|
*/
|
|
131
|
-
updateRenderSides(): void;
|
|
131
|
+
function updateRenderSides(): void;
|
|
132
132
|
/**
|
|
133
133
|
* Redraw the selected elements in the scene
|
|
134
134
|
* @param arr Optionally specify an array of elements to update
|
|
135
135
|
*/
|
|
136
136
|
|
|
137
|
-
updateSelected(arr: any): void;
|
|
137
|
+
function updateSelected(arr: any): void;
|
|
138
138
|
/**
|
|
139
139
|
* Update positions and shapes of the selected elements
|
|
140
140
|
*/
|
|
141
|
-
updatePositions(y): void;
|
|
141
|
+
function updatePositions(y): void;
|
|
142
142
|
/**
|
|
143
143
|
* Update the faces of all selected elements (material, UV map)
|
|
144
144
|
*/
|
|
145
|
-
updateSelectedFaces(): void;
|
|
145
|
+
function updateSelectedFaces(): void;
|
|
146
146
|
/**
|
|
147
147
|
* Update the UV maps of all selected elements
|
|
148
148
|
*/
|
|
149
|
-
updateUVs(): void;
|
|
149
|
+
function updateUVs(): void;
|
|
150
150
|
/**
|
|
151
151
|
* Update the hierarchy and position of all bones
|
|
152
152
|
*/
|
|
153
|
-
updateAllBones(): void;
|
|
153
|
+
function updateAllBones(): void;
|
|
154
154
|
/**
|
|
155
155
|
* Update the position of the origin / pivot point gizmo
|
|
156
156
|
*/
|
|
157
|
-
updateOrigin(): boolean;
|
|
157
|
+
function updateOrigin(): boolean;
|
|
158
158
|
/**
|
|
159
159
|
* Update the position and shape of the specified cube
|
|
160
160
|
* @param cube Cube to update
|
|
161
161
|
* @param mesh Mesh instance of the cube
|
|
162
162
|
*/
|
|
163
|
-
adaptObjectPosition(cube: Cube, mesh?: THREE.Mesh): void;
|
|
163
|
+
function adaptObjectPosition(cube: Cube, mesh?: THREE.Mesh): void;
|
|
164
164
|
/**
|
|
165
165
|
* Update the geometry faces of the specified cube
|
|
166
166
|
* @param cube Cube to update
|
|
167
167
|
*/
|
|
168
|
-
adaptObjectFaceGeo(cube: any): void;
|
|
168
|
+
function adaptObjectFaceGeo(cube: any): void;
|
|
169
169
|
/**
|
|
170
170
|
* Update the faces (material) of the specified cube
|
|
171
171
|
* @param cube Cube to update
|
|
172
172
|
* @param mesh Mesh instance of the cube
|
|
173
173
|
*/
|
|
174
|
-
adaptObjectFaces(cube: any, mesh: any): void;
|
|
174
|
+
function adaptObjectFaces(cube: any, mesh: any): void;
|
|
175
175
|
/**
|
|
176
176
|
* Update the layered or not layered material of all elements
|
|
177
177
|
*/
|
|
178
|
-
updateLayeredTextures(): void;
|
|
178
|
+
function updateLayeredTextures(): void;
|
|
179
179
|
/**
|
|
180
180
|
* Update the UV map of the specified cube
|
|
181
181
|
* @param cube Cube to update
|
|
182
182
|
* @param animation Whether to display the current animated texture frame
|
|
183
183
|
*/
|
|
184
|
-
updateUV(cube: Cube, animation?: boolean): any;
|
|
184
|
+
function updateUV(cube: Cube, animation?: boolean): any;
|
|
185
185
|
/**
|
|
186
186
|
* Update the materials of marker colors if new colors were added
|
|
187
187
|
*/
|
|
188
|
-
updateMarkerColorMaterials(): void;
|
|
188
|
+
function updateMarkerColorMaterials(): void;
|
|
189
189
|
/**
|
|
190
190
|
* Create an additional outline around the specified cubes
|
|
191
191
|
* @param arr List of cubes to outline
|
|
192
192
|
*/
|
|
193
|
-
outlineObjects(arr: Cube[]): void;
|
|
193
|
+
function outlineObjects(arr: Cube[]): void;
|
|
194
194
|
/**
|
|
195
195
|
* Calculate the size of the model, in the currently displayed shape. Returns [width, height] in blockbench units
|
|
196
196
|
*/
|
|
197
|
-
getModelSize(): [number, number];
|
|
198
|
-
}
|
|
197
|
+
function getModelSize(): [number, number];
|
|
198
|
+
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
201
|
* 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.
|
|
202
202
|
*/
|
|
203
|
-
declare
|
|
204
|
-
outliner: undefined | true
|
|
205
|
-
selection: undefined | true
|
|
206
|
-
main_uv: undefined | true
|
|
207
|
-
texture_list: undefined | true
|
|
208
|
-
keyframes: undefined | true
|
|
209
|
-
keyframe_selection: undefined | true
|
|
210
|
-
keybind_conflicts: undefined | true
|
|
203
|
+
declare namespace TickUpdates {
|
|
204
|
+
const outliner: undefined | true
|
|
205
|
+
const selection: undefined | true
|
|
206
|
+
const main_uv: undefined | true
|
|
207
|
+
const texture_list: undefined | true
|
|
208
|
+
const keyframes: undefined | true
|
|
209
|
+
const keyframe_selection: undefined | true
|
|
210
|
+
const keybind_conflicts: undefined | true
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
interface NodePreviewControllerOptions {
|
|
214
|
+
setup?(element: OutlinerNode): void
|
|
215
|
+
remove?(element: OutlinerNode): void
|
|
216
|
+
updateAll?(element: OutlinerNode): void
|
|
217
|
+
updateTransform?(element: OutlinerNode): void
|
|
218
|
+
updateVisibility?(element: OutlinerNode): void
|
|
219
|
+
updateSelection?(element: OutlinerNode): void
|
|
220
|
+
updateGeometry?(element: OutlinerNode): void
|
|
221
|
+
updateUV?(element: OutlinerNode): void
|
|
222
|
+
updateFaces?(element: OutlinerNode): void
|
|
223
|
+
updatePaintingGrid?(element: OutlinerNode): void
|
|
224
|
+
updateHighlight?(element: OutlinerNode): void
|
|
225
|
+
}
|
|
226
|
+
declare class NodePreviewController {
|
|
227
|
+
constructor(type: typeof OutlinerNode, options: NodePreviewControllerOptions)
|
|
228
|
+
type: typeof OutlinerNode
|
|
229
|
+
events: {
|
|
230
|
+
[event_name: string]: ((data) => void)[]
|
|
231
|
+
}
|
|
232
|
+
dispatchEvent(event_name: string, data: object)
|
|
233
|
+
on(event_name: string, cb: (data) => void)
|
|
234
|
+
removeListener(event_name: string, cb: (data) => void)
|
|
235
|
+
|
|
236
|
+
setup(element: OutlinerNode): void
|
|
237
|
+
remove(element: OutlinerNode): void
|
|
238
|
+
updateAll(element: OutlinerNode): void
|
|
239
|
+
updateTransform(element: OutlinerNode): void
|
|
240
|
+
updateVisibility(element: OutlinerNode): void
|
|
241
|
+
updateSelection(element: OutlinerNode): void
|
|
242
|
+
updateGeometry(instance: OutlinerNode): void
|
|
243
|
+
updateUV(instance: OutlinerNode): void
|
|
244
|
+
updateFaces(instance: OutlinerNode): void
|
|
245
|
+
updatePaintingGrid(instance: OutlinerNode): void
|
|
246
|
+
updateHighlight(instance: OutlinerNode): void
|
|
211
247
|
}
|
package/types/codec.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
interface CodecOptions {
|
|
2
3
|
name: string
|
|
3
4
|
load?(model: any, file: object, add?: boolean): void
|
|
@@ -22,36 +23,96 @@ interface CodecOptions {
|
|
|
22
23
|
load_filter?: {
|
|
23
24
|
extensions: string[]
|
|
24
25
|
type: 'json' | 'text'
|
|
25
|
-
condition?:
|
|
26
|
+
condition?: ConditionResolvable
|
|
26
27
|
}
|
|
27
28
|
export_action?: Action
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A codec represents a specific file format that can be imported into and exported from Blockbench. The codec handles the compilation and parsing, as well as the loading and exporting logic
|
|
33
|
+
*/
|
|
30
34
|
declare class Codec extends Deletable {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new codec
|
|
37
|
+
* @param id Codec ID
|
|
38
|
+
* @param options Codec options
|
|
39
|
+
*/
|
|
31
40
|
constructor(id: string, options: CodecOptions)
|
|
32
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Load a file into the program
|
|
44
|
+
* @param model
|
|
45
|
+
* @param file
|
|
46
|
+
* @param add
|
|
47
|
+
*/
|
|
33
48
|
load?(model: any, file: object, add?: boolean): void
|
|
49
|
+
/**
|
|
50
|
+
* Compiles the file content
|
|
51
|
+
* @param options
|
|
52
|
+
*/
|
|
34
53
|
compile?(options?: object): any
|
|
54
|
+
/**
|
|
55
|
+
* Takes the content of a file, and loads the model into the current Blockbench project
|
|
56
|
+
* @param data File content
|
|
57
|
+
* @param path File path
|
|
58
|
+
*/
|
|
35
59
|
parse?(data: any, path: string): void
|
|
60
|
+
/**
|
|
61
|
+
* Opens the file browser to export a file of this type
|
|
62
|
+
*/
|
|
36
63
|
export?(): void
|
|
37
64
|
/**
|
|
38
65
|
* Generate a file name to suggest when exporting
|
|
39
66
|
*/
|
|
40
67
|
fileName?(): string
|
|
68
|
+
/**
|
|
69
|
+
* Generates the suggested file path. This is the path that the explorer opens in when exporting this type
|
|
70
|
+
*/
|
|
41
71
|
startPath?(): string
|
|
72
|
+
/**
|
|
73
|
+
* Write the content of this file to the selected location. The default method can be overwritten to achieve custom behavior
|
|
74
|
+
* @param content File content, as generated by compile()
|
|
75
|
+
* @param path The file export path
|
|
76
|
+
*/
|
|
42
77
|
write?(content: any, path: string): void
|
|
43
78
|
overwrite?(content: any, path: string, callback: ((path) => void)): void
|
|
44
79
|
afterDownload?(path): void
|
|
45
80
|
afterSave?(path): void
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Adds an event listener to the codec
|
|
84
|
+
* @param event_name The event type to listen for
|
|
85
|
+
* @param callback
|
|
86
|
+
*/
|
|
46
87
|
on(event_name: string, callback: (data: object) => void): void
|
|
88
|
+
/**
|
|
89
|
+
* Removes an event listener from the codec
|
|
90
|
+
* @param event_name
|
|
91
|
+
* @param callback
|
|
92
|
+
*/
|
|
47
93
|
removeListener(event_name: string, callback: (data: object) => void): void
|
|
48
94
|
dispatchEvent(data: object): void
|
|
49
95
|
|
|
96
|
+
/**
|
|
97
|
+
* The display name of the codec
|
|
98
|
+
*/
|
|
50
99
|
name: string
|
|
100
|
+
/**
|
|
101
|
+
* The default file extension that the codec uses
|
|
102
|
+
*/
|
|
51
103
|
extension: string
|
|
104
|
+
/**
|
|
105
|
+
* Whether to remember files that use this codec in the recent models list
|
|
106
|
+
*/
|
|
52
107
|
remember: boolean
|
|
108
|
+
/**
|
|
109
|
+
* If available, the action that is used to export files using this codec
|
|
110
|
+
*/
|
|
53
111
|
export_action?: Action
|
|
54
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Get a list of all possible extensions of all codecs
|
|
115
|
+
*/
|
|
55
116
|
static getAllExtensions(): string[]
|
|
56
117
|
}
|
|
57
118
|
|
package/types/cube.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
interface CubeOptions {
|
|
2
|
+
name: string
|
|
3
|
+
autouv: 0 | 1 | 2
|
|
4
|
+
shade: boolean
|
|
5
|
+
mirror_uv: boolean
|
|
6
|
+
inflate: number
|
|
7
|
+
color: number
|
|
8
|
+
visibility: boolean
|
|
9
|
+
from: ArrayVector3
|
|
10
|
+
to: ArrayVector3
|
|
11
|
+
rotation: ArrayVector3
|
|
12
|
+
origin: ArrayVector3
|
|
13
|
+
/**
|
|
14
|
+
* UV position for box UV mode
|
|
15
|
+
*/
|
|
16
|
+
uv_offset: ArrayVector2
|
|
17
|
+
}
|
|
18
|
+
declare class Cube extends OutlinerElement {
|
|
19
|
+
constructor (options: Partial<CubeOptions>, uuid?: string)
|
|
20
|
+
/**
|
|
21
|
+
* Auto UV setting, saved as an integer, where 0 means disabled, 1 means enabled, and 2 means relative auto UV (cube position affects UV)
|
|
22
|
+
*/
|
|
23
|
+
autouv: 0 | 1 | 2
|
|
24
|
+
/**
|
|
25
|
+
* Enable or disable shading based on face normal
|
|
26
|
+
*/
|
|
27
|
+
shade: boolean
|
|
28
|
+
/**
|
|
29
|
+
* UV mirror across the X axis when using Box UV
|
|
30
|
+
*/
|
|
31
|
+
mirror_uv: boolean
|
|
32
|
+
/**
|
|
33
|
+
* Inflate adds an inflation value to all sides equally
|
|
34
|
+
*/
|
|
35
|
+
inflate: number
|
|
36
|
+
/**
|
|
37
|
+
* Visibility of the cube in the viewport
|
|
38
|
+
*/
|
|
39
|
+
visibility: boolean
|
|
40
|
+
from: ArrayVector3
|
|
41
|
+
to: ArrayVector3
|
|
42
|
+
rotation: ArrayVector3
|
|
43
|
+
origin: ArrayVector3
|
|
44
|
+
faces: {
|
|
45
|
+
[fkey: string]: CubeFace
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* UV position for box UV mode
|
|
49
|
+
*/
|
|
50
|
+
uv_offset: ArrayVector2
|
|
51
|
+
|
|
52
|
+
extend(options: Partial<CubeOptions>): this
|
|
53
|
+
/**
|
|
54
|
+
* Calculates and returns the size of a cube across a certain axis. If the axis argument is omitted, it returns all sizes as an array vector.
|
|
55
|
+
*/
|
|
56
|
+
size(axis?: number, floored?: boolean): number | ArrayVector3
|
|
57
|
+
rotationAxis(): void
|
|
58
|
+
getUndoCopy(aspects?: object): void
|
|
59
|
+
getSaveCopy(project?: boolean): void
|
|
60
|
+
/**
|
|
61
|
+
* Rotate the cube around axis in 90 degree steps
|
|
62
|
+
* @param axis Axis index
|
|
63
|
+
* @param steps Number of steps
|
|
64
|
+
* @param origin Rotation pivot
|
|
65
|
+
*/
|
|
66
|
+
roll(axis: number, steps: number, origin: ArrayVector3): void
|
|
67
|
+
flip(axis: number, center: number, skipUV?: boolean): void
|
|
68
|
+
/**
|
|
69
|
+
* Transfer the origin to a new position, while updating from and to to keep the same visual position.
|
|
70
|
+
*/
|
|
71
|
+
transferOrigin(origin: ArrayVector3, update?: boolean): void
|
|
72
|
+
getWorldCenter(): THREE.Vector3
|
|
73
|
+
getGlobalVertexPositions(): ArrayVector3[]
|
|
74
|
+
setUVMode(box_uv: boolean): void
|
|
75
|
+
setColor(color: number): void
|
|
76
|
+
applyTexture(texture: Texture, faces: true | undefined | CubeFaceDirection[]): void
|
|
77
|
+
mapAutoUV(): void
|
|
78
|
+
moveVector(offset: ArrayVector3, axis: number, update?: boolean): void
|
|
79
|
+
resize(value: number, axis: number, negative: boolean, allow_negative?: boolean, bidirectional?: boolean): void
|
|
80
|
+
|
|
81
|
+
static all: Cube[]
|
|
82
|
+
static selected: Cube[]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface FaceOptions {
|
|
86
|
+
texture?: Texture
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
declare class Face {
|
|
90
|
+
constructor()
|
|
91
|
+
texture: string | false | null
|
|
92
|
+
|
|
93
|
+
getTexture(): Texture | null
|
|
94
|
+
/**
|
|
95
|
+
* Returns a 2D rectangle around the UV face
|
|
96
|
+
*/
|
|
97
|
+
getBoundingRect(): object
|
|
98
|
+
reset(): void
|
|
99
|
+
/**
|
|
100
|
+
* Returns a save copy of the face, ready for serialization. Set project to true to save for a bbmodel project file
|
|
101
|
+
*/
|
|
102
|
+
getSaveCopy(project?: boolean): object
|
|
103
|
+
/**
|
|
104
|
+
* Get a copy for undo tracking
|
|
105
|
+
*/
|
|
106
|
+
getUndoCopy(): Face
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type CubeFaceDirection = 'north' | 'south' | 'east' | 'west' | 'up' | 'down'
|
|
110
|
+
interface CubeFaceOptions extends FaceOptions {
|
|
111
|
+
uv?: [number, number, number, number]
|
|
112
|
+
rotation?: number
|
|
113
|
+
tint?: number
|
|
114
|
+
cullface?: CubeFaceDirection | ''
|
|
115
|
+
material_name?: string
|
|
116
|
+
enabled?: boolean
|
|
117
|
+
}
|
|
118
|
+
declare class CubeFace extends Face {
|
|
119
|
+
constructor(direction: CubeFaceDirection, data: CubeFaceOptions, cube: Cube)
|
|
120
|
+
cube: Cube
|
|
121
|
+
direction: CubeFaceDirection
|
|
122
|
+
uv: [number, number, number, number]
|
|
123
|
+
readonly uv_size: ArrayVector2
|
|
124
|
+
rotation: number
|
|
125
|
+
tint: number
|
|
126
|
+
cullface: CubeFaceDirection | ''
|
|
127
|
+
material_name: string
|
|
128
|
+
enabled: boolean
|
|
129
|
+
|
|
130
|
+
extend(data: CubeFaceOptions)
|
|
131
|
+
getVertexIndices(): [number, number, number, number]
|
|
132
|
+
}
|
package/types/dialog.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
interface DialogFormElement {
|
|
2
|
-
|
|
2
|
+
type: 'text' | 'number' | 'range' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info' | 'buttons'
|
|
3
|
+
label?: string
|
|
3
4
|
description?: string
|
|
4
|
-
type: 'text' | 'number' | 'range' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info'
|
|
5
5
|
nocolon?: boolean
|
|
6
6
|
full_width?: boolean
|
|
7
|
+
/** Set the input to read-only */
|
|
7
8
|
readonly?: boolean
|
|
9
|
+
/** Add buttons to allow copying and sharing the text or link */
|
|
10
|
+
share_text?: boolean
|
|
8
11
|
value?: any
|
|
9
12
|
placeholder?: string
|
|
10
13
|
text?: string
|
|
14
|
+
editable_range_label?: boolean
|
|
11
15
|
colorpicker?: any
|
|
12
16
|
min?: number
|
|
13
17
|
max?: number
|
|
14
18
|
step?: number
|
|
15
19
|
height?: number
|
|
16
20
|
options?: object
|
|
21
|
+
buttons?: string[]
|
|
22
|
+
click?: (button_index: number) => void
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
type FormResultValue = string|number|boolean|[]
|
|
@@ -23,7 +29,7 @@ interface ActionInterface {
|
|
|
23
29
|
description?: string
|
|
24
30
|
icon: string,
|
|
25
31
|
click: (event: Event) => void
|
|
26
|
-
condition:
|
|
32
|
+
condition: ConditionResolvable
|
|
27
33
|
}
|
|
28
34
|
interface DialogOptions {
|
|
29
35
|
title: string
|
|
@@ -43,7 +49,7 @@ interface DialogOptions {
|
|
|
43
49
|
/**
|
|
44
50
|
* Function to execute when the user cancels the dialog
|
|
45
51
|
*/
|
|
46
|
-
onCancel
|
|
52
|
+
onCancel?(): void
|
|
47
53
|
/**
|
|
48
54
|
* Triggered when the user presses a specific button
|
|
49
55
|
*/
|
|
@@ -93,50 +99,30 @@ interface DialogOptions {
|
|
|
93
99
|
cancel_on_click_outside?: boolean
|
|
94
100
|
}
|
|
95
101
|
|
|
96
|
-
interface DialogSidebarOptions {
|
|
97
|
-
pages?: {
|
|
98
|
-
[key: string]: string | {label: string, icon: IconString, color?: string}
|
|
99
|
-
}
|
|
100
|
-
page?: string
|
|
101
|
-
actions?: (Action|ActionInterface|string)[],
|
|
102
|
-
onPageSwitch?: (page: string) => void
|
|
103
|
-
}
|
|
104
|
-
declare class DialogSidebar {
|
|
105
|
-
constructor(options: DialogSidebarOptions)
|
|
106
|
-
|
|
107
|
-
pages: {
|
|
108
|
-
[key: string]: string
|
|
109
|
-
}
|
|
110
|
-
page: string
|
|
111
|
-
actions: (Action|string)[]
|
|
112
|
-
onPageSwitch(page: string): void
|
|
113
|
-
build(): void
|
|
114
|
-
toggle(state?: boolean): void
|
|
115
|
-
setPage(page: string): void
|
|
116
|
-
}
|
|
117
|
-
|
|
118
102
|
declare class Dialog {
|
|
119
|
-
constructor
|
|
103
|
+
constructor(id: string, options: DialogOptions)
|
|
104
|
+
constructor(options: DialogOptions)
|
|
120
105
|
|
|
121
106
|
id: string
|
|
122
107
|
component: Vue.Component
|
|
123
108
|
sidebar: DialogSidebar | null
|
|
109
|
+
content_vue: Vue | null
|
|
124
110
|
|
|
125
111
|
|
|
126
|
-
show
|
|
127
|
-
hide
|
|
112
|
+
show(): this
|
|
113
|
+
hide(): this
|
|
128
114
|
/**
|
|
129
115
|
* Triggers the confirm event of the dialog.
|
|
130
116
|
*/
|
|
131
|
-
confirm
|
|
117
|
+
confirm(event?: Event): void
|
|
132
118
|
/**
|
|
133
119
|
* Triggers the cancel event of the dialog.
|
|
134
120
|
*/
|
|
135
|
-
cancel
|
|
121
|
+
cancel(event?: Event): void
|
|
136
122
|
/**
|
|
137
123
|
* Closes the dialog using the index of the pressed button
|
|
138
124
|
*/
|
|
139
|
-
close
|
|
125
|
+
close(button: number, event?: Event): void
|
|
140
126
|
/**
|
|
141
127
|
* If the dialog contains a form, return the current values of the form
|
|
142
128
|
*/
|
|
@@ -156,4 +142,95 @@ declare class Dialog {
|
|
|
156
142
|
* Currently opened dialog
|
|
157
143
|
*/
|
|
158
144
|
static open: Dialog | null
|
|
145
|
+
static stack: Dialog[]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface ShapelessDialogOptions {
|
|
149
|
+
title: string
|
|
150
|
+
/**
|
|
151
|
+
* Default button to press to confirm the dialog. Defaults to the first button.
|
|
152
|
+
*/
|
|
153
|
+
confirmIndex?: number
|
|
154
|
+
/**
|
|
155
|
+
* Default button to press to cancel the dialog. Defaults to the last button.
|
|
156
|
+
*/
|
|
157
|
+
cancelIndex?: number
|
|
158
|
+
/**
|
|
159
|
+
* Function to execute when the user confirms the dialog
|
|
160
|
+
*/
|
|
161
|
+
onConfirm?: (formResult: object) => void
|
|
162
|
+
/**
|
|
163
|
+
* Function to execute when the user cancels the dialog
|
|
164
|
+
*/
|
|
165
|
+
onCancel?(): void
|
|
166
|
+
/**
|
|
167
|
+
* Triggered when the user presses a specific button
|
|
168
|
+
*/
|
|
169
|
+
onClose?: (button_index: number, event?: Event) => void
|
|
170
|
+
/**
|
|
171
|
+
* Vue component
|
|
172
|
+
*/
|
|
173
|
+
component?: Vue.Component
|
|
174
|
+
/**
|
|
175
|
+
* Unless set to false, clicking on the darkened area outside of the dialog will cancel the dialog.
|
|
176
|
+
*/
|
|
177
|
+
cancel_on_click_outside?: boolean
|
|
178
|
+
}
|
|
179
|
+
declare class ShapelessDialog extends Dialog {
|
|
180
|
+
constructor (id: string, options: ShapelessDialogOptions)
|
|
181
|
+
|
|
182
|
+
id: string
|
|
183
|
+
component: Vue.Component
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
show(): this
|
|
187
|
+
hide(): this
|
|
188
|
+
/**
|
|
189
|
+
* Triggers the confirm event of the dialog.
|
|
190
|
+
*/
|
|
191
|
+
confirm(event?: Event): void
|
|
192
|
+
/**
|
|
193
|
+
* Triggers the cancel event of the dialog.
|
|
194
|
+
*/
|
|
195
|
+
cancel(event?: Event): void
|
|
196
|
+
/**
|
|
197
|
+
* Closes the dialog using the index of the pressed button
|
|
198
|
+
*/
|
|
199
|
+
close(button: number, event?: Event): void
|
|
200
|
+
/**
|
|
201
|
+
* If the dialog contains a form, return the current values of the form
|
|
202
|
+
*/
|
|
203
|
+
getFormResult(): {
|
|
204
|
+
[key: string]: FormResultValue
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Set the values of the dialog form inputs
|
|
208
|
+
*/
|
|
209
|
+
setFormValues(values: {[key: string]: FormResultValue}): void
|
|
210
|
+
/**
|
|
211
|
+
* Delete the dialog object, causing it to be re-build from scratch on next open
|
|
212
|
+
*/
|
|
213
|
+
delete(): void
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface DialogSidebarOptions {
|
|
217
|
+
pages?: {
|
|
218
|
+
[key: string]: string | {label: string, icon: IconString, color?: string}
|
|
219
|
+
}
|
|
220
|
+
page?: string
|
|
221
|
+
actions?: (Action|ActionInterface|string)[],
|
|
222
|
+
onPageSwitch?: (page: string) => void
|
|
223
|
+
}
|
|
224
|
+
declare class DialogSidebar {
|
|
225
|
+
constructor(options: DialogSidebarOptions)
|
|
226
|
+
|
|
227
|
+
pages: {
|
|
228
|
+
[key: string]: string
|
|
229
|
+
}
|
|
230
|
+
page: string
|
|
231
|
+
actions: (Action|string)[]
|
|
232
|
+
onPageSwitch(page: string): void
|
|
233
|
+
build(): void
|
|
234
|
+
toggle(state?: boolean): void
|
|
235
|
+
setPage(page: string): void
|
|
159
236
|
}
|