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/menu.d.ts
CHANGED
|
@@ -1,136 +1,137 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
interface CustomMenuItem {
|
|
3
|
-
name: string
|
|
4
|
-
id?: string
|
|
5
|
-
icon: IconString | boolean | ((context: any) => (IconString|boolean))
|
|
6
|
-
color?: string
|
|
7
|
-
description?: string
|
|
8
|
-
condition?: ConditionResolvable
|
|
9
|
-
/**
|
|
10
|
-
* Keybind or string to display in the menu, won't work as an actual keybinding by default
|
|
11
|
-
*/
|
|
12
|
-
keybind?: Keybind | string
|
|
13
|
-
/**
|
|
14
|
-
* Adds a search bar to the menu or submenu
|
|
15
|
-
*/
|
|
16
|
-
searchable?: boolean
|
|
17
|
-
children?: MenuItem[] | ((context: any) => MenuItem[])
|
|
18
|
-
click?(context?: any, event?: Event): void
|
|
19
|
-
}
|
|
20
|
-
type MenuItem = CustomMenuItem | Action | BarSelect<string> | MenuSeparator | string
|
|
21
|
-
interface MenuOptions {
|
|
22
|
-
onOpen?(position: MouseEvent | HTMLElement, context?: any): void
|
|
23
|
-
onClose?(): void
|
|
24
|
-
keep_open?: boolean
|
|
25
|
-
searchable?: boolean
|
|
26
|
-
class?: string
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
30
|
-
*/
|
|
31
|
-
declare class Menu extends Deletable {
|
|
32
|
-
/**
|
|
33
|
-
* Creates a new context menu
|
|
34
|
-
*/
|
|
35
|
-
constructor(
|
|
36
|
-
id: string,
|
|
37
|
-
template: MenuItem[] | ((context?: any) => MenuItem[]),
|
|
38
|
-
options?: MenuOptions
|
|
39
|
-
)
|
|
40
|
-
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Opens the menu somewhere
|
|
44
|
-
* @param position Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.
|
|
45
|
-
* @param context Context for the click events inside the menu
|
|
46
|
-
*/
|
|
47
|
-
open(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
48
|
-
/**
|
|
49
|
-
* Alias for .open()
|
|
50
|
-
*/
|
|
51
|
-
show(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
52
|
-
/**
|
|
53
|
-
* Closes the menu if it's open
|
|
54
|
-
*/
|
|
55
|
-
hide(): this
|
|
56
|
-
/**
|
|
57
|
-
* Adds an action to the menu structure
|
|
58
|
-
* @param action Action to add
|
|
59
|
-
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, separated by a point. For example, `export.0` places the action at the top position of the Export submenu.
|
|
60
|
-
*/
|
|
61
|
-
addAction(action: Action | CustomMenuItem, path?: string | number): void
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
65
|
-
*/
|
|
66
|
-
removeAction(path: string | Action): void
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated
|
|
69
|
-
*/
|
|
70
|
-
deleteItem(rm_item: Action): void
|
|
71
|
-
hover(node: HTMLElement, event: Event, expand?: boolean): void
|
|
72
|
-
structure: MenuItem[]
|
|
73
|
-
node: HTMLUListElement
|
|
74
|
-
static open: Menu | null
|
|
75
|
-
static closed_in_this_click?: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
declare interface BarMenuOptions {
|
|
79
|
-
name?: string
|
|
80
|
-
icon?: IconString
|
|
81
|
-
condition?: ConditionResolvable
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Creates a new menu in the menu bar
|
|
86
|
-
*/
|
|
87
|
-
declare class BarMenu extends Menu {
|
|
88
|
-
constructor(id: string, structure: MenuItem[], options?: BarMenuOptions)
|
|
89
|
-
type: 'bar_menu'
|
|
90
|
-
id: string
|
|
91
|
-
condition?: ConditionResolvable
|
|
92
|
-
name: string
|
|
93
|
-
structure: MenuItem[]
|
|
94
|
-
/**
|
|
95
|
-
* Visually highlights an action within the menu, until the user opens the menu
|
|
96
|
-
*/
|
|
97
|
-
highlight(action: Action): void
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
declare namespace MenuBar {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*
|
|
118
|
-
* @param
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
*
|
|
124
|
-
* @param
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
interface CustomMenuItem {
|
|
3
|
+
name: string
|
|
4
|
+
id?: string
|
|
5
|
+
icon: IconString | boolean | ((context: any) => (IconString|boolean))
|
|
6
|
+
color?: string
|
|
7
|
+
description?: string
|
|
8
|
+
condition?: ConditionResolvable
|
|
9
|
+
/**
|
|
10
|
+
* Keybind or string to display in the menu, won't work as an actual keybinding by default
|
|
11
|
+
*/
|
|
12
|
+
keybind?: Keybind | string
|
|
13
|
+
/**
|
|
14
|
+
* Adds a search bar to the menu or submenu
|
|
15
|
+
*/
|
|
16
|
+
searchable?: boolean
|
|
17
|
+
children?: MenuItem[] | ((context: any) => MenuItem[])
|
|
18
|
+
click?(context?: any, event?: Event): void
|
|
19
|
+
}
|
|
20
|
+
type MenuItem = CustomMenuItem | Action | BarSelect<string> | MenuSeparator | string
|
|
21
|
+
interface MenuOptions {
|
|
22
|
+
onOpen?(position: MouseEvent | HTMLElement, context?: any): void
|
|
23
|
+
onClose?(): void
|
|
24
|
+
keep_open?: boolean
|
|
25
|
+
searchable?: boolean
|
|
26
|
+
class?: string
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Use the Menu class to create a context menu. Menus can contain custom entries and hierarchy, or existing actions and tools.
|
|
30
|
+
*/
|
|
31
|
+
declare class Menu extends Deletable {
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new context menu
|
|
34
|
+
*/
|
|
35
|
+
constructor(
|
|
36
|
+
id: string,
|
|
37
|
+
template: MenuItem[] | ((context?: any) => MenuItem[]),
|
|
38
|
+
options?: MenuOptions
|
|
39
|
+
)
|
|
40
|
+
constructor(template: MenuItem[] | ((context?: any) => MenuItem[]), options?: MenuOptions)
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Opens the menu somewhere
|
|
44
|
+
* @param position Position where to open the menu. Can be a mouse event, or a node that the menu is spawned below.
|
|
45
|
+
* @param context Context for the click events inside the menu
|
|
46
|
+
*/
|
|
47
|
+
open(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
48
|
+
/**
|
|
49
|
+
* Alias for .open()
|
|
50
|
+
*/
|
|
51
|
+
show(position: MouseEvent | HTMLElement | 'mouse', context?: any): this
|
|
52
|
+
/**
|
|
53
|
+
* Closes the menu if it's open
|
|
54
|
+
*/
|
|
55
|
+
hide(): this
|
|
56
|
+
/**
|
|
57
|
+
* Adds an action to the menu structure
|
|
58
|
+
* @param action Action to add
|
|
59
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, separated by a point. For example, `export.0` places the action at the top position of the Export submenu.
|
|
60
|
+
*/
|
|
61
|
+
addAction(action: Action | CustomMenuItem | '_', path?: string | number): void
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
65
|
+
*/
|
|
66
|
+
removeAction(path: string | Action): void
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated
|
|
69
|
+
*/
|
|
70
|
+
deleteItem(rm_item: Action): void
|
|
71
|
+
hover(node: HTMLElement, event: Event, expand?: boolean): void
|
|
72
|
+
structure: MenuItem[]
|
|
73
|
+
node: HTMLUListElement
|
|
74
|
+
static open: Menu | null
|
|
75
|
+
static closed_in_this_click?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare interface BarMenuOptions {
|
|
79
|
+
name?: string
|
|
80
|
+
icon?: IconString
|
|
81
|
+
condition?: ConditionResolvable
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new menu in the menu bar
|
|
86
|
+
*/
|
|
87
|
+
declare class BarMenu extends Menu {
|
|
88
|
+
constructor(id: string, structure: MenuItem[], options?: BarMenuOptions)
|
|
89
|
+
type: 'bar_menu'
|
|
90
|
+
id: string
|
|
91
|
+
condition?: ConditionResolvable
|
|
92
|
+
name: string
|
|
93
|
+
structure: MenuItem[]
|
|
94
|
+
/**
|
|
95
|
+
* Visually highlights an action within the menu, until the user opens the menu
|
|
96
|
+
*/
|
|
97
|
+
highlight(action: Action): void
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare namespace MenuBar {
|
|
101
|
+
const mode_switcher_button: null | HTMLDivElement
|
|
102
|
+
const menus: {
|
|
103
|
+
file: Menu
|
|
104
|
+
edit: Menu
|
|
105
|
+
transform: Menu
|
|
106
|
+
uv: Menu
|
|
107
|
+
texture: Menu
|
|
108
|
+
animation: Menu
|
|
109
|
+
keyframe: Menu
|
|
110
|
+
display: Menu
|
|
111
|
+
tools: Menu
|
|
112
|
+
view: Menu
|
|
113
|
+
help: Menu
|
|
114
|
+
[id: string]: Menu
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Add a new menu to the menu bar
|
|
118
|
+
* @param menu The BarMenu to add
|
|
119
|
+
* @param position Specify the position in the menu list where to add insert the menu. Can either be an index in the list of all menus, or the ID of the menu to insert right from.
|
|
120
|
+
*/
|
|
121
|
+
function addMenu(menu: BarMenu, position?: number | string): void
|
|
122
|
+
/**
|
|
123
|
+
* Adds an action to the menu structure
|
|
124
|
+
* @param action Action to add
|
|
125
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index or group within a level, separated by a point. For example, `file.export.0` places the action at the top position of the Export submenu in the File menu.
|
|
126
|
+
*/
|
|
127
|
+
function addAction(action: Action, path?: string): void
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
* @param path Path pointing to the location. Use the ID of each level of the menu, or index or group within a level, or item ID, separated by a point. For example, `export.export_special_format` removes the action "Export Special Format" from the Export submenu.
|
|
131
|
+
*/
|
|
132
|
+
function removeAction(path: string): void
|
|
133
|
+
/**
|
|
134
|
+
* Update the menu bar
|
|
135
|
+
*/
|
|
136
|
+
function update(): void
|
|
137
|
+
}
|
package/custom/mesh.d.ts
CHANGED
|
@@ -1,196 +1,196 @@
|
|
|
1
|
-
/// <reference types="./blockbench"/>
|
|
2
|
-
|
|
3
|
-
type OccupationMatrix = {
|
|
4
|
-
[x: number]: {
|
|
5
|
-
[y: number]: boolean
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
type MeshEdge = [string, string]
|
|
9
|
-
|
|
10
|
-
type MeshSeamValue = 'auto' | 'divide' | 'join'
|
|
11
|
-
interface MeshOptions {
|
|
12
|
-
name?: string
|
|
13
|
-
color?: number
|
|
14
|
-
visibility?: boolean
|
|
15
|
-
rotation?: ArrayVector3
|
|
16
|
-
origin?: ArrayVector3
|
|
17
|
-
vertices?: {
|
|
18
|
-
[vkey: string]: ArrayVector3
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface MeshFaceOptions extends FaceOptions {
|
|
23
|
-
vertices?: string[]
|
|
24
|
-
uv?: { [vkey: string]: ArrayVector2 }
|
|
25
|
-
}
|
|
26
|
-
declare class MeshFace extends Face {
|
|
27
|
-
constructor(mesh: Mesh, data: MeshFaceOptions)
|
|
28
|
-
/**
|
|
29
|
-
* The vertices that make up the face, as vertex keys. The vertices go around the face counter-clockwise when looking at the front side of the face. That also means that reversing the vertex order reverses the face direction.
|
|
30
|
-
*/
|
|
31
|
-
vertices: string[]
|
|
32
|
-
mesh: Mesh
|
|
33
|
-
uv: {
|
|
34
|
-
[vertex: string]: ArrayVector2
|
|
35
|
-
}
|
|
36
|
-
extend(data: MeshFaceOptions): this
|
|
37
|
-
/**
|
|
38
|
-
* Returns the face normal in mesh space as calculated from the vertex positions
|
|
39
|
-
* @param normalize If true, the values will be normalized.
|
|
40
|
-
* @param alt_tri On quads, if true, this will return the normal of the second tri instead of the first
|
|
41
|
-
*/
|
|
42
|
-
getNormal(normalize: boolean = false, alt_tri?: boolean): ArrayVector3
|
|
43
|
-
/**
|
|
44
|
-
* Calculates which pixels the UV face occupies, and returns them as a map
|
|
45
|
-
*/
|
|
46
|
-
getOccupationMatrix(
|
|
47
|
-
texture_space?: boolean,
|
|
48
|
-
start_offset?: ArrayVector2,
|
|
49
|
-
matrix?: OccupationMatrix
|
|
50
|
-
): OccupationMatrix
|
|
51
|
-
/**
|
|
52
|
-
* Get the keys of this face and all faces that are connected with it on the UV map
|
|
53
|
-
*/
|
|
54
|
-
getUVIsland(): string[]
|
|
55
|
-
/**
|
|
56
|
-
* Returns the angle between two faces in degrees
|
|
57
|
-
*/
|
|
58
|
-
getAngleTo(other_face: MeshFace): number
|
|
59
|
-
/**
|
|
60
|
-
* Inverts the direction of the face
|
|
61
|
-
*/
|
|
62
|
-
invert(): void
|
|
63
|
-
/**
|
|
64
|
-
* Returns whether the face is selected
|
|
65
|
-
* @param face_key Optional face key of the face, the method runs faster if this is provided
|
|
66
|
-
*/
|
|
67
|
-
isSelected(face_key?: string): boolean
|
|
68
|
-
/**
|
|
69
|
-
* Returns true if the face is concave
|
|
70
|
-
*/
|
|
71
|
-
isConcave(): boolean
|
|
72
|
-
/**
|
|
73
|
-
* Returns the vertices of a quad in an order that creates a convex quad shape if possible. If the face has less than 4 vertices, it just returns the vertices in original order.
|
|
74
|
-
*/
|
|
75
|
-
getSortedVertices(): string[]
|
|
76
|
-
/**
|
|
77
|
-
* Get the adjacent face in the specified side
|
|
78
|
-
*/
|
|
79
|
-
getAdjacentFace(
|
|
80
|
-
side_index: number
|
|
81
|
-
): { face: MeshFace; key: string; edge: MeshEdge; index: number } | null
|
|
82
|
-
/**
|
|
83
|
-
* Return all edges of the face
|
|
84
|
-
*/
|
|
85
|
-
getEdges(): [string, string][]
|
|
86
|
-
/**
|
|
87
|
-
* Returns the face key
|
|
88
|
-
*/
|
|
89
|
-
getFaceKey(): string
|
|
90
|
-
/**
|
|
91
|
-
* Takes a UV coordinate and turns it into a 3D space coordinate in local space of the mesh. On quads, the first triangle is used for calculation, so the coordinates on warped quads may be inaccurate.
|
|
92
|
-
*/
|
|
93
|
-
UVToLocal(uv: ArrayVector2): THREE.Vector3
|
|
94
|
-
/**
|
|
95
|
-
* Takes a 3D coordinate in local space of the mesh, and turns it into a coordinate on the UV map using barycentric coordinates. On quads, the first triangle is used for calculation, so the coordinates on warped quads may be inaccurate.
|
|
96
|
-
*/
|
|
97
|
-
localToUV(vector: THREE.Vector3): ArrayVector2
|
|
98
|
-
/**
|
|
99
|
-
* Get the face center by weight in local space
|
|
100
|
-
*/
|
|
101
|
-
getCenter(): ArrayVector3
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
interface MeshOptions {
|
|
105
|
-
name?: string
|
|
106
|
-
color?: number
|
|
107
|
-
visibility?: boolean
|
|
108
|
-
shading?: 'flat' | 'smooth'
|
|
109
|
-
rotation?: ArrayVector3
|
|
110
|
-
origin?: ArrayVector3
|
|
111
|
-
vertices?: {
|
|
112
|
-
[vkey: string]: ArrayVector3
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
declare class Mesh extends OutlinerElement {
|
|
116
|
-
constructor(options: Partial<MeshOptions>, uuid?: string)
|
|
117
|
-
|
|
118
|
-
shading: 'flat' | 'smooth'
|
|
119
|
-
visibility: boolean
|
|
120
|
-
color: number
|
|
121
|
-
origin: ArrayVector3
|
|
122
|
-
rotation: ArrayVector3
|
|
123
|
-
|
|
124
|
-
vertices: {
|
|
125
|
-
[vkey: string]: ArrayVector3
|
|
126
|
-
}
|
|
127
|
-
faces: {
|
|
128
|
-
[fkey: string]: MeshFace
|
|
129
|
-
}
|
|
130
|
-
seams: {
|
|
131
|
-
[vkey: string]: MeshSeamValue
|
|
132
|
-
}
|
|
133
|
-
vertice_list: ArrayVector3[]
|
|
134
|
-
armature: string
|
|
135
|
-
|
|
136
|
-
extend(options: Partial<MeshOptions>): this
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Get selected vertices as vertex keys
|
|
140
|
-
* @param can_write If true, the array can safely be modified to update the selection
|
|
141
|
-
*/
|
|
142
|
-
getSelectedVertices(can_write?: boolean): string[]
|
|
143
|
-
/**
|
|
144
|
-
* Get selected edges as vertex key pairs
|
|
145
|
-
* @param can_write If true, the array can safely be modified to update the selection
|
|
146
|
-
*/
|
|
147
|
-
getSelectedEdges(can_write?: boolean): [string, string][]
|
|
148
|
-
/**
|
|
149
|
-
* Get selected faces as face keys
|
|
150
|
-
* @param can_write If true, the array can safely be modified to update the selection
|
|
151
|
-
*/
|
|
152
|
-
getSelectedFaces(can_write?: boolean): string[]
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Get the armature if one is attached to the mesh
|
|
156
|
-
*/
|
|
157
|
-
getArmature() : Armature | undefined
|
|
158
|
-
/**
|
|
159
|
-
* Vertex lists of quads are generally in arbitrary order, the order is calculated when calling getSortedVertices() to account for dfiferent face geometries. Calling this method pre-sorts all faces to allow optimizing subsequent processing
|
|
160
|
-
*/
|
|
161
|
-
sortAllFaceVertices(): void
|
|
162
|
-
calculateNormals(): Record<string, ArrayVector3>
|
|
163
|
-
|
|
164
|
-
setSeam(edge: MeshEdge, value: any): void
|
|
165
|
-
getSeam(edge: MeshEdge): MeshSeamValue
|
|
166
|
-
getWorldCenter(ignore_mesh_selection?: boolean): THREE.Vector3
|
|
167
|
-
addVertices(...ArrayVector3: ArrayVector3[]): string[]
|
|
168
|
-
addFaces(...MeshFace: MeshFace[]): string[]
|
|
169
|
-
extend(data: MeshOptions): void
|
|
170
|
-
getUndoCopy(aspects?: any): any
|
|
171
|
-
getSelectionRotation(): THREE.Euler
|
|
172
|
-
getCenter(global: boolean): THREE.Vector3
|
|
173
|
-
forAllFaces(callback: (face: MeshFace, key: string) => void): void
|
|
174
|
-
transferOrigin(origin: ArrayVector3, update?: boolean): void
|
|
175
|
-
setColor(color: number): void
|
|
176
|
-
roll(axis: number, steps: number, origin?: ArrayVector3): void
|
|
177
|
-
flip(axis: number): void
|
|
178
|
-
moveVector(offset: ArrayVector3, axis: number, update?: boolean): void
|
|
179
|
-
resize(
|
|
180
|
-
val: number,
|
|
181
|
-
axis: number,
|
|
182
|
-
negative: boolean,
|
|
183
|
-
allow_negative: boolean,
|
|
184
|
-
bidirectional?: boolean
|
|
185
|
-
): void
|
|
186
|
-
applyTexture(texture: Texture, faces?: true | undefined | string[]): void
|
|
187
|
-
|
|
188
|
-
static all: Mesh[]
|
|
189
|
-
static selected: Mesh[]
|
|
190
|
-
/**Check if any elements of the type are in the project */
|
|
191
|
-
static hasAny: () => boolean
|
|
192
|
-
/**Check if any elements of the type are currently selected */
|
|
193
|
-
static hasSelected: () => boolean
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
interface MeshFaceOptions extends FaceOptions {}
|
|
1
|
+
/// <reference types="./blockbench"/>
|
|
2
|
+
|
|
3
|
+
type OccupationMatrix = {
|
|
4
|
+
[x: number]: {
|
|
5
|
+
[y: number]: boolean
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
type MeshEdge = [string, string]
|
|
9
|
+
|
|
10
|
+
type MeshSeamValue = 'auto' | 'divide' | 'join'
|
|
11
|
+
interface MeshOptions {
|
|
12
|
+
name?: string
|
|
13
|
+
color?: number
|
|
14
|
+
visibility?: boolean
|
|
15
|
+
rotation?: ArrayVector3
|
|
16
|
+
origin?: ArrayVector3
|
|
17
|
+
vertices?: {
|
|
18
|
+
[vkey: string]: ArrayVector3
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface MeshFaceOptions extends FaceOptions {
|
|
23
|
+
vertices?: string[]
|
|
24
|
+
uv?: { [vkey: string]: ArrayVector2 }
|
|
25
|
+
}
|
|
26
|
+
declare class MeshFace extends Face {
|
|
27
|
+
constructor(mesh: Mesh, data: MeshFaceOptions)
|
|
28
|
+
/**
|
|
29
|
+
* The vertices that make up the face, as vertex keys. The vertices go around the face counter-clockwise when looking at the front side of the face. That also means that reversing the vertex order reverses the face direction.
|
|
30
|
+
*/
|
|
31
|
+
vertices: string[]
|
|
32
|
+
mesh: Mesh
|
|
33
|
+
uv: {
|
|
34
|
+
[vertex: string]: ArrayVector2
|
|
35
|
+
}
|
|
36
|
+
extend(data: MeshFaceOptions): this
|
|
37
|
+
/**
|
|
38
|
+
* Returns the face normal in mesh space as calculated from the vertex positions
|
|
39
|
+
* @param normalize If true, the values will be normalized.
|
|
40
|
+
* @param alt_tri On quads, if true, this will return the normal of the second tri instead of the first
|
|
41
|
+
*/
|
|
42
|
+
getNormal(normalize: boolean = false, alt_tri?: boolean): ArrayVector3
|
|
43
|
+
/**
|
|
44
|
+
* Calculates which pixels the UV face occupies, and returns them as a map
|
|
45
|
+
*/
|
|
46
|
+
getOccupationMatrix(
|
|
47
|
+
texture_space?: boolean,
|
|
48
|
+
start_offset?: ArrayVector2,
|
|
49
|
+
matrix?: OccupationMatrix
|
|
50
|
+
): OccupationMatrix
|
|
51
|
+
/**
|
|
52
|
+
* Get the keys of this face and all faces that are connected with it on the UV map
|
|
53
|
+
*/
|
|
54
|
+
getUVIsland(): string[]
|
|
55
|
+
/**
|
|
56
|
+
* Returns the angle between two faces in degrees
|
|
57
|
+
*/
|
|
58
|
+
getAngleTo(other_face: MeshFace): number
|
|
59
|
+
/**
|
|
60
|
+
* Inverts the direction of the face
|
|
61
|
+
*/
|
|
62
|
+
invert(): void
|
|
63
|
+
/**
|
|
64
|
+
* Returns whether the face is selected
|
|
65
|
+
* @param face_key Optional face key of the face, the method runs faster if this is provided
|
|
66
|
+
*/
|
|
67
|
+
isSelected(face_key?: string): boolean
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if the face is concave
|
|
70
|
+
*/
|
|
71
|
+
isConcave(): boolean
|
|
72
|
+
/**
|
|
73
|
+
* Returns the vertices of a quad in an order that creates a convex quad shape if possible. If the face has less than 4 vertices, it just returns the vertices in original order.
|
|
74
|
+
*/
|
|
75
|
+
getSortedVertices(): string[]
|
|
76
|
+
/**
|
|
77
|
+
* Get the adjacent face in the specified side
|
|
78
|
+
*/
|
|
79
|
+
getAdjacentFace(
|
|
80
|
+
side_index: number
|
|
81
|
+
): { face: MeshFace; key: string; edge: MeshEdge; index: number } | null
|
|
82
|
+
/**
|
|
83
|
+
* Return all edges of the face
|
|
84
|
+
*/
|
|
85
|
+
getEdges(): [string, string][]
|
|
86
|
+
/**
|
|
87
|
+
* Returns the face key
|
|
88
|
+
*/
|
|
89
|
+
getFaceKey(): string
|
|
90
|
+
/**
|
|
91
|
+
* Takes a UV coordinate and turns it into a 3D space coordinate in local space of the mesh. On quads, the first triangle is used for calculation, so the coordinates on warped quads may be inaccurate.
|
|
92
|
+
*/
|
|
93
|
+
UVToLocal(uv: ArrayVector2): THREE.Vector3
|
|
94
|
+
/**
|
|
95
|
+
* Takes a 3D coordinate in local space of the mesh, and turns it into a coordinate on the UV map using barycentric coordinates. On quads, the first triangle is used for calculation, so the coordinates on warped quads may be inaccurate.
|
|
96
|
+
*/
|
|
97
|
+
localToUV(vector: THREE.Vector3): ArrayVector2
|
|
98
|
+
/**
|
|
99
|
+
* Get the face center by weight in local space
|
|
100
|
+
*/
|
|
101
|
+
getCenter(): ArrayVector3
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface MeshOptions {
|
|
105
|
+
name?: string
|
|
106
|
+
color?: number
|
|
107
|
+
visibility?: boolean
|
|
108
|
+
shading?: 'flat' | 'smooth'
|
|
109
|
+
rotation?: ArrayVector3
|
|
110
|
+
origin?: ArrayVector3
|
|
111
|
+
vertices?: {
|
|
112
|
+
[vkey: string]: ArrayVector3
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
declare class Mesh extends OutlinerElement {
|
|
116
|
+
constructor(options: Partial<MeshOptions>, uuid?: string)
|
|
117
|
+
|
|
118
|
+
shading: 'flat' | 'smooth'
|
|
119
|
+
visibility: boolean
|
|
120
|
+
color: number
|
|
121
|
+
origin: ArrayVector3
|
|
122
|
+
rotation: ArrayVector3
|
|
123
|
+
|
|
124
|
+
vertices: {
|
|
125
|
+
[vkey: string]: ArrayVector3
|
|
126
|
+
}
|
|
127
|
+
faces: {
|
|
128
|
+
[fkey: string]: MeshFace
|
|
129
|
+
}
|
|
130
|
+
seams: {
|
|
131
|
+
[vkey: string]: MeshSeamValue
|
|
132
|
+
}
|
|
133
|
+
vertice_list: ArrayVector3[]
|
|
134
|
+
armature: string
|
|
135
|
+
|
|
136
|
+
extend(options: Partial<MeshOptions>): this
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Get selected vertices as vertex keys
|
|
140
|
+
* @param can_write If true, the array can safely be modified to update the selection
|
|
141
|
+
*/
|
|
142
|
+
getSelectedVertices(can_write?: boolean): string[]
|
|
143
|
+
/**
|
|
144
|
+
* Get selected edges as vertex key pairs
|
|
145
|
+
* @param can_write If true, the array can safely be modified to update the selection
|
|
146
|
+
*/
|
|
147
|
+
getSelectedEdges(can_write?: boolean): [string, string][]
|
|
148
|
+
/**
|
|
149
|
+
* Get selected faces as face keys
|
|
150
|
+
* @param can_write If true, the array can safely be modified to update the selection
|
|
151
|
+
*/
|
|
152
|
+
getSelectedFaces(can_write?: boolean): string[]
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Get the armature if one is attached to the mesh
|
|
156
|
+
*/
|
|
157
|
+
getArmature() : Armature | undefined
|
|
158
|
+
/**
|
|
159
|
+
* Vertex lists of quads are generally in arbitrary order, the order is calculated when calling getSortedVertices() to account for dfiferent face geometries. Calling this method pre-sorts all faces to allow optimizing subsequent processing
|
|
160
|
+
*/
|
|
161
|
+
sortAllFaceVertices(): void
|
|
162
|
+
calculateNormals(): Record<string, ArrayVector3>
|
|
163
|
+
|
|
164
|
+
setSeam(edge: MeshEdge, value: any): void
|
|
165
|
+
getSeam(edge: MeshEdge): MeshSeamValue
|
|
166
|
+
getWorldCenter(ignore_mesh_selection?: boolean): THREE.Vector3
|
|
167
|
+
addVertices(...ArrayVector3: ArrayVector3[]): string[]
|
|
168
|
+
addFaces(...MeshFace: MeshFace[]): string[]
|
|
169
|
+
extend(data: MeshOptions): void
|
|
170
|
+
getUndoCopy(aspects?: any): any
|
|
171
|
+
getSelectionRotation(): THREE.Euler
|
|
172
|
+
getCenter(global: boolean): THREE.Vector3
|
|
173
|
+
forAllFaces(callback: (face: MeshFace, key: string) => void): void
|
|
174
|
+
transferOrigin(origin: ArrayVector3, update?: boolean): void
|
|
175
|
+
setColor(color: number): void
|
|
176
|
+
roll(axis: number, steps: number, origin?: ArrayVector3): void
|
|
177
|
+
flip(axis: number): void
|
|
178
|
+
moveVector(offset: ArrayVector3, axis: number, update?: boolean): void
|
|
179
|
+
resize(
|
|
180
|
+
val: number,
|
|
181
|
+
axis: number,
|
|
182
|
+
negative: boolean,
|
|
183
|
+
allow_negative: boolean,
|
|
184
|
+
bidirectional?: boolean
|
|
185
|
+
): void
|
|
186
|
+
applyTexture(texture: Texture, faces?: true | undefined | string[]): void
|
|
187
|
+
|
|
188
|
+
static all: Mesh[]
|
|
189
|
+
static selected: Mesh[]
|
|
190
|
+
/**Check if any elements of the type are in the project */
|
|
191
|
+
static hasAny: () => boolean
|
|
192
|
+
/**Check if any elements of the type are currently selected */
|
|
193
|
+
static hasSelected: () => boolean
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface MeshFaceOptions extends FaceOptions {}
|