blockbench-types 3.9.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockbench-types",
3
- "version": "3.9.0",
3
+ "version": "4.3.0",
4
4
  "description": "Blockbench typescript types",
5
5
  "main": "",
6
6
  "types": "types/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "homepage": "https://github.com/JannisX11/blockbench-types#readme",
20
20
  "dependencies": {
21
21
  "@types/jquery": "^3.5.4",
22
- "three": "^0.120.0",
23
- "vue": "^2.6.12",
24
- "wintersky": "^1.0.2"
22
+ "three": "^0.129.0",
23
+ "vue": "^2.6.14",
24
+ "wintersky": "^1.1.0"
25
25
  }
26
26
  }
@@ -8,7 +8,7 @@ interface AnimationOptions {
8
8
  snapping?: number
9
9
  }
10
10
 
11
- class Animation {
11
+ declare class Animation {
12
12
  constructor(data: AnimationOptions);
13
13
  extend(data: AnimationOptions): this;
14
14
  getUndoCopy(options: any, save: any): {
@@ -62,3 +62,65 @@ namespace Animator {
62
62
 
63
63
 
64
64
  }
65
+
66
+ interface AddChannelOptions {
67
+ name?: string
68
+ transform?: boolean
69
+ mutable?: boolean
70
+ max_data_points?: number
71
+ }
72
+ declare class GeneralAnimator {
73
+ constructor(uuid: string, animation: Animation)
74
+ keyframes: Keyframe[]
75
+ select(): this
76
+ addToTimeline(): this
77
+ addKeyframe(data: KeyframeOptions, uuid: string): Keyframe
78
+ createKeyframe(): Keyframe
79
+ getOrMakeKeyframe(): {before: Keyframe, result: Keyframe}
80
+ toggleMuted(channel: string): this
81
+ scrollTo(): this
82
+
83
+ static addChannel(channel: string, options: AddChannelOptions)
84
+ }
85
+
86
+ declare class BoneAnimator extends GeneralAnimator {
87
+ name: string
88
+ uuid: string
89
+ rotations: Keyframe[]
90
+ position: Keyframe[]
91
+ scale: Keyframe[]
92
+ getGroup(): Group
93
+ select
94
+ fillValues
95
+ pushKeyframe
96
+ doRender
97
+ displayRotation
98
+ displayPosition
99
+ displayScale
100
+ interpolate
101
+ displayFrame
102
+ }
103
+ declare class NullObjectAnimator extends GeneralAnimator {
104
+ name: string
105
+ uuid: string
106
+ rotations: Keyframe[]
107
+ position: Keyframe[]
108
+ scale: Keyframe[]
109
+ getElement(): NullObject
110
+ select
111
+ doRender
112
+ displayPosition
113
+ displayIK
114
+ displayFrame
115
+ }
116
+ declare class EffectAnimator extends GeneralAnimator {
117
+ name: string
118
+ uuid: string
119
+ rotations: Keyframe[]
120
+ position: Keyframe[]
121
+ scale: Keyframe[]
122
+ pushKeyframe(keyframe): this
123
+ displayFrame(in_loop): this
124
+ startPreviousSounds
125
+ }
126
+
package/types/canvas.d.ts CHANGED
@@ -40,26 +40,45 @@ interface UpdateViewOptions {
40
40
 
41
41
  declare const Canvas: {
42
42
  materials: {
43
- [uuid: string]: THREE.Material
43
+ [uuid: UUID]: THREE.Material
44
44
  };
45
45
  meshes: {
46
- [uuid: string]: THREE.Mesh
46
+ [uuid: UUID]: THREE.Mesh
47
47
  };
48
48
  bones: {
49
- [uuid: string]: THREE.Object3D
49
+ [uuid: UUID]: THREE.Object3D
50
50
  };
51
+ /**
52
+ * Main scene, shared across all tabs
53
+ */
54
+ scene: THREE.Scene
55
+ /**
56
+ * List of the gizmos (control and UI elements) in the 3D scene
57
+ */
58
+ gizmos: []
51
59
  /**
52
60
  * The material used for all selection outlines
53
61
  */
54
62
  outlineMaterial: THREE.LineBasicMaterial;
63
+ meshOutlineMaterial: THREE.LineBasicMaterial;
55
64
  /**
56
65
  * The material used for the wireframe view
57
66
  */
58
67
  wireframeMaterial: THREE.MeshBasicMaterial;
68
+ solidMaterial: THREE.ShaderMaterial;
69
+ normalHelperMaterial: THREE.ShaderMaterial;
70
+ uvHelperMaterial: THREE.ShaderMaterial;
71
+ meshVertexMaterial: THREE.PointsMaterial;
59
72
  /**
60
73
  * The material used for the grids
61
74
  */
62
75
  gridMaterial: THREE.LineBasicMaterial;
76
+
77
+ pivot_marker: THREE.Object3D
78
+
79
+ global_light_color: THREE.Color
80
+ global_light_side: number
81
+
63
82
  face_order: string[];
64
83
 
65
84
  /**
@@ -74,6 +93,8 @@ declare const Canvas: {
74
93
  * Clear all elements from the scene
75
94
  */
76
95
  clear(): void;
96
+ buildGrid(): void;
97
+ updateShading(): void;
77
98
  /**
78
99
  * Updates selected aspects of the preview
79
100
  * @param options
@@ -161,6 +182,10 @@ declare const Canvas: {
161
182
  * @param animation Whether to display the current animated texture frame
162
183
  */
163
184
  updateUV(cube: Cube, animation?: boolean): any;
185
+ /**
186
+ * Update the materials of marker colors if new colors were added
187
+ */
188
+ updateMarkerColorMaterials(): void;
164
189
  /**
165
190
  * Create an additional outline around the specified cubes
166
191
  * @param arr List of cubes to outline
@@ -0,0 +1,154 @@
1
+ interface DialogFormElement {
2
+ label: string
3
+ description?: string
4
+ type: 'text' | 'number' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info'
5
+ nocolon?: boolean
6
+ readonly?: boolean
7
+ value?: any
8
+ placeholder?: string
9
+ text?: string
10
+ colorpicker?: any
11
+ min?: number
12
+ max?: number
13
+ step?: number
14
+ height?: number
15
+ options?: object
16
+ }
17
+
18
+ type FormResultValue = string|number|boolean|[]
19
+
20
+ interface ActionInterface {
21
+ name: string
22
+ description?: string
23
+ icon: string,
24
+ click: (event: Event) => void
25
+ condition: Condition
26
+ }
27
+ interface DialogOptions {
28
+ title: string
29
+ id: string
30
+ /**
31
+ * Default button to press to confirm the dialog. Defaults to the first button.
32
+ */
33
+ confirmIndex?: number
34
+ /**
35
+ * Default button to press to cancel the dialog. Defaults to the last button.
36
+ */
37
+ cancelIndex?: number
38
+ /**
39
+ * Function to execute when the user confirms the dialog
40
+ */
41
+ onConfirm?: (formResult: object) => void
42
+ /**
43
+ * Function to execute when the user cancels the dialog
44
+ */
45
+ onCancel?: () => void
46
+ /**
47
+ * Triggered when the user presses a specific button
48
+ */
49
+ onButton?: (button_index: number, event?: Event) => void
50
+ /**
51
+ * Function to run when anything in the form is changed
52
+ */
53
+ onFormChange?: (form_result: {[key: string]: FormResultValue}) => void
54
+ /**
55
+ * Array of HTML object strings for each line of content in the dialog.
56
+ */
57
+ lines?: (string|HTMLElement)[]
58
+ /**
59
+ * Creates a form in the dialog
60
+ */
61
+ form?: {
62
+ [formElement: string]: '_' | DialogFormElement
63
+ }
64
+ /**
65
+ * Vue component
66
+ */
67
+ component?: Vue.Component
68
+ /**
69
+ * Order that the different interface types appear in the dialog. Default is 'form', 'lines', 'component'.
70
+ */
71
+ part_order?: string[]
72
+ form_first?: boolean
73
+ /**
74
+ * Creates a dialog sidebar
75
+ */
76
+ sidebar?: DialogSidebarOptions
77
+ /**
78
+ * Menu in the handle bar
79
+ */
80
+ title_menu?: Menu
81
+ /**
82
+ * If true, the dialog will only have one button to close it
83
+ */
84
+ singleButton?: boolean
85
+ /**
86
+ * List of buttons
87
+ */
88
+ buttons?: string[]
89
+ }
90
+
91
+ interface DialogSidebarOptions {
92
+ pages?: {
93
+ [key: string]: string | {label: string, icon: IconString, color?: string}
94
+ }
95
+ page?: string
96
+ actions?: (Action|ActionInterface|string)[],
97
+ onPageSwitch?: (page: string) => void
98
+ }
99
+ declare class DialogSidebar {
100
+ constructor(options: DialogSidebarOptions)
101
+
102
+ pages: {
103
+ [key: string]: string
104
+ }
105
+ page: string
106
+ actions: (Action|string)[]
107
+ onPageSwitch(page: string): void
108
+ build(): void
109
+ toggle(state?: boolean): void
110
+ setPage(page: string): void
111
+ }
112
+
113
+ declare class Dialog {
114
+ constructor (options: DialogOptions)
115
+
116
+ id: string
117
+ component: Vue.Component
118
+ sidebar: DialogSidebar | null
119
+
120
+
121
+ show: () => Dialog
122
+ hide: () => Dialog
123
+ /**
124
+ * Triggers the confirm event of the dialog.
125
+ */
126
+ confirm: (event?: Event) => void
127
+ /**
128
+ * Triggers the cancel event of the dialog.
129
+ */
130
+ cancel: (event?: Event) => void
131
+ /**
132
+ * Closes the dialog using the index of the pressed button
133
+ */
134
+ close: (button: number, event?: Event) => void
135
+ /**
136
+ * If the dialog contains a form, return the current values of the form
137
+ */
138
+ getFormResult(): {
139
+ [key: string]: FormResultValue
140
+ }
141
+ /**
142
+ * Set the values of the dialog form inputs
143
+ */
144
+ setFormValues(values: {[key: string]: FormResultValue}): void
145
+ /**
146
+ * Delete the dialog object, causing it to be re-build from scratch on next open
147
+ */
148
+ delete(): void
149
+
150
+ /**
151
+ * Currently opened dialog
152
+ */
153
+ static open: Dialog | null
154
+ }
@@ -135,7 +135,7 @@ declare namespace Blockbench {
135
135
  */
136
136
  propagate?: boolean
137
137
  }
138
- export function addDragHandler(id: string, options: DragHandlerOptions, callback?: () => void): void
138
+ export function addDragHandler(id: string, options: DragHandlerOptions, callback?: () => void): Deletable
139
139
  export function removeDragHandler(id: string): void
140
140
 
141
141
  }
package/types/format.d.ts CHANGED
@@ -1,9 +1,28 @@
1
+ interface FormatPage {
2
+ component?: Vue.Component
3
+ content?: ({
4
+ type: 'image' | 'h2' | 'h3' | 'h4' | 'text' | 'label' | 'image' | ''
5
+ text?: string
6
+ source?: string
7
+ width?: number
8
+ height?: number
9
+ } | string)[]
10
+ button_text?: string
11
+ }
12
+
1
13
  interface FormatOptions {
2
14
  id: string
3
15
  icon: string
4
16
  name?: string
5
17
  description?: string
18
+ category?: string
19
+ target?: string | string[]
20
+ confidential?: boolean
21
+ condition?: Condition
6
22
  show_on_start_screen?: boolean
23
+ format_page?: FormatPage
24
+ onFormatPage?(): void
25
+ onStart?(): void
7
26
 
8
27
  box_uv?: boolean
9
28
  optional_box_uv?: boolean
@@ -13,12 +32,17 @@ interface FormatOptions {
13
32
  centered_grid?: boolean
14
33
  rotate_cubes?: boolean
15
34
  integer_size?: boolean
35
+ meshes?: boolean
36
+ texture_meshes?: boolean
16
37
  locators?: boolean
17
38
  canvas_limit?: boolean
18
39
  rotation_limit?: boolean
19
40
  uv_rotation?: boolean
20
41
  display_mode?: boolean
21
42
  animation_mode?: boolean
43
+ animation_files?: boolean
44
+ pose_mode?: boolean
45
+ texture_folder?: boolean
22
46
 
23
47
  codec?: Codec
24
48
  onActivation?(): void
@@ -26,28 +50,47 @@ interface FormatOptions {
26
50
  }
27
51
 
28
52
  declare class ModelFormat extends Deletable {
53
+ constructor(id: string, options: FormatOptions)
29
54
  constructor(options: FormatOptions)
30
55
 
31
56
  id: string
32
57
  icon: string
33
- name?: string
34
- description?: string
35
- show_on_start_screen?: boolean
58
+ name: string
59
+ description: string
60
+ category: string
61
+ target: string | string[]
62
+ confidential: boolean
63
+ condition?: Condition
64
+ show_on_start_screen: boolean
65
+ format_page?: FormatPage
66
+ onFormatPage?(): void
67
+ onStart?(): void
36
68
 
37
69
  box_uv: boolean
38
70
  optional_box_uv: boolean
39
71
  single_texture: boolean
72
+ model_identifier: boolean
73
+ parent_model_id: boolean
74
+ vertex_color_ambient_occlusion: boolean
40
75
  animated_textures: boolean
41
76
  bone_rig: boolean
42
77
  centered_grid: boolean
43
78
  rotate_cubes: boolean
44
79
  integer_size: boolean
80
+ meshes: boolean
81
+ texture_meshes: boolean
45
82
  locators: boolean
46
83
  canvas_limit: boolean
47
84
  rotation_limit: boolean
48
85
  uv_rotation: boolean
86
+ java_face_properties: boolean
87
+ select_texture_for_particles: boolean
88
+ bone_binding_expression: boolean
89
+ animation_files: boolean
90
+ pose_mode: boolean
49
91
  display_mode: boolean
50
92
  animation_mode: boolean
93
+ texture_folder: boolean
51
94
 
52
95
  /**
53
96
  * Selects the format
@@ -67,3 +110,36 @@ declare class ModelFormat extends Deletable {
67
110
  * The current format
68
111
  */
69
112
  declare const Format: ModelFormat
113
+
114
+
115
+ interface ModelLoaderOptions {
116
+ id?: string
117
+ icon: string
118
+ name?: string
119
+ description?: string
120
+ category?: string
121
+ target?: string | string[]
122
+ confidential?: boolean
123
+ condition?: Condition
124
+ format_page?: FormatPage
125
+ onFormatPage?(): void
126
+ onStart?(): void
127
+ }
128
+
129
+ declare class ModelLoader extends Deletable {
130
+ constructor(id: string, options: ModelLoaderOptions)
131
+ constructor(options: ModelLoaderOptions)
132
+
133
+ id: string
134
+ icon: string
135
+ name: string
136
+ description: string
137
+ category: string
138
+ target: string | string[]
139
+ confidential: boolean
140
+ condition?: Condition
141
+ show_on_start_screen: boolean
142
+ format_page?: FormatPage
143
+ onFormatPage?(): void
144
+ onStart?(): void
145
+ }
package/types/index.d.ts CHANGED
@@ -7,22 +7,30 @@
7
7
  /// <reference types="./animation" />
8
8
  /// <reference types="./canvas" />
9
9
  /// <reference types="./codec" />
10
+ /// <reference types="./file_system" />
10
11
  /// <reference types="./format" />
12
+ /// <reference types="./global" />
11
13
  /// <reference types="./interface" />
14
+ /// <reference types="./dialog" />
15
+ /// <reference types="./panel" />
12
16
  /// <reference types="./keyframe" />
13
17
  /// <reference types="./legacy" />
14
18
  /// <reference types="./menu" />
15
19
  /// <reference types="./outliner" />
20
+ /// <reference types="./plugin" />
16
21
  /// <reference types="./preview" />
22
+ /// <reference types="./project" />
17
23
  /// <reference types="./settings" />
18
24
  /// <reference types="./textures" />
19
25
  /// <reference types="./timeline" />
26
+ /// <reference types="./undo" />
20
27
  /// <reference types="./util" />
21
28
 
22
29
 
23
30
  declare class Deletable {
24
31
  delete: () => void
25
32
  }
33
+ type UUID = string
26
34
 
27
35
  /**
28
36
  * True if Blockbench runs as a native app
@@ -48,7 +56,10 @@ type EventName = 'remove_animation'
48
56
  | 'reset_project'
49
57
  | 'close_project'
50
58
  | 'add_cube'
59
+ | 'add_mesh'
51
60
  | 'add_group'
61
+ | 'add_texture_mesh'
62
+ | 'group_elements'
52
63
  | 'update_selection'
53
64
  | 'update_keyframe_selection'
54
65
  | 'select_all'
@@ -65,6 +76,19 @@ type EventName = 'remove_animation'
65
76
  | 'load_undo_save'
66
77
  | 'select_mode'
67
78
  | 'unselect_mode'
79
+ | 'change_active_panel'
80
+ | 'resize_window'
81
+ | 'press_key'
82
+ | 'convert_format'
83
+ | 'select_project'
84
+ | 'unselect_project'
85
+ | 'setup_project'
86
+ | 'update_project_resolution'
87
+ | 'update_project_settings'
88
+ | 'merge_project'
89
+ | 'update_view'
90
+ | 'update_camera_position'
91
+ | 'render_frame'
68
92
 
69
93
  type IconString = string;
70
94
 
@@ -199,25 +223,6 @@ declare class Plugin {
199
223
 
200
224
  type Condition = any
201
225
 
202
- interface PanelOptions {
203
- id: string
204
- icon: string
205
- menu?: any
206
- growable?: boolean
207
- name: string
208
- selection_only?: boolean
209
- condition?: Condition
210
- onResize: () => void
211
- toolbars: object
212
- component: Vue.Component
213
- default_side: any
214
- insert_before: any
215
- insert_after: any
216
- }
217
- declare class Panel {
218
- constructor (options: PanelOptions)
219
- }
220
-
221
226
 
222
227
  interface PropertyOptions {
223
228
  default?: any
@@ -1,97 +1,81 @@
1
- interface DialogFormElement {
2
- label: string
3
- description?: string
4
- type: 'text' | 'number' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'vector' | 'color' | 'file' | 'folder' | 'save' | 'info'
5
- nocolon?: boolean
6
- readonly?: boolean
7
- value?: any
8
- placeholder?: string
9
- text?: string
10
- colorpicker?: any
11
- min?: number
12
- max?: number
13
- step?: number
14
- height?: number
15
- options?: object
1
+ interface ResizeLineOptions {
2
+ condition?: Condition
3
+ horizontal?: boolean
4
+ position(): void
5
+ get(): void
6
+ set(): void
16
7
  }
8
+ declare class ResizeLine {
9
+ constructor(id: string, options: ResizeLineOptions)
17
10
 
18
- type FormResultValue = string|number|boolean|[]
19
- interface DialogOptions {
20
- title: string
21
11
  id: string
22
- /**
23
- * Array of HTML object strings for each line of content in the dialog.
24
- */
25
- lines: string[]
26
- /**
27
- * If false, the confirm button of the dialog is disabled
28
- */
29
- confirmEnabled?: boolean
30
- /**
31
- * If false, the cancel button of the dialog is disabled
32
- */
33
- cancelEnabled?: boolean
34
- /**
35
- * Default button to press to confirm the dialog. Defaults to the first button.
36
- */
37
- confirmIndex?: number
38
- /**
39
- * Default button to press to cancel the dialog. Defaults to the last button.
40
- */
41
- cancelIndex?: number
42
- /**
43
- * Function to execute when the user confirms the dialog
44
- */
45
- onConfirm?: (formResult: object) => void
46
- /**
47
- * Function to execute when the user cancels the dialog
48
- */
49
- onCancel?: () => void
50
- /**
51
- * Triggered when the user presses a specific button
52
- */
53
- onButton?: (button_index: number, event?: Event) => void
54
- /**
55
- * Function to run when anything in the form is changed
56
- */
57
- onFormChange?: (form_result: {[key: string]: FormResultValue}) => void
58
- /**
59
- * Creates a form in the dialog
60
- */
61
- form?: {
62
- [formElement: string]: '_' | DialogFormElement
63
- }
64
- /**
65
- * Vue component
66
- */
67
- component: Vue.Component
12
+ horizontal: boolean
13
+ condition?: Condition
14
+ width: number
15
+ get(): void
16
+ set(): void
17
+ node: HTMLElement
18
+ update(): void
19
+ setPosition(data: {top?: number, bottom?: number, left?: number, right?: number}): void
68
20
  }
69
21
 
70
- declare class Dialog {
71
- constructor (options: DialogOptions)
72
- show: () => Dialog
73
- hide: () => Dialog
74
- /**
75
- * Triggers the confirm event of the dialog.
76
- */
77
- confirm: (event?: Event) => void
78
- /**
79
- * Triggers the cancel event of the dialog.
80
- */
81
- cancel: (event?: Event) => void
82
- /**
83
- * Closes the dialog using the index of the pressed button
84
- */
85
- close: (button: number, event?: Event) => void
86
- /**
87
- * If the dialog contains a form, return the current values of the form
88
- */
89
- getFormResult(): {
90
- [key: string]: FormResultValue
22
+ declare namespace Interface {
23
+ function createElement(type: keyof HTMLElementTagNameMap, attributes?: {}, content?: string | HTMLElement | HTMLElement[]): HTMLElement
24
+
25
+ const data: {
26
+ left_bar_width: number
27
+ right_bar_width: number
28
+ quad_view_x: number
29
+ quad_view_y: number
30
+ timeline_head: number
31
+ left_bar: string[]
32
+ right_bar: string[]
33
+ }
34
+ let left_bar_width: number
35
+ let right_bar_width: number
36
+ let top_panel_height: number
37
+ let bottom_panel_height: number
38
+ function getTopPanel(): Panel[]
39
+ function getBottomPanel(): Panel[]
40
+ function getLeftPanels(): Panel[]
41
+ function getRightPanels(): Panel[]
42
+ const Resizers: {
43
+ left: ResizeLine
44
+ right: ResizeLine
45
+ quad_view_x: ResizeLine
46
+ quad_view_y: ResizeLine
47
+ top: ResizeLine
48
+ bottom: ResizeLine
49
+ timeline_head: ResizeLine
50
+ }
51
+ const status_bar: {
52
+ menu: Menu
53
+ vue: Vue
54
+ }
55
+ const Panels: {
56
+ (key: string): Panel
57
+ }
58
+ function toggleSidebar(side, status): void
59
+
60
+ const text_edit_menu: Menu
61
+
62
+ function addSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
63
+ function removeSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
64
+
65
+ const center_screen: HTMLElement
66
+ const page_wrapper: HTMLElement
67
+ const preview: HTMLElement
68
+ const work_screen: HTMLElement
69
+ const right_bar: HTMLElement
70
+ const left_bar: HTMLElement
71
+
72
+ namespace CustomElements {
73
+ function SelectInput(id: string, options: {
74
+ value?: string
75
+ default?: string
76
+ options: {key: string, value: string}
77
+ onChange?(): void
78
+ }): HTMLElement
79
+ const ResizeLine;
91
80
  }
92
- /**
93
- * Delete the dialog object, causing it to be re-build from scratch on next open
94
- */
95
- delete(): void
96
-
97
81
  }
package/types/menu.d.ts CHANGED
@@ -1,7 +1,21 @@
1
1
  interface CustomMenuItem {
2
2
  name: string
3
+ id: string
4
+ icon: IconString
5
+ color?: string
6
+ description?: string
7
+ /**
8
+ * Keybind or string to display in the menu, won't work as an actual keybinding by default
9
+ */
10
+ keybind?: Keybind | string
11
+ /**
12
+ * Adds a search bar to the menu or submenu
13
+ */
14
+ searchable?: boolean
15
+ children?: MenuItem[] | (() => MenuItem[])
16
+ click?: (context?: any, event: Event)
3
17
  }
4
- type MenuItem = CustomMenuItem | Action | string;
18
+ type MenuItem = CustomMenuItem | Action | BarSelect | string;
5
19
 
6
20
  /**
7
21
  * Creates a new context menu
@@ -48,9 +62,12 @@ declare namespace MenuBar {
48
62
  file: Menu
49
63
  edit: Menu
50
64
  transform: Menu
51
- display: Menu
52
- filter: Menu
65
+ uv: Menu
66
+ texture: Menu
53
67
  animation: Menu
68
+ keyframe: Menu
69
+ display: Menu
70
+ tools: Menu
54
71
  view: Menu
55
72
  help: Menu
56
73
  [id: string]: Menu
@@ -1,3 +1,4 @@
1
+ type ArrayVector4 = [number, number, number, number]
1
2
  type ArrayVector3 = [number, number, number]
2
3
  type ArrayVector2 = [number, number]
3
4
 
@@ -7,7 +8,7 @@ type ArrayVector2 = [number, number]
7
8
  */
8
9
  declare class OutlinerNode {
9
10
  constructor ()
10
- uuid: string
11
+ uuid: UUID
11
12
  export: boolean
12
13
  locked: boolean
13
14
  parent: Group | 'root'
@@ -0,0 +1,54 @@
1
+ interface PanelOptions {
2
+ id: string
3
+ name: string
4
+ icon: string
5
+ menu?: any
6
+ growable?: boolean
7
+ selection_only?: boolean
8
+ condition?: Condition
9
+ display_condition?: Condition
10
+ expand_button: boolean
11
+ toolbars: {
12
+ [id: string]: Toolbar
13
+ }
14
+ default_position: {
15
+ slot: string
16
+ float_position: [number, number]
17
+ float_size: [number, number]
18
+ height: number
19
+ folded: boolean
20
+ }
21
+ component: Vue.Component
22
+ default_side: 'right' | 'left'
23
+ insert_before: string
24
+ insert_after: string
25
+ onResize: () => void
26
+ onFold: () => void
27
+ }
28
+ type PanelEvent = 'drag' | 'fold' | 'change_zindex' | 'move_to' | 'moved_to' | 'update'
29
+
30
+ declare class Panel {
31
+ constructor (id: string, options: PanelOptions)
32
+ constructor (options: PanelOptions)
33
+ isVisible(): boolean
34
+ isInSidebar(): boolean
35
+ slot: string
36
+ folded: boolean
37
+ fold(state?: boolean): this
38
+ /**
39
+ * If the panel is floating, move it up to the front
40
+ */
41
+ moveToFront(): this
42
+ moveTo(slot: string, ref_panel?: Panel, before?: boolean): this
43
+ update(dragging?: boolean): this
44
+ dispatchEvent(event_name: PanelEvent, data?: any): void
45
+ /**
46
+ * Add an event listener
47
+ */
48
+ on(event_name: PanelEvent, callback: (data?) => void): void
49
+ removeListener(event_name: PanelEvent, callback: (data?) => void): void
50
+ delete(): void
51
+ }
52
+
53
+ declare function updateInterfacePanels(): void
54
+ declare function setActivePanel(panel_id: string): void
@@ -0,0 +1,109 @@
1
+ interface PreviewModelCubeTemplate {
2
+ position: ArrayVector3
3
+ size: ArrayVector3
4
+ origin?: ArrayVector3
5
+ rotation?: ArrayVector3
6
+ faces: {
7
+ north?: {uv: ArrayVector4}
8
+ east?: {uv: ArrayVector4}
9
+ west?: {uv: ArrayVector4}
10
+ south?: {uv: ArrayVector4}
11
+ up?: {uv: ArrayVector4}
12
+ down?: {uv: ArrayVector4}
13
+ }
14
+ }
15
+
16
+ interface PreviewModelOptions {
17
+ condition?: Condition
18
+ cubes: PreviewModelCubeTemplate[]
19
+ /**
20
+ * Source of the model's texture
21
+ */
22
+ texture?: string
23
+ /**
24
+ * Model tint color
25
+ */
26
+ color?: string
27
+ /**
28
+ * Enable shading on the material
29
+ */
30
+ shading?: boolean
31
+ /**
32
+ * THREE.JS material render side
33
+ */
34
+ render_side?: number
35
+ texture_size?: [number, number]
36
+ onUpdate?(): void
37
+ }
38
+
39
+ declare class PreviewModel extends Deletable {
40
+ constructor(id: string, options: PreviewModelOptions)
41
+
42
+ static models: {
43
+ (id: string): PreviewModel
44
+ }
45
+ static getActiveModels(): PreviewModel[]
46
+
47
+ id: string
48
+ model_3d: THREE.Object3D
49
+ cubes: PreviewModelCubeTemplate[]
50
+ texture?: string
51
+ color?: string
52
+ shading: boolean
53
+ render_side: number
54
+ texture_size: [number, number]
55
+ onUpdate?:() => void
56
+ /**
57
+ * Enables the model in the preview
58
+ */
59
+ enable(): void
60
+ /**
61
+ * Disables the model in the preview
62
+ */
63
+ disable(): boolean
64
+ /**
65
+ * Update the appearance and visibility of the model
66
+ */
67
+ update(): void
68
+ buildModel(): void
69
+ }
70
+
71
+
72
+
73
+ interface PreviewSceneOptions {
74
+ name?: string
75
+ description?: string
76
+ light_color?: string
77
+ light_side?: number
78
+ condition?: Condition
79
+ preview_models?: string[]
80
+ }
81
+
82
+ declare class PreviewScene extends Deletable {
83
+ constructor(id: string, options: PreviewSceneOptions)
84
+
85
+ static scenes: {
86
+ (id: string): PreviewScene
87
+ }
88
+ static active: PreviewScene | null
89
+ select_options: {
90
+ (id: string): string
91
+ }
92
+
93
+ id: string
94
+ name: string
95
+ description: string
96
+ light_color: string
97
+ light_side: number
98
+ condition?: Condition
99
+ preview_models: string[]
100
+
101
+ /**
102
+ * Selects this preview scene
103
+ */
104
+ select(): void
105
+ /**
106
+ * Unselects this preview scene
107
+ */
108
+ unselect(): void
109
+ }
@@ -0,0 +1,119 @@
1
+ interface ModelProjectOptions {
2
+ format: ModelFormat
3
+ }
4
+
5
+ declare class ModelProject {
6
+ constructor(options: ModelProjectOptions)
7
+
8
+ box_uv: boolean
9
+ texture_width: number
10
+ texture_height: number
11
+ name: string
12
+ uuid: UUID
13
+ selected: boolean
14
+ model_identifier: string
15
+ /**
16
+ * When set to true, the project tab can no longer be selected or unselected
17
+ */
18
+ locked: boolean
19
+ thumbnail: string
20
+ saved: boolean
21
+ /**
22
+ * The path under which a project file is saved, if available
23
+ */
24
+ save_path: string
25
+ /**
26
+ * The path under which an exported file is saved, if available
27
+ */
28
+ export_path: string
29
+ added_models: number
30
+ undo: UndoSystem
31
+ BedrockEntityManager?: {}
32
+ format: ModelFormat
33
+ mode: string
34
+ view_mode: string
35
+ display_uv: string
36
+ previews: {
37
+ [key: string]: {}
38
+ }
39
+ EditSession: EditSession
40
+
41
+ elements: OutlinerElement[]
42
+ groups: Group[]
43
+ selected_elements: OutlinerElement[]
44
+ selected_group: Group | null;
45
+ selected_vertices: {
46
+ [element_key: string]: string[]
47
+ };
48
+ selected_faces: []
49
+ textures: Texture[]
50
+ selected_texture: Texture | null;
51
+ outliner: OutlinerNode[]
52
+ animations: Animation[]
53
+ timeline_animators: []
54
+ display_settings: {
55
+ [slot: string]: {
56
+ translation: [number, number, number]
57
+ rotation: [number, number, number]
58
+ scale: [number, number, number]
59
+ mirror: [boolean, boolean, boolean]
60
+ }
61
+ };
62
+
63
+ get model_3d(): THREE.Object3D;
64
+ get materials(): {
65
+ [uuid: UUID]: THREE.ShaderMaterial
66
+ };
67
+ get nodes_3d(): {
68
+ [uuid: UUID]: THREE.Object3D
69
+ };
70
+
71
+ getDisplayName(): string;
72
+ openSettings(): void;
73
+ whenNextOpen(callback: () => void): void;
74
+ select(): boolean;
75
+ unselect(): void;
76
+ close(force: any): Promise<boolean>;
77
+
78
+ static all: ModelProject[]
79
+ }
80
+
81
+ declare const Project: ModelProject | null
82
+
83
+ declare function setupProject(format: ModelFormat | string): boolean;
84
+ declare function newProject(format: ModelFormat | string): boolean;
85
+ declare function setProjectResolution(width: number, height: number, modify_uv?: boolean): void;
86
+ declare function updateProjectResolution(): void;
87
+
88
+ declare class EditSession {
89
+ constructor()
90
+
91
+ active: boolean
92
+ hosting: boolean
93
+ clients: {}
94
+ client_count: number
95
+ data_queue: []
96
+ chat_history: []
97
+ Project: ModelProject | null
98
+
99
+ updateClientCound(): void
100
+ start(username?: string): void
101
+ join(username: string, token: string)
102
+ quit(): void
103
+ setState(active: boolean): void
104
+ copyToken(): void;
105
+ initNewModel(force?: boolean): void;
106
+ initConnection(conn: any): void;
107
+ sendAll(type: string, data: any): void;
108
+ sendEdit(entry: UndoEntry): void;
109
+ receiveData(tag: object): void;
110
+ processData(tag: object): void;
111
+ catchUp(): void;
112
+ /**
113
+ * Send a chat message
114
+ * @param text Text to send. If omitted, the current text in the chat panel input is sent
115
+ */
116
+ sendChat(text?: string): void;
117
+ addChatMessage(message: any): any;
118
+ processChatMessage(data: any): void;
119
+ }
@@ -0,0 +1,60 @@
1
+ interface UndoAspects {
2
+ selection?: boolean
3
+ elements?: OutlinerElement[]
4
+ outliner?: boolean
5
+ group?: Group
6
+ textures?: Texture[]
7
+ texture_order?: boolean
8
+ selected_texture?: boolean
9
+ settings?: {}
10
+ uv_mode?: boolean
11
+ animations?: Animation[]
12
+ keyframes?: Keyframe[]
13
+ display_slots?: string[]
14
+ exploded_view?: boolean
15
+ }
16
+ type UndoSave = {
17
+ aspects: UndoAspects
18
+ selection?: []
19
+ selection_group?: UUID
20
+ elements?: {}
21
+ outliner?: []
22
+ group?: {}
23
+ textures?: {}
24
+ texture_order?: UUID[]
25
+ selected_texture?: UUID | null
26
+ settings?: {}
27
+ uv_mode?: {
28
+ box_uv: boolean
29
+ width: number
30
+ height: number
31
+ }
32
+ animations?: {}
33
+ keyframes?: {}
34
+ display_slots?: {}
35
+ exploded_views?: boolean
36
+ }
37
+ type UndoEntry = {
38
+ before: UndoSave
39
+ post: UndoSave
40
+ action: string
41
+ time: number
42
+ }
43
+
44
+ declare class UndoSystem {
45
+ constructor();
46
+ initEdit(aspects: UndoAspects): any;
47
+ finishEdit(action: string, aspects?: UndoAspects): {
48
+ before: any;
49
+ post: any;
50
+ action: any;
51
+ time: number;
52
+ };
53
+ cancelEdit(): void;
54
+ addKeyframeCasualties(keyframes: Keyframe[]): void;
55
+ undo(remote?: boolean): void;
56
+ redo(remote?: boolean): void;
57
+ remoteEdit(entry: UndoEntry): void;
58
+ loadSave(save: UndoSave, reference: UndoSave, mode?: string): void;
59
+ }
60
+ declare let Undo: UndoSystem;
package/types/util.d.ts CHANGED
@@ -19,7 +19,6 @@ declare class oneLiner {
19
19
  }
20
20
 
21
21
  declare const templog: (...args: any) => void
22
- }
23
22
 
24
23
  /**
25
24
  * If the input event is a touch event, convert touch event to a compatible mouse event