blockbench-types 5.1.0 → 5.2.0-beta.0-next.2

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.
Files changed (102) hide show
  1. package/README.md +30 -30
  2. package/custom/animation.d.ts +257 -256
  3. package/custom/animation_controller.d.ts +124 -124
  4. package/custom/blockbench.d.ts +73 -73
  5. package/custom/canvas.d.ts +324 -307
  6. package/custom/codec.d.ts +182 -182
  7. package/custom/copy_paste.d.ts +43 -42
  8. package/custom/cube.d.ts +151 -151
  9. package/custom/desktop.d.ts +61 -73
  10. package/custom/display_mode.d.ts +141 -137
  11. package/custom/edit_session.d.ts +38 -37
  12. package/custom/global.d.ts +181 -168
  13. package/custom/group.d.ts +113 -113
  14. package/custom/interface.d.ts +88 -78
  15. package/custom/io.d.ts +12 -12
  16. package/custom/{toolbars.d.ts → keybind.d.ts} +150 -221
  17. package/custom/keyframe.d.ts +94 -94
  18. package/custom/libs.d.ts +13 -13
  19. package/custom/menu_bar.d.ts +66 -0
  20. package/custom/mesh.d.ts +196 -196
  21. package/custom/misc.d.ts +196 -199
  22. package/custom/molang.d.ts +159 -159
  23. package/custom/outliner.d.ts +158 -158
  24. package/custom/painter.d.ts +102 -69
  25. package/custom/preview_scene.d.ts +120 -120
  26. package/custom/screencam.d.ts +71 -71
  27. package/custom/spline_mesh.d.ts +190 -189
  28. package/custom/texture_group.d.ts +68 -68
  29. package/custom/textures.d.ts +526 -515
  30. package/custom/timeline.d.ts +66 -66
  31. package/custom/undo.d.ts +209 -208
  32. package/custom/util/version_util.d.ts +32 -32
  33. package/custom/util.d.ts +235 -235
  34. package/custom/uveditor.d.ts +3 -3
  35. package/custom/validator.d.ts +99 -99
  36. package/documentation.md +12 -12
  37. package/generated/animations/mirror_animating.d.ts +7 -0
  38. package/generated/animations/timeline_animators.d.ts +1 -1
  39. package/generated/api.d.ts +8 -1
  40. package/generated/file_system.d.ts +2 -1
  41. package/generated/find_replace.d.ts +6 -0
  42. package/generated/formats/standards/obj.d.ts +9 -11
  43. package/generated/interface/actions.d.ts +16 -12
  44. package/generated/interface/form.d.ts +2 -1
  45. package/generated/interface/main_tools.d.ts +23 -0
  46. package/generated/interface/menu.d.ts +141 -0
  47. package/generated/interface/menu_bar.d.ts +2 -3
  48. package/generated/interface/resize_lines.d.ts +2 -0
  49. package/generated/interface/settings.d.ts +6 -2
  50. package/generated/interface/shared_actions.d.ts +5 -0
  51. package/generated/interface/start_screen.d.ts +62 -42
  52. package/generated/interface/toolbars.d.ts +146 -46
  53. package/generated/io/format.d.ts +1 -0
  54. package/generated/io/project.d.ts +10 -2
  55. package/generated/lib/CanvasFrame.d.ts +1 -0
  56. package/generated/main.d.ts +4 -1
  57. package/generated/modeling/mesh/add_mesh.d.ts +6 -0
  58. package/generated/modeling/mesh/proportional_edit.d.ts +15 -13
  59. package/generated/modeling/mesh/util.d.ts +8 -2
  60. package/generated/modeling/mirror_modeling.d.ts +4 -0
  61. package/generated/modeling/weight_paint.d.ts +11 -0
  62. package/generated/modes.d.ts +2 -2
  63. package/generated/native_apis.d.ts +3 -0
  64. package/generated/outliner/abstract/outliner_element.d.ts +1 -0
  65. package/generated/outliner/abstract/outliner_node.d.ts +1 -0
  66. package/generated/outliner/types/armature.d.ts +1 -1
  67. package/generated/outliner/types/armature_bone.d.ts +1 -1
  68. package/generated/outliner/types/billboard.d.ts +1 -1
  69. package/generated/outliner/types/bounding_box.d.ts +1 -1
  70. package/generated/outliner/types/cube.d.ts +1 -1
  71. package/generated/outliner/types/group.d.ts +1 -1
  72. package/generated/outliner/types/locator.d.ts +1 -1
  73. package/generated/outliner/types/mesh.d.ts +1 -1
  74. package/generated/outliner/types/null_object.d.ts +1 -1
  75. package/generated/outliner/types/spline_mesh.d.ts +1 -2
  76. package/generated/outliner/types/texture_mesh.d.ts +1 -1
  77. package/generated/plugin_loader.d.ts +1 -1
  78. package/generated/preview/preview.d.ts +280 -0
  79. package/generated/preview/reference_images.d.ts +1 -1
  80. package/generated/texturing/layers.d.ts +140 -0
  81. package/generated/util/gif.d.ts +12 -3
  82. package/generated/util/state_memory.d.ts +3 -11
  83. package/index.d.ts +2 -2
  84. package/package.json +39 -39
  85. package/tsconfig.json +19 -19
  86. package/type_config.json +43 -46
  87. package/custom/menu.d.ts +0 -136
  88. package/custom/preview.d.ts +0 -137
  89. package/custom/start_screen.d.ts +0 -15
  90. package/custom/texture_layers.d.ts +0 -117
  91. package/generated/global_types.d.ts +0 -47
  92. package/generated/io/formats/bedrock.d.ts +0 -4
  93. package/generated/io/formats/bedrock_old.d.ts +0 -4
  94. package/generated/io/formats/collada.d.ts +0 -4
  95. package/generated/io/formats/fbx.d.ts +0 -17
  96. package/generated/io/formats/gltf.d.ts +0 -6
  97. package/generated/io/formats/java_block.d.ts +0 -4
  98. package/generated/io/formats/modded_entity.d.ts +0 -139
  99. package/generated/io/formats/obj.d.ts +0 -12
  100. package/generated/io/formats/optifine_jem.d.ts +0 -3
  101. package/generated/io/formats/optifine_jpm.d.ts +0 -3
  102. package/generated/io/formats/skin.d.ts +0 -22
@@ -1,94 +1,94 @@
1
- /// <reference types="./blockbench"/>
2
-
3
- /**
4
- * Keyframes are used in animations to specify transformation or other data at specific points in the timeline
5
- * @module
6
- */
7
-
8
- interface KeyframeDataPointData {
9
- [key: string]: any
10
- }
11
- declare class KeyframeDataPoint extends Object {
12
- static properties: Record<string, Property<any>>
13
- constructor(keyframe: _Keyframe)
14
- readonly keyframe: Keyframe
15
- extend(data: KeyframeDataPointData): void
16
- getUndoCopy(): {
17
- [key: string]: any
18
- }
19
- [key: string]: any
20
- }
21
-
22
- interface KeyframeOptions {
23
- channel?: string
24
- data_points: {}[]
25
- time: number
26
- color?: number
27
- uniform?: boolean
28
- interpolation?: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
29
- bezier_linked?: boolean
30
- bezier_left_time?: ArrayVector3
31
- bezier_left_value?: ArrayVector3
32
- bezier_right_time?: ArrayVector3
33
- bezier_right_value?: ArrayVector3
34
- }
35
- type axisLetter = 'x' | 'y' | 'z'
36
- type axisNumber = 0 | 1 | 2
37
-
38
- declare class _Keyframe {
39
- constructor(options: KeyframeOptions, uuid: any)
40
- static selected: _Keyframe[]
41
- data_points: KeyframeDataPoint[]
42
- animator: GeneralAnimator
43
- channel: string
44
- time: number
45
- uuid: string
46
- color: number
47
- uniform: boolean
48
- interpolation: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
49
- cooldown?: boolean
50
- bezier_linked: boolean
51
- bezier_left_time: ArrayVector3
52
- bezier_right_time: ArrayVector3
53
- bezier_left_value: ArrayVector3
54
- bezier_right_value: ArrayVector3
55
- selected: boolean
56
- transform: boolean
57
- has_expressions: boolean
58
-
59
- extend(data: KeyframeOptions): this
60
- get(axis: axisLetter, data_point?: number): number | string
61
- calc(axis: axisLetter, data_point?: number): number
62
- set(axis: axisLetter, value: any, data_point?: number): this
63
- offset(axis: axisLetter, amount: any, data_point?: number): void
64
- flip(axis: axisLetter): this
65
- getLerp(other: _Keyframe, axis: axisLetter, amount: number, allow_expression?: boolean): number
66
- getCatmullromLerp(
67
- before_plus: _Keyframe,
68
- before: _Keyframe,
69
- after: _Keyframe,
70
- after_plus: _Keyframe,
71
- axis: axisLetter,
72
- alpha: number
73
- ): number
74
- getArray(data_point?: number): (number | string)[]
75
- getFixed(
76
- data_point?: number,
77
- get_quaternion?: boolean
78
- ): THREE.Vector3 | THREE.Euler | THREE.Quaternion
79
- getTimecodeString(): string
80
- compileBedrockKeyframe(): any
81
- replaceOthers(save: any): void
82
- select(event?: any): this
83
- callPlayhead(): this
84
- showContextMenu(event: Event): this
85
- remove(): void
86
- forSelected(callback: (keyframe: _Keyframe) => void, undo_tag: any): this[]
87
- getUndoCopy(save: any): {
88
- animator: any
89
- channel?: string | null
90
- data_points: KeyframeDataPoint[]
91
- }
92
- }
93
-
94
- declare function updateKeyframeSelection(): void
1
+ /// <reference types="./blockbench"/>
2
+
3
+ /**
4
+ * Keyframes are used in animations to specify transformation or other data at specific points in the timeline
5
+ * @module
6
+ */
7
+
8
+ interface KeyframeDataPointData {
9
+ [key: string]: any
10
+ }
11
+ declare class KeyframeDataPoint extends Object {
12
+ static properties: Record<string, Property<any>>
13
+ constructor(keyframe: _Keyframe)
14
+ readonly keyframe: Keyframe
15
+ extend(data: KeyframeDataPointData): void
16
+ getUndoCopy(): {
17
+ [key: string]: any
18
+ }
19
+ [key: string]: any
20
+ }
21
+
22
+ interface KeyframeOptions {
23
+ channel?: string
24
+ data_points: {}[]
25
+ time: number
26
+ color?: number
27
+ uniform?: boolean
28
+ interpolation?: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
29
+ bezier_linked?: boolean
30
+ bezier_left_time?: ArrayVector3
31
+ bezier_left_value?: ArrayVector3
32
+ bezier_right_time?: ArrayVector3
33
+ bezier_right_value?: ArrayVector3
34
+ }
35
+ type axisLetter = 'x' | 'y' | 'z'
36
+ type axisNumber = 0 | 1 | 2
37
+
38
+ declare class _Keyframe {
39
+ constructor(options: KeyframeOptions, uuid: any)
40
+ static selected: _Keyframe[]
41
+ data_points: KeyframeDataPoint[]
42
+ animator: GeneralAnimator
43
+ channel: string
44
+ time: number
45
+ uuid: string
46
+ color: number
47
+ uniform: boolean
48
+ interpolation: 'linear' | 'catmullrom' | 'bezier' | 'step' | string
49
+ cooldown?: boolean
50
+ bezier_linked: boolean
51
+ bezier_left_time: ArrayVector3
52
+ bezier_right_time: ArrayVector3
53
+ bezier_left_value: ArrayVector3
54
+ bezier_right_value: ArrayVector3
55
+ selected: boolean
56
+ transform: boolean
57
+ has_expressions: boolean
58
+
59
+ extend(data: KeyframeOptions): this
60
+ get(axis: axisLetter, data_point?: number): number | string
61
+ calc(axis: axisLetter, data_point?: number): number
62
+ set(axis: axisLetter, value: any, data_point?: number): this
63
+ offset(axis: axisLetter, amount: any, data_point?: number): void
64
+ flip(axis: axisLetter): this
65
+ getLerp(other: _Keyframe, axis: axisLetter, amount: number, allow_expression?: boolean): number
66
+ getCatmullromLerp(
67
+ before_plus: _Keyframe,
68
+ before: _Keyframe,
69
+ after: _Keyframe,
70
+ after_plus: _Keyframe,
71
+ axis: axisLetter,
72
+ alpha: number
73
+ ): number
74
+ getArray(data_point?: number): (number | string)[]
75
+ getFixed(
76
+ data_point?: number,
77
+ get_quaternion?: boolean
78
+ ): THREE.Vector3 | THREE.Euler | THREE.Quaternion
79
+ getTimecodeString(): string
80
+ compileBedrockKeyframe(): any
81
+ replaceOthers(save: any): void
82
+ select(event?: any): this
83
+ callPlayhead(): this
84
+ showContextMenu(event: Event): this
85
+ remove(): void
86
+ forSelected(callback: (keyframe: _Keyframe) => void, undo_tag: any): this[]
87
+ getUndoCopy(save: any): {
88
+ animator: any
89
+ channel?: string | null
90
+ data_points: KeyframeDataPoint[]
91
+ }
92
+ }
93
+
94
+ declare function updateKeyframeSelection(): void
package/custom/libs.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import three from 'three'
2
-
3
- declare module 'three' {
4
- interface Object3D {
5
- /**The outline mesh of the mesh */
6
- outline?: three.Object3D | three.Mesh
7
- fix_rotation?: three.Euler
8
- fix_position?: three.Vector3
9
- no_export?: boolean
10
- isElement?: boolean
11
- isGroup?: boolean
12
- }
13
- }
1
+ import three from 'three'
2
+
3
+ declare module 'three' {
4
+ interface Object3D {
5
+ /**The outline mesh of the mesh */
6
+ outline?: three.Object3D | three.Mesh
7
+ fix_rotation?: three.Euler
8
+ fix_position?: three.Vector3
9
+ no_export?: boolean
10
+ isElement?: boolean
11
+ isGroup?: boolean
12
+ }
13
+ }
@@ -0,0 +1,66 @@
1
+ /// <reference types="./blockbench"/>
2
+
3
+
4
+ declare interface BarMenuOptions {
5
+ name?: string
6
+ icon?: IconString
7
+ condition?: ConditionResolvable
8
+ }
9
+
10
+ /**
11
+ * Creates a new menu in the menu bar
12
+ */
13
+ declare class BarMenu extends Menu {
14
+ constructor(id: string, structure: MenuItem[], options?: BarMenuOptions)
15
+ type: 'bar_menu'
16
+ id: string
17
+ condition?: ConditionResolvable
18
+ name: string
19
+ label: HTMLElement
20
+ structure: MenuItem[]
21
+ /**
22
+ * Visually highlights an action within the menu, until the user opens the menu
23
+ */
24
+ highlight(action: Action): void
25
+ }
26
+
27
+ declare namespace MenuBar {
28
+ const mode_switcher_button: null | HTMLDivElement
29
+ const menus: {
30
+ file: Menu
31
+ edit: Menu
32
+ transform: Menu
33
+ uv: Menu
34
+ texture: Menu
35
+ animation: Menu
36
+ keyframe: Menu
37
+ display: Menu
38
+ tools: Menu
39
+ view: Menu
40
+ help: Menu
41
+ [id: string]: Menu
42
+ }
43
+ const keys: string[]
44
+ let open: Menu | null
45
+ /**
46
+ * Add a new menu to the menu bar
47
+ * @param menu The BarMenu to add
48
+ * @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.
49
+ */
50
+ function addMenu(menu: BarMenu, position?: number | string): void
51
+ /**
52
+ * Adds an action to the menu structure
53
+ * @param action Action to add
54
+ * @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.
55
+ */
56
+ function addAction(action: Action, path?: string): void
57
+ /**
58
+ *
59
+ * @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.
60
+ */
61
+ function removeAction(path: string): void
62
+ /**
63
+ * Update the menu bar
64
+ */
65
+ function update(): void
66
+ }
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 {}