blockbench-types 4.6.0 → 4.8.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 +11 -3
- package/scripts/generate_docs.js +368 -0
- package/tsconfig.json +16 -0
- package/types/action.d.ts +94 -11
- package/types/animation.d.ts +39 -23
- package/types/animation_controller.d.ts +28 -22
- package/types/{index.d.ts → blockbench.d.ts} +208 -28
- package/types/canvas.d.ts +78 -65
- package/types/canvas_frame.d.ts +21 -0
- package/types/codec.d.ts +93 -1
- package/types/cube.d.ts +93 -67
- package/types/dialog.d.ts +39 -36
- package/types/display_mode.d.ts +8 -5
- package/types/format.d.ts +2 -0
- package/types/global.d.ts +28 -0
- package/types/group.d.ts +76 -0
- package/types/interface.d.ts +2 -2
- package/types/keyframe.d.ts +36 -14
- package/types/menu.d.ts +7 -7
- package/types/mesh.d.ts +70 -64
- package/types/misc.d.ts +29 -8
- package/types/mode.d.ts +5 -5
- package/types/outliner.d.ts +29 -89
- package/types/painter.d.ts +6 -4
- package/types/panel.d.ts +21 -6
- package/types/plugin.d.ts +8 -0
- package/types/preview.d.ts +3 -0
- package/types/project.d.ts +10 -1
- package/types/screencam.d.ts +8 -0
- package/types/settings.d.ts +61 -13
- package/types/textures.d.ts +51 -2
- package/types/timeline.d.ts +4 -1
- package/types/undo.d.ts +30 -10
- package/types/util.d.ts +16 -3
- package/types/validator.d.ts +37 -2
- package/types/file_system.d.ts +0 -145
package/types/mode.d.ts
CHANGED
|
@@ -11,18 +11,18 @@ interface ModeOptions {
|
|
|
11
11
|
hide_status_bar?: boolean
|
|
12
12
|
condition?: ConditionResolvable
|
|
13
13
|
component?: Vue.Component
|
|
14
|
-
onSelect
|
|
15
|
-
onUnselect
|
|
14
|
+
onSelect?(): void
|
|
15
|
+
onUnselect?(): void
|
|
16
16
|
}
|
|
17
17
|
declare class Mode extends KeybindItem {
|
|
18
18
|
constructor(id: string, options: ModeOptions)
|
|
19
19
|
|
|
20
20
|
/**Selects the mode */
|
|
21
|
-
select
|
|
21
|
+
select(): void
|
|
22
22
|
/**Unselects the mode */
|
|
23
|
-
unselect
|
|
23
|
+
unselect(): void
|
|
24
24
|
/**Activates the mode */
|
|
25
|
-
trigger
|
|
25
|
+
trigger(): void
|
|
26
26
|
|
|
27
27
|
static selected: Mode
|
|
28
28
|
}
|
package/types/outliner.d.ts
CHANGED
|
@@ -9,47 +9,55 @@ type ArrayVector2 = [number, number]
|
|
|
9
9
|
declare class OutlinerNode {
|
|
10
10
|
constructor ()
|
|
11
11
|
uuid: UUID
|
|
12
|
+
name: string
|
|
12
13
|
export: boolean
|
|
13
14
|
locked: boolean
|
|
14
15
|
parent: Group | 'root'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the node. This should always be called when creating nodes that will be used in the outliner.
|
|
18
|
+
*/
|
|
19
|
+
init(): this
|
|
20
|
+
addTo(target?: OutlinerNode): this
|
|
21
|
+
sortInBefore(target?: OutlinerNode, index_modifier?: number): this
|
|
22
|
+
getParentArray(): OutlinerNode[]
|
|
19
23
|
/**
|
|
20
24
|
* Unfolds the outliner and scrolls up or down if necessary to show the group or element.
|
|
21
25
|
*/
|
|
22
|
-
showInOutliner
|
|
26
|
+
showInOutliner(): this
|
|
23
27
|
/**
|
|
24
28
|
* Updates the Vue node of the element. This is only necessary in some rare situations
|
|
25
29
|
*/
|
|
26
|
-
updateElement
|
|
30
|
+
updateElement(): this
|
|
27
31
|
/**
|
|
28
32
|
* Removes the element.
|
|
29
33
|
*/
|
|
30
|
-
remove
|
|
34
|
+
remove(): this
|
|
31
35
|
/**
|
|
32
36
|
* Marks the name of the group or element in the outliner for renaming.
|
|
33
37
|
*/
|
|
34
|
-
rename
|
|
38
|
+
rename(): this
|
|
35
39
|
/**
|
|
36
40
|
* Saves the changed name of the element by creating an undo point and making the name unique if necessary.
|
|
37
41
|
*/
|
|
38
|
-
saveName
|
|
42
|
+
saveName(): this
|
|
39
43
|
/**
|
|
40
44
|
* Create a unique name for the group or element by adding a number at the end or increasing it.
|
|
41
45
|
*/
|
|
42
|
-
createUniqueName
|
|
46
|
+
createUniqueName(): this
|
|
43
47
|
/**
|
|
44
48
|
* Checks of the group or element is a child of `group`.
|
|
45
49
|
* @param max_levels The maximum number of generations that can be between the element and the group
|
|
46
50
|
*/
|
|
47
|
-
isChildOf
|
|
51
|
+
isChildOf( group: Group, max_levels: number ): boolean
|
|
48
52
|
/**
|
|
49
53
|
* Displays the context menu of the element
|
|
50
54
|
* @param event Mouse event, determines where the context menu spawns.
|
|
51
55
|
*/
|
|
52
|
-
showContexnu
|
|
56
|
+
showContexnu(event: Event | HTMLElement): this
|
|
57
|
+
|
|
58
|
+
static uuids: {
|
|
59
|
+
[uuid: UUID]: OutlinerNode
|
|
60
|
+
}
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
/**
|
|
@@ -59,87 +67,11 @@ declare class OutlinerElement extends OutlinerNode {
|
|
|
59
67
|
constructor ()
|
|
60
68
|
selected: boolean
|
|
61
69
|
readonly mesh: THREE.Object3D | THREE.Mesh
|
|
62
|
-
getMesh
|
|
70
|
+
getMesh(): THREE.Object3D | THREE.Mesh
|
|
63
71
|
static fromSave: (data: object, keep_uuid?: boolean) => OutlinerElement
|
|
64
72
|
static isParent: false
|
|
65
73
|
}
|
|
66
74
|
|
|
67
|
-
interface GroupOptions {
|
|
68
|
-
/**Group name */
|
|
69
|
-
name: string
|
|
70
|
-
/**Array of the group pivot point */
|
|
71
|
-
origin: ArrayVector3
|
|
72
|
-
/**Array of the group rotation */
|
|
73
|
-
rotation: ArrayVector3
|
|
74
|
-
/**If a bone, whether to reset the informations of inherited bones in bedrock edition. */
|
|
75
|
-
reset: boolean
|
|
76
|
-
/**Whether to shade the contents of the group */
|
|
77
|
-
shade: boolean
|
|
78
|
-
/**Whether the group is selected */
|
|
79
|
-
selected: boolean
|
|
80
|
-
/**Whether the group is visible */
|
|
81
|
-
visibility: boolean
|
|
82
|
-
/**Whether to export the entire group */
|
|
83
|
-
export: boolean
|
|
84
|
-
/**Auto UV setting for the children. Can be 0, 1 or 2. */
|
|
85
|
-
autouv: 0 | 1 | 2
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
declare class Group extends OutlinerNode {
|
|
89
|
-
constructor (options: Partial<GroupOptions>)
|
|
90
|
-
static selected: Group
|
|
91
|
-
static all: Group[]
|
|
92
|
-
|
|
93
|
-
name: string
|
|
94
|
-
children: OutlinerNode[]
|
|
95
|
-
origin: ArrayVector3
|
|
96
|
-
rotation: ArrayVector3
|
|
97
|
-
reset: boolean
|
|
98
|
-
shade: boolean
|
|
99
|
-
selected: boolean
|
|
100
|
-
visibility: boolean
|
|
101
|
-
autouv: 1 | 2 | 3
|
|
102
|
-
isOpen: boolean
|
|
103
|
-
ik_enabled: boolean
|
|
104
|
-
ik_chain_length: number
|
|
105
|
-
|
|
106
|
-
extend: (options: Partial<GroupOptions>) => this
|
|
107
|
-
selectChildren: (event: Event) => this
|
|
108
|
-
selectLow: (highlight: boolean) => this
|
|
109
|
-
unselect: () => this
|
|
110
|
-
matchesSelection: () => boolean
|
|
111
|
-
/**
|
|
112
|
-
* Opens theOpens the group and all of its ancestor groups.
|
|
113
|
-
*/
|
|
114
|
-
openUp: () => this
|
|
115
|
-
/**
|
|
116
|
-
* Removes the group
|
|
117
|
-
* @param undo If true, an undo point will be created.
|
|
118
|
-
*/
|
|
119
|
-
remove: (undo?: boolean) => this
|
|
120
|
-
/**
|
|
121
|
-
* Remove the group and leave all of its children in the parent array.
|
|
122
|
-
*/
|
|
123
|
-
resolve: () => OutlinerNode[]
|
|
124
|
-
/**
|
|
125
|
-
* Move the origin of a bone to a specific location without visually affecting the position of it's content.
|
|
126
|
-
*/
|
|
127
|
-
transferOrigin: (origin: ArrayVector3) => this
|
|
128
|
-
/**
|
|
129
|
-
* Sort the content of the group alphabetically. This will automatically create an undo point.
|
|
130
|
-
*/
|
|
131
|
-
sortContent: () => this
|
|
132
|
-
/**
|
|
133
|
-
* Duplicate the group
|
|
134
|
-
*/
|
|
135
|
-
duplicate: () => Group
|
|
136
|
-
getSaveCopy: () => object
|
|
137
|
-
getChildlessCopy: () => Group
|
|
138
|
-
compile: (undo: boolean) => object
|
|
139
|
-
forEachChild(callback: (object: OutlinerNode) => void, type?: any, for_self?: boolean)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
75
|
interface LocatorOptions {
|
|
144
76
|
name: string
|
|
145
77
|
from: ArrayVector3
|
|
@@ -154,6 +86,10 @@ declare class Locator extends OutlinerElement {
|
|
|
154
86
|
|
|
155
87
|
static all: Locator[]
|
|
156
88
|
static selected: Locator[]
|
|
89
|
+
/**Check if any elements of the type are in the project */
|
|
90
|
+
static hasAny: () => boolean
|
|
91
|
+
/**Check if any elements of the type are currently selected */
|
|
92
|
+
static hasSelected: () => boolean
|
|
157
93
|
}
|
|
158
94
|
|
|
159
95
|
|
|
@@ -176,6 +112,10 @@ declare class NullObject extends OutlinerElement {
|
|
|
176
112
|
|
|
177
113
|
static all: NullObject[]
|
|
178
114
|
static selected: NullObject[]
|
|
115
|
+
/**Check if any elements of the type are in the project */
|
|
116
|
+
static hasAny: () => boolean
|
|
117
|
+
/**Check if any elements of the type are currently selected */
|
|
118
|
+
static hasSelected: () => boolean
|
|
179
119
|
}
|
|
180
120
|
|
|
181
121
|
|
package/types/painter.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A global namespace containing various functionality for Blockbench's 2D and 3D paint tools and texture editor
|
|
3
|
+
*/
|
|
2
4
|
declare namespace Painter {
|
|
3
5
|
const currentPixel: ArrayVector2
|
|
4
6
|
const brushChanges: boolean
|
|
@@ -9,9 +11,9 @@ declare namespace Painter {
|
|
|
9
11
|
const erase_mode: boolean
|
|
10
12
|
const default_brush_presets: object[]
|
|
11
13
|
|
|
12
|
-
function edit(texture: Texture, callback: (canvas: HTMLCanvasElement) => void, options: TextureEditOptions)
|
|
13
|
-
function setAlphaMatrix(texture: Texture, x, y, val)
|
|
14
|
-
function getAlphaMatrix(texture: Texture, x, y)
|
|
14
|
+
function edit(texture: Texture, callback: (canvas: HTMLCanvasElement) => void, options: TextureEditOptions): void
|
|
15
|
+
function setAlphaMatrix(texture: Texture, x: number, y: number, val: number): void
|
|
16
|
+
function getAlphaMatrix(texture: Texture, x: number, y: number): number
|
|
15
17
|
|
|
16
18
|
function combineColors(base: RGBAColor, added: RGBAColor, opacity: number): RGBAColor
|
|
17
19
|
function blendColors(base: RGBAColor, added: RGBAColor, opacity: number, blend_mode: string): RGBAColor
|
package/types/panel.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
type PanelSlot = 'left_bar' | 'right_bar' | 'top' | 'bottom' | 'float'
|
|
2
|
+
|
|
1
3
|
interface PanelOptions {
|
|
2
4
|
id: string
|
|
3
5
|
name: string
|
|
@@ -10,9 +12,9 @@ interface PanelOptions {
|
|
|
10
12
|
expand_button: boolean
|
|
11
13
|
toolbars: {
|
|
12
14
|
[id: string]: Toolbar
|
|
13
|
-
}
|
|
15
|
+
} | Toolbar[]
|
|
14
16
|
default_position: {
|
|
15
|
-
slot:
|
|
17
|
+
slot: PanelSlot
|
|
16
18
|
float_position: [number, number]
|
|
17
19
|
float_size: [number, number]
|
|
18
20
|
height: number
|
|
@@ -22,30 +24,43 @@ interface PanelOptions {
|
|
|
22
24
|
default_side: 'right' | 'left'
|
|
23
25
|
insert_before: string
|
|
24
26
|
insert_after: string
|
|
25
|
-
onResize
|
|
26
|
-
onFold
|
|
27
|
+
onResize(): void
|
|
28
|
+
onFold(): void
|
|
27
29
|
}
|
|
28
30
|
type PanelEvent = 'drag' | 'fold' | 'change_zindex' | 'move_to' | 'moved_to' | 'update'
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Panels are interface sections in Blockbench, that are always visible (in a specific format and mode), and can be added to the sidebars, above or below the 3D viewport, or used as free floating above the UI. Examples are the Outliner or the UV editor.
|
|
34
|
+
*/
|
|
30
35
|
declare class Panel {
|
|
31
36
|
constructor (id: string, options: PanelOptions)
|
|
32
37
|
constructor (options: PanelOptions)
|
|
33
38
|
isVisible(): boolean
|
|
34
39
|
isInSidebar(): boolean
|
|
35
|
-
slot:
|
|
40
|
+
slot: PanelSlot
|
|
36
41
|
folded: boolean
|
|
42
|
+
inside_vue: Vue
|
|
43
|
+
|
|
44
|
+
|
|
37
45
|
fold(state?: boolean): this
|
|
38
46
|
/**
|
|
39
47
|
* If the panel is floating, move it up to the front
|
|
40
48
|
*/
|
|
41
49
|
moveToFront(): this
|
|
42
|
-
moveTo(slot:
|
|
50
|
+
moveTo(slot: PanelSlot, ref_panel?: Panel, before?: boolean): this
|
|
43
51
|
update(dragging?: boolean): this
|
|
44
52
|
dispatchEvent(event_name: PanelEvent, data?: any): void
|
|
45
53
|
/**
|
|
46
54
|
* Add an event listener
|
|
47
55
|
*/
|
|
48
56
|
on(event_name: PanelEvent, callback: (data?) => void): void
|
|
57
|
+
/**
|
|
58
|
+
* Adds a single-use event listener
|
|
59
|
+
*/
|
|
60
|
+
once(event_name: PanelEvent, callback: (data?) => void): void
|
|
61
|
+
/**
|
|
62
|
+
* Removes an event listener
|
|
63
|
+
*/
|
|
49
64
|
removeListener(event_name: PanelEvent, callback: (data?) => void): void
|
|
50
65
|
delete(): void
|
|
51
66
|
}
|
package/types/plugin.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ interface PluginOptions {
|
|
|
30
30
|
* Set to true if the plugin must finish loading before a project is opened, i. e. because it adds a format
|
|
31
31
|
*/
|
|
32
32
|
await_loading?: string
|
|
33
|
+
/**
|
|
34
|
+
* Use the new repository format where plugin, iron, and about are stored in a separate folder
|
|
35
|
+
*/
|
|
36
|
+
new_repository_format?: boolean
|
|
33
37
|
/**
|
|
34
38
|
* Runs when the plugin loads
|
|
35
39
|
*/
|
|
@@ -47,6 +51,10 @@ interface PluginOptions {
|
|
|
47
51
|
*/
|
|
48
52
|
onuninstall?(): void
|
|
49
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A Blockbench plugin. "BBPlugin" is the Typescript alias to the regular name "Plugin", which is also valid in Javascript projects.
|
|
57
|
+
*/
|
|
50
58
|
declare class BBPlugin {
|
|
51
59
|
constructor(id: string, options: PluginOptions)
|
|
52
60
|
|
package/types/preview.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ type RaycastResult = {
|
|
|
23
23
|
keyframe: Keyframe
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Previews are 3D viewports, that can either be used as a viewport for the user, or as an offscreen view to record media.
|
|
28
|
+
*/
|
|
26
29
|
declare class Preview extends Deletable {
|
|
27
30
|
constructor(options: PreviewOptions)
|
|
28
31
|
|
package/types/project.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ interface ModelProjectOptions {
|
|
|
2
2
|
format: ModelFormat
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A project instance. The tab bar can be used to switch between projects.
|
|
7
|
+
*/
|
|
5
8
|
declare class ModelProject {
|
|
6
9
|
constructor(options: ModelProjectOptions)
|
|
7
10
|
|
|
@@ -82,13 +85,19 @@ declare class ModelProject {
|
|
|
82
85
|
static all: ModelProject[]
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Global variable and shortcut to get the currently opened project. If no project is open, or the New Tab is open, this value is falsy.
|
|
90
|
+
*/
|
|
91
|
+
declare const Project: ModelProject | 0
|
|
86
92
|
|
|
87
93
|
declare function setupProject(format: ModelFormat | string): boolean;
|
|
88
94
|
declare function newProject(format: ModelFormat | string): boolean;
|
|
89
95
|
declare function setProjectResolution(width: number, height: number, modify_uv?: boolean): void;
|
|
90
96
|
declare function updateProjectResolution(): void;
|
|
91
97
|
|
|
98
|
+
/**
|
|
99
|
+
* An edit session instance. Edit sessions can be attached to a project to collaborate on it with multiple users via P2P connections.
|
|
100
|
+
*/
|
|
92
101
|
declare class EditSession {
|
|
93
102
|
constructor()
|
|
94
103
|
|
package/types/screencam.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ interface RecordTimelapseOptions {
|
|
|
28
28
|
}
|
|
29
29
|
type ScreenshotReturn = (dataURL: string) => void
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A global namespace handling screenshot and GIF recording utilities.
|
|
33
|
+
*/
|
|
31
34
|
declare namespace Screencam {
|
|
32
35
|
/**
|
|
33
36
|
* Provided preview with anti aliasing disabled that can be used for screenshots
|
|
@@ -48,6 +51,11 @@ declare namespace Screencam {
|
|
|
48
51
|
|
|
49
52
|
function returnScreenshot(dataUrl, cb: ScreenshotReturn, blob): void
|
|
50
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Runs callback in a clean canvas, where only the model is visible and the control gizmos are hidden
|
|
56
|
+
* @param options
|
|
57
|
+
* @param cb
|
|
58
|
+
*/
|
|
51
59
|
function cleanCanvas(options, cb: ScreenshotReturn): void
|
|
52
60
|
|
|
53
61
|
function createGif(options: RecordGIFOptions, cb: ScreenshotReturn): void
|
package/types/settings.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
declare const settings: {
|
|
2
|
-
[id: string]: Setting
|
|
3
|
-
};
|
|
4
|
-
|
|
5
1
|
interface SettingOptions {
|
|
6
2
|
name: string
|
|
7
3
|
type?: 'number' | 'string' | 'boolean' | 'password' | 'select' | 'click'
|
|
8
4
|
value: boolean | number | string
|
|
9
|
-
condition?:
|
|
5
|
+
condition?: ConditionResolvable
|
|
10
6
|
category: string
|
|
11
7
|
description?: string
|
|
12
8
|
//launch_setting?: boolean
|
|
@@ -14,38 +10,90 @@ interface SettingOptions {
|
|
|
14
10
|
max?: number
|
|
15
11
|
step?: number
|
|
16
12
|
icon?: string
|
|
17
|
-
click
|
|
13
|
+
click?(): void
|
|
18
14
|
options?: {
|
|
19
15
|
[id: string]: string
|
|
20
16
|
}
|
|
21
17
|
onChange?: (value: any) => void
|
|
22
18
|
}
|
|
23
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Settings can be used to add global configuration options to Blockbench. All settings are listed under File > Preferences > Settings.
|
|
22
|
+
*/
|
|
24
23
|
declare class Setting extends Deletable {
|
|
25
24
|
constructor(id: string, options: SettingOptions);
|
|
26
25
|
|
|
26
|
+
id: string
|
|
27
|
+
type: string
|
|
28
|
+
condition: any
|
|
29
|
+
/**
|
|
30
|
+
* The master value, not affected by profiles
|
|
31
|
+
*/
|
|
32
|
+
master_value: any
|
|
33
|
+
/**
|
|
34
|
+
* The active value
|
|
35
|
+
*/
|
|
36
|
+
value: any
|
|
37
|
+
/**
|
|
38
|
+
* The value that is displayed in the settings dialog
|
|
39
|
+
*/
|
|
40
|
+
ui_value: any
|
|
41
|
+
name: string
|
|
42
|
+
description: string
|
|
43
|
+
category: string
|
|
44
|
+
/**
|
|
45
|
+
* If true, the setting can be used by the main process before initializing the Blockbench window. This is not available to custom settings created by plugins.
|
|
46
|
+
*/
|
|
47
|
+
launch_setting: boolean
|
|
48
|
+
min?: number
|
|
49
|
+
max?: number
|
|
50
|
+
step?: number
|
|
51
|
+
icon?: string
|
|
52
|
+
options?: {
|
|
53
|
+
[id: string]: string
|
|
54
|
+
}
|
|
55
|
+
hidden?: boolean
|
|
56
|
+
onChange?: () => {}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Sets the value of the setting, while triggering the onChange function if available, and saving the change.
|
|
60
|
+
*/
|
|
61
|
+
set(value): void
|
|
62
|
+
/**
|
|
63
|
+
* Triggers the setting, as if selected in action control. This toggles boolean settings, opens a dialog for string or numeric settings, etc.
|
|
64
|
+
*/
|
|
65
|
+
trigger(event?: Event): void
|
|
66
|
+
|
|
67
|
+
|
|
27
68
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Global namespace handling data and functionality related to settings.
|
|
71
|
+
*/
|
|
72
|
+
declare namespace Settings {
|
|
73
|
+
const structure: {};
|
|
74
|
+
const stored: {};
|
|
31
75
|
/**
|
|
32
76
|
* Opens the settings dialog
|
|
33
77
|
* @param options
|
|
34
78
|
*/
|
|
35
|
-
open(options?: Partial<{
|
|
79
|
+
function open(options?: Partial<{
|
|
36
80
|
search: string
|
|
37
81
|
tab: 'setting' | 'keybindings' | 'layout_settings' | 'credits'
|
|
38
82
|
}>): void;
|
|
39
83
|
/**
|
|
40
84
|
* Save all settings to the local storage
|
|
41
85
|
*/
|
|
42
|
-
saveLocalStorages(): void;
|
|
86
|
+
function saveLocalStorages(): void;
|
|
43
87
|
/**
|
|
44
88
|
* Save the settings and apply changes
|
|
45
89
|
*/
|
|
46
|
-
save(): void;
|
|
90
|
+
function save(): void;
|
|
47
91
|
/**
|
|
48
92
|
* Returns the value of the specified setting
|
|
49
93
|
*/
|
|
50
|
-
get(setting_id: string): any;
|
|
94
|
+
function get(setting_id: string): any;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare const settings: {
|
|
98
|
+
[id: string]: Setting
|
|
51
99
|
};
|
package/types/textures.d.ts
CHANGED
|
@@ -38,12 +38,61 @@ interface TextureEditOptions {
|
|
|
38
38
|
no_undo_finish?: boolean
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* A texture combines the functionality of material, texture, and image, in one. Textures can be linked to files on the local hard drive, or hold the information in RAM.
|
|
43
|
+
*/
|
|
41
44
|
declare class Texture {
|
|
42
45
|
constructor(data: TextureData, uuid?: string);
|
|
43
46
|
readonly frameCount: number | undefined;
|
|
44
47
|
readonly display_height: number;
|
|
45
48
|
readonly ratio: number;
|
|
46
49
|
|
|
50
|
+
path: string
|
|
51
|
+
name: string
|
|
52
|
+
/** Relative path to the file's directory, used by some formats such as Java Block/Item*/
|
|
53
|
+
folder: string
|
|
54
|
+
namespace: string
|
|
55
|
+
/** Texture ID or key, used by some formats. By default this is a number that increases with every texture that is added */
|
|
56
|
+
id: string
|
|
57
|
+
/** Whether the texture is used for the models particle system. Used by some formats such as Java Block/Item */
|
|
58
|
+
particle: boolean
|
|
59
|
+
render_mode: 'default' | 'emissive' | 'additive' | 'layered' | string
|
|
60
|
+
render_sides: 'auto' | 'front' | 'double' | string
|
|
61
|
+
|
|
62
|
+
/** Texture animation frame time */
|
|
63
|
+
frame_time: number
|
|
64
|
+
frame_order_type: 'custom' | 'loop' | 'backwards' | 'back_and_forth'
|
|
65
|
+
/** Custom frame order */
|
|
66
|
+
frame_order: string
|
|
67
|
+
/** Interpolate between frames */
|
|
68
|
+
frame_interpolate: boolean
|
|
69
|
+
|
|
70
|
+
/** HTML-style source of the texture's displayed data. Can be a path (desktop app only), or a base64 data URL */
|
|
71
|
+
source: string
|
|
72
|
+
selected: boolean
|
|
73
|
+
show_icon: boolean
|
|
74
|
+
error: number
|
|
75
|
+
/** Whether the texture is visible. Used for layered textures mode */
|
|
76
|
+
visible: boolean
|
|
77
|
+
/** Whether the texture canvas is displayed in the UV/2D editor, for live feedback */
|
|
78
|
+
display_canvas: boolean
|
|
79
|
+
width: number
|
|
80
|
+
height: number
|
|
81
|
+
currentFrame: number
|
|
82
|
+
saved: boolean
|
|
83
|
+
/** Whether the latest version of the texture is currently loaded from and linked to a file on disk, or held in memory as bitmap data */
|
|
84
|
+
mode: 'link' | 'bitmap'
|
|
85
|
+
uuid: UUID
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The texture's associated canvas. Note: This may not always be up to date with the texture data
|
|
89
|
+
*/
|
|
90
|
+
canvas: HTMLCanvasElement
|
|
91
|
+
/**
|
|
92
|
+
* Texture image element
|
|
93
|
+
*/
|
|
94
|
+
img: HTMLImageElement
|
|
95
|
+
|
|
47
96
|
getErrorMessage(): string;
|
|
48
97
|
extend(data: TextureData): this;
|
|
49
98
|
/**
|
|
@@ -80,7 +129,7 @@ declare class Texture {
|
|
|
80
129
|
* Adds texture to the textures list and initializes it
|
|
81
130
|
* @param undo If true, an undo point is created
|
|
82
131
|
*/
|
|
83
|
-
add(undo?: boolean):
|
|
132
|
+
add(undo?: boolean): Texture;
|
|
84
133
|
/**
|
|
85
134
|
* Removes the texture
|
|
86
135
|
* @param no_update If true, the texture is silently removed. The interface is not updated, no undo point is created
|
|
@@ -126,7 +175,7 @@ declare class Texture {
|
|
|
126
175
|
menu: Menu
|
|
127
176
|
|
|
128
177
|
static all: Texture[]
|
|
129
|
-
static getDefault
|
|
178
|
+
static getDefault(): Texture
|
|
130
179
|
}
|
|
131
180
|
/**
|
|
132
181
|
* Saves all textures
|
package/types/timeline.d.ts
CHANGED
package/types/undo.d.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
interface UndoAspects {
|
|
2
2
|
selection?: boolean
|
|
3
3
|
elements?: OutlinerElement[]
|
|
4
|
+
/**
|
|
5
|
+
* Saves the entire outliner structure and hierarchy, including all groups. This is required when adding, or removing any elements, or changing their position in the outliner.
|
|
6
|
+
*/
|
|
4
7
|
outliner?: boolean
|
|
8
|
+
/**
|
|
9
|
+
* Saves an individual group, but not it's children or hierarchy position
|
|
10
|
+
*/
|
|
5
11
|
group?: Group
|
|
12
|
+
/**
|
|
13
|
+
* Textures to save
|
|
14
|
+
*/
|
|
6
15
|
textures?: Texture[]
|
|
7
16
|
texture_order?: boolean
|
|
17
|
+
/**
|
|
18
|
+
* Save which texture is selected
|
|
19
|
+
*/
|
|
8
20
|
selected_texture?: boolean
|
|
9
21
|
settings?: {}
|
|
10
22
|
uv_mode?: boolean
|
|
11
23
|
animations?: Animation[]
|
|
24
|
+
animation_controllers?: AnimationController[]
|
|
12
25
|
keyframes?: Keyframe[]
|
|
13
26
|
display_slots?: string[]
|
|
14
27
|
exploded_view?: boolean
|
|
@@ -42,11 +55,11 @@ type UndoEntry = {
|
|
|
42
55
|
}
|
|
43
56
|
interface AmendEditForm {
|
|
44
57
|
condition?: ConditionResolvable
|
|
45
|
-
type?: 'number'
|
|
58
|
+
type?: 'number' | 'checkbox'
|
|
46
59
|
label: string
|
|
47
60
|
interval_type: 'position' | 'rotation'
|
|
48
61
|
getInterval?: (Event) => number
|
|
49
|
-
value?: number | string,
|
|
62
|
+
value?: number | string | 'boolean',
|
|
50
63
|
min?: number,
|
|
51
64
|
max?: number,
|
|
52
65
|
step?: number,
|
|
@@ -58,17 +71,12 @@ declare class UndoSystem {
|
|
|
58
71
|
* Starts an edit to the current project by saving the state of the provided aspects
|
|
59
72
|
* @param aspects Aspects to save
|
|
60
73
|
*/
|
|
61
|
-
initEdit(aspects: UndoAspects):
|
|
74
|
+
initEdit(aspects: UndoAspects): UndoEntry;
|
|
62
75
|
/**
|
|
63
76
|
* Finishes an edit by saving the state of the project after it was changed
|
|
64
77
|
* @param action Description of the edit
|
|
65
78
|
*/
|
|
66
|
-
finishEdit(action: string, aspects?: UndoAspects):
|
|
67
|
-
before: any;
|
|
68
|
-
post: any;
|
|
69
|
-
action: any;
|
|
70
|
-
time: number;
|
|
71
|
-
};
|
|
79
|
+
finishEdit(action: string, aspects?: UndoAspects): UndoEntry;
|
|
72
80
|
/**
|
|
73
81
|
* Cancels an event before it was finished and reset the project to the state before
|
|
74
82
|
*/
|
|
@@ -104,6 +112,18 @@ declare class UndoSystem {
|
|
|
104
112
|
loadSave(save: UndoSave, reference: UndoSave, mode?: 'session'): void;
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
107
|
-
* Blockbench's system to register edits to the project and switch between them
|
|
115
|
+
* Blockbench's undo system of the current project to register edits to the project and switch between them
|
|
116
|
+
|
|
117
|
+
## Example
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
Undo.initEdit({elements: []});
|
|
121
|
+
|
|
122
|
+
var new_cube = new Cube({name: 'kevin'}).init();
|
|
123
|
+
var other_cube = new Cube({name: 'lars'}).init();
|
|
124
|
+
|
|
125
|
+
Undo.finishEdit('add new cubes', {elements: [new_cube, other_cube]});
|
|
126
|
+
```
|
|
108
127
|
*/
|
|
109
128
|
declare let Undo: UndoSystem;
|
|
129
|
+
|