blockbench-types 5.1.0-beta.3-next.2 → 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.
@@ -4,7 +4,6 @@
4
4
  /// <reference types="@types/jquery" />
5
5
  /// <reference types="wintersky" />
6
6
 
7
- /// <reference types="./texture_layers" />
8
7
  /// <reference types="./texture_group" />
9
8
  /// <reference types="./toolbars" />
10
9
  /// <reference types="./animation" />
@@ -45,7 +44,6 @@
45
44
  /// <reference types="./io" />
46
45
  /// <reference types="./native_apis" />
47
46
  /// <reference types="./util/VersionUtil" />
48
- /// <reference types="./start_screen" />
49
47
 
50
48
  /**
51
49
  * Provides access to global Javascript/DOM variables that are overwritten by Blockbench's own variables
@@ -1,6 +1,7 @@
1
1
  declare global {
2
2
  namespace Clipbench {
3
3
  let elements: any[];
4
+ let layer: any;
4
5
  enum types {
5
6
  text = 'text',
6
7
  display_slot = 'display_slot',
@@ -1,15 +1,3 @@
1
-
2
- declare function updateRecentProjects(): void
3
- declare function addRecentProject(data: any): void
4
- declare function updateRecentProjectData(): void
5
- declare function updateRecentProjectThumbnail(): Promise<void>
6
- declare function loadDataFromModelMemory(): void
7
- declare function changeImageEditor(texture: any, from_settings: any): void
8
- declare function openDefaultTexturePath(): void
9
-
10
- declare function createBackup(init: any): void
11
- declare function closeBlockbenchWindow(): any
12
-
13
1
  type ScopedFS = Pick<typeof import("node:fs"),
14
2
  "copyFile" |
15
3
  "copyFileSync" |
@@ -34,4 +34,5 @@ declare class EditSession {
34
34
  sendChat(text?: string): void
35
35
  addChatMessage(message: any): any
36
36
  processChatMessage(data: any): void
37
+ static token?: string
37
38
  }
@@ -50,6 +50,9 @@ declare global {
50
50
  interface Number {
51
51
  toDigitString(digits: number): string
52
52
  }
53
+ interface String {
54
+ hashCode(): number
55
+ }
53
56
  interface Event {
54
57
  readonly ctrlOrCmd: boolean
55
58
  }
@@ -157,6 +160,17 @@ declare global {
157
160
  V3_divide(values: ArrayVector3): ArrayVector3
158
161
  V3_divide(value: THREE.Vector3): ArrayVector3
159
162
  V3_toThree(): THREE.Vector3
163
+
164
+ V2_set(x: number, y: number): ArrayVector2
165
+ V2_set(values: ArrayVector2): ArrayVector2
166
+ V2_add(x: number, y: number): ArrayVector2
167
+ V2_add(values: ArrayVector2): ArrayVector2
168
+ V2_subtract(x: number, y: number): ArrayVector2
169
+ V2_subtract(values: ArrayVector2): ArrayVector2
170
+ V2_multiply(x: number, y: number): ArrayVector2
171
+ V2_multiply(values: ArrayVector2): ArrayVector2
172
+ V2_divide(x: number, y: number): ArrayVector2
173
+ V2_divide(values: ArrayVector2): ArrayVector2
160
174
  }
161
175
 
162
176
  interface Event {
@@ -14,6 +14,7 @@ declare namespace Interface {
14
14
  quad_view_x: number
15
15
  quad_view_y: number
16
16
  timeline_head: number
17
+ start_screen_width: number
17
18
  left_bar: string[]
18
19
  right_bar: string[]
19
20
  }
@@ -35,6 +36,8 @@ declare namespace Interface {
35
36
  top: ResizeLine
36
37
  bottom: ResizeLine
37
38
  timeline_head: ResizeLine
39
+ start_screen_width: ResizeLine
40
+ [id: string]: ResizeLine
38
41
  }
39
42
  const status_bar: {
40
43
  menu: Menu
@@ -51,6 +54,8 @@ declare namespace Interface {
51
54
  function addSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
52
55
  function removeSuggestedModifierKey(key: 'ctrl' | 'shift' | 'alt', text: string): void
53
56
 
57
+ function definePanels(callback: () => void): void
58
+
54
59
  const center_screen: HTMLElement
55
60
  const page_wrapper: HTMLElement
56
61
  const preview: HTMLElement
package/custom/io.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare global {
2
2
  function setupDragHandlers(): void;
3
- function loadModelFile(file: any, args: any): void;
4
- function loadImages(files: any, event: any): Promise<void>;
3
+ function loadModelFile(file: any, args?: any): void;
4
+ function loadImages(files: any, event?: Event): Promise<void>;
5
5
  function unsupportedFileFormatMessage(file_name: string): void;
6
6
  namespace Extruder {
7
7
  function drawImage(file: any): void;
package/custom/menu.d.ts CHANGED
@@ -58,7 +58,7 @@ declare class Menu extends Deletable {
58
58
  * @param action Action to add
59
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
60
  */
61
- addAction(action: Action | CustomMenuItem, path?: string | number): void
61
+ addAction(action: Action | CustomMenuItem | '_', path?: string | number): void
62
62
  /**
63
63
  *
64
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.
@@ -98,6 +98,7 @@ declare class BarMenu extends Menu {
98
98
  }
99
99
 
100
100
  declare namespace MenuBar {
101
+ const mode_switcher_button: null | HTMLDivElement
101
102
  const menus: {
102
103
  file: Menu
103
104
  edit: Menu
package/custom/misc.d.ts CHANGED
@@ -146,7 +146,7 @@ interface BlockbenchEventMap {
146
146
 
147
147
  type BlockbenchEventName = keyof BlockbenchEventMap
148
148
 
149
- type IconString = string
149
+ type IconString = string | HTMLElement
150
150
 
151
151
  declare const osfs: '\\' | '/'
152
152
 
@@ -174,17 +174,6 @@ declare const Pressing: {
174
174
  }
175
175
  }
176
176
 
177
- type RecentProjectData = {
178
- name: string
179
- path: string
180
- icon: string
181
- day: number
182
- favorite: boolean
183
- textures?: string[]
184
- animation_files?: string[]
185
- }
186
- declare const recent_projects: RecentProjectData[]
187
-
188
177
  declare const Prop = {
189
178
  active_panel: string
190
179
  }
@@ -29,8 +29,9 @@ declare namespace Painter {
29
29
  ): RGBAColor
30
30
  function getMirrorElement(element: OutlinerElement, symmetry_axes: number[]): void
31
31
  function updateNslideValues(): void
32
- function getBlendModeCompositeOperation(): string
32
+ function getBlendModeCompositeOperation(blend_mode?: string): string
33
33
  function getCanvas(texture: Texture): HTMLCanvasElement
34
+ function copyCanvas(original_canvas: HTMLCanvasElement): HTMLCanvasElement
34
35
  function scanCanvas(
35
36
  ctx: CanvasRenderingContext2D,
36
37
  x: number,
@@ -81,6 +81,10 @@ declare class Preview extends Deletable {
81
81
 
82
82
  raycast(event: MouseEvent): false | RaycastResult
83
83
  render(): void
84
+ /**
85
+ * Set a size of the preview in pixels. With no arguments, and if the preview node is connected to the DOM, it will adjust to the size of the parent element
86
+ */
87
+ resize(width?: number, height?: number): void
84
88
  setProjectionMode(orthographic: boolean): this
85
89
  setFOV(fov: number): void
86
90
  setLockedAngle(angle: number): this
@@ -97,6 +101,10 @@ declare class Preview extends Deletable {
97
101
  occupyTransformer(): this
98
102
  showContextMenu(event: Event | HTMLElement): this
99
103
  loadBackground(): void
104
+ /**
105
+ * Take a screenshot of the current view of the preview
106
+ */
107
+ screenshot(options: ScreenshotOptions, callback: ScreenshotReturn): void
100
108
 
101
109
  /**
102
110
  * List of all previews
@@ -134,4 +142,6 @@ declare class Preview extends Deletable {
134
142
 
135
143
  declare const DefaultCameraPresets: AnglePreset[]
136
144
 
145
+ declare const MediaPreview: Preview
146
+
137
147
  declare function animate(): void
@@ -3,6 +3,13 @@
3
3
  import type { FSWatcher } from 'fs'
4
4
  import type { ShaderMaterial } from 'three'
5
5
 
6
+ interface FileFormatOptions {
7
+ name: string
8
+ extensions: string[],
9
+ async encode?(texture: Texture): Uint8Array
10
+ async decode?(data: Uint8Array, texture: Texture): void
11
+ }
12
+
6
13
  declare global {
7
14
  interface TextureData {
8
15
  path?: string
@@ -225,7 +232,7 @@ declare global {
225
232
  */
226
233
  load(cb?: () => {}): this
227
234
  fromJavaLink(link: string, path_array: string[]): this
228
- fromFile(file: { name: string; content?: string; path: string }): this
235
+ fromFile(file: { name: string; content?: string; path: string } | FileSystem.FileResult): this
229
236
  fromPath(path: string): this
230
237
  /**
231
238
  * Loads file content **only**.
@@ -386,6 +393,8 @@ declare global {
386
393
  static all: Texture[]
387
394
  static getDefault(): Texture
388
395
  static properties: Record<string, Property<any>>
396
+
397
+ static file_formats: Record<string, FileFormatOptions>
389
398
  }
390
399
  /**
391
400
  * Saves all textures
@@ -210,6 +210,7 @@ declare global {
210
210
  const structure: any
211
211
  function save(): void
212
212
  function reset(): void
213
+ function loadKeymap(id: string, from_start_screen: boolean = false): true | void
213
214
  }
214
215
  class _ToolToolbar extends Toolbar {
215
216
  selected: Tool
package/custom/undo.d.ts CHANGED
@@ -28,6 +28,7 @@ interface UndoAspects {
28
28
  * Set to true to include the image content of the specified textures
29
29
  */
30
30
  bitmap?: boolean
31
+ layers?: TextureLayer[]
31
32
  settings?: {}
32
33
  uv_mode?: boolean
33
34
  animations?: _Animation[]
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface BarItemRegistry {
3
+ mirror_animating: Toggle;
4
+ flip_animation: Action;
5
+ }
6
+ }
7
+ export {};
@@ -34,12 +34,15 @@ export declare const Blockbench: {
34
34
  version: string;
35
35
  operating_system: string;
36
36
  platform: string;
37
+ browser: string;
37
38
  flags: any[];
38
39
  drag_handlers: {};
39
40
  events: {};
40
41
  openTime: Date;
41
42
  setup_successful: null | true;
42
43
  argv: string[];
44
+ queries: Record<string, string | boolean>;
45
+ startup_count: number;
43
46
  /**
44
47
  * @deprecated Use Undo.initEdit and Undo.finishEdit instead
45
48
  */
@@ -117,12 +120,15 @@ declare const global: {
117
120
  version: string;
118
121
  operating_system: string;
119
122
  platform: string;
123
+ browser: string;
120
124
  flags: any[];
121
125
  drag_handlers: {};
122
126
  events: {};
123
127
  openTime: Date;
124
128
  setup_successful: null | true;
125
129
  argv: string[];
130
+ queries: Record<string, string | boolean>;
131
+ startup_count: number;
126
132
  /**
127
133
  * @deprecated Use Undo.initEdit and Undo.finishEdit instead
128
134
  */
@@ -10,7 +10,7 @@ declare global {
10
10
  * The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
11
11
  */
12
12
  export type ResourceID = string | 'texture' | 'minecraft_skin' | 'dev_plugin' | 'animation' | 'animation_particle' | 'animation_audio' | 'theme' | 'model' | 'gltf' | 'obj' | 'preview_background' | 'screenshot' | 'palette';
13
- type ReadType = 'buffer' | 'binary' | 'text' | 'image' | 'none';
13
+ export type ReadType = 'buffer' | 'binary' | 'text' | 'image' | 'none';
14
14
  export interface ReadOptions {
15
15
  readtype?: ReadType | ((file: string) => ReadType);
16
16
  errorbox?: boolean;
@@ -1,13 +1,11 @@
1
- declare global {
2
- function getMtlFace(obj: any, index: any): string | false;
3
- namespace cube_face_normals {
4
- let north: number[];
5
- let east: number[];
6
- let south: number[];
7
- let west: number[];
8
- let up: number[];
9
- let down: number[];
10
- }
1
+ declare var _obj_export: any;
2
+ declare namespace cube_face_normals {
3
+ let north: number[];
4
+ let east: number[];
5
+ let south: number[];
6
+ let west: number[];
7
+ let up: number[];
8
+ let down: number[];
11
9
  }
12
-
10
+ declare var codec: Codec;
13
11
  export {};
@@ -1,6 +1,6 @@
1
1
  import MolangParser from "molangjs";
2
2
  import tinycolor from "tinycolor2";
3
- export declare const BarItems: Record<string, BarItem>;
3
+ export declare const BarItems: any;
4
4
  type SubKeybind = {
5
5
  name: string;
6
6
  keybind?: Keybind;
@@ -580,7 +580,7 @@ declare const global: {
580
580
  structure: {};
581
581
  save(): void;
582
582
  };
583
- BarItems: Record<string, import("./actions").BarItem>;
583
+ BarItems: any;
584
584
  };
585
585
  declare global {
586
586
  type BarItem = import('./actions').BarItem;
@@ -605,6 +605,9 @@ declare global {
605
605
  const BarText: typeof global.BarText;
606
606
  type ColorPicker = import('./actions').ColorPicker;
607
607
  const ColorPicker: typeof global.ColorPicker;
608
- const BarItems: typeof global.BarItems;
608
+ const BarItems: BarItemRegistry;
609
+ interface BarItemRegistry {
610
+ [key: string]: BarItem;
611
+ }
609
612
  }
610
613
  export {};
@@ -1,5 +1,6 @@
1
+ import { Filesystem } from "../file_system";
1
2
  import { EventSystem } from "../util/event_system";
2
- type ReadType = 'buffer' | 'binary' | 'text' | 'image';
3
+ type ReadType = Filesystem.ReadType;
3
4
  export declare enum FormInputType {
4
5
  Text = "text",
5
6
  Password = "password",
@@ -9,6 +9,7 @@ interface ResizeLineOptions {
9
9
  horizontal?: boolean;
10
10
  condition: ConditionResolvable;
11
11
  width?: number;
12
+ parent_element?: HTMLElement;
12
13
  get: (this: ResizeLine) => number;
13
14
  set: (this: ResizeLine, original: number, difference: number) => void;
14
15
  reset?: (this: ResizeLine) => void;
@@ -19,6 +20,7 @@ export interface ResizeLine extends ResizeLineOptions {
19
20
  export declare class ResizeLine implements ResizeLineOptions {
20
21
  before?: number;
21
22
  node: HTMLDivElement;
23
+ parent_element: HTMLElement;
22
24
  constructor(id: string, data: ResizeLineOptions);
23
25
  update(): void;
24
26
  setPosition(data: ResizeLinePositionData): void;
@@ -118,7 +118,9 @@ export declare const Settings: {
118
118
  open: boolean;
119
119
  items: Record<string, Setting>;
120
120
  }>;
121
- stored: Record<string, SettingsValue>;
121
+ stored: Record<string, {
122
+ value: SettingsValue;
123
+ }>;
122
124
  dialog: Dialog | null;
123
125
  addCategory(id: string, data: {
124
126
  name?: string;
@@ -157,7 +159,9 @@ declare const globals: {
157
159
  open: boolean;
158
160
  items: Record<string, import("./settings").Setting>;
159
161
  }>;
160
- stored: Record<string, SettingsValue>;
162
+ stored: Record<string, {
163
+ value: SettingsValue;
164
+ }>;
161
165
  dialog: Dialog | null;
162
166
  addCategory(id: string, data: {
163
167
  name?: string;
@@ -1,47 +1,67 @@
1
- declare global {
1
+ export declare const StartScreen: {
2
+ loaders: {};
3
+ vue: null | (Vue & any);
4
+ open(): void;
5
+ updateThumbnails(model_paths?: string[]): void;
6
+ addSection: typeof addStartScreenSection;
7
+ };
8
+ interface StartScreenTextSegment {
9
+ text: string;
10
+ type?: string;
11
+ list?: string[];
12
+ click?: () => void;
13
+ }
14
+ interface StartScreenFeature {
15
+ image: string;
16
+ title: string;
2
17
  /**
3
- *
4
- * @param {string} id Identifier
5
- * @param {object} data
6
- * @param {object} data.graphic
7
- * @param {'icon'|string} data.graphic.type
8
- * @param {string} [data.graphic.icon]
9
- * @param {string} [data.graphic.source]
10
- * @param {number} [data.graphic.width]
11
- * @param {number} [data.graphic.height]
12
- * @param {number} [data.graphic.aspect_ratio] Section aspect ratio
13
- * @param {string} [data.graphic.description] Markdown string
14
- * @param {string} [data.graphic.text_color]
15
- * @param {Array.<{text: String, {type}: [String], [list]: Array.String, {click}: [Function]}>} data.text
16
- * @param {'vertical'|'horizontal'} data.layout
17
- * @param {Array} data.features
18
- * @param {boolean} data.closable
19
- * @param {Function} data.click
20
- * @param {string} data.color
21
- * @param {string} data.text_color
22
- * @param {boolean} data.last
23
- * @param {string} data.insert_after
24
- * @param {string} data.insert_before
25
- * @returns
18
+ * Markdown supported text
26
19
  */
27
- function addStartScreenSection(id: string, data: {
28
- graphic: {
29
- type: "icon" | string;
30
- icon?: string;
31
- source?: string;
32
- width?: number;
33
- height?: number;
34
- aspect_ratio?: number;
35
- description?: string;
36
- text_color?: string;
37
- };
38
- }): {
39
- delete(): void;
20
+ text: string;
21
+ }
22
+ export interface StartScreenSection {
23
+ graphic?: {
24
+ type: 'icon' | string;
25
+ icon?: string;
26
+ source?: string;
27
+ width?: number;
28
+ height?: number;
29
+ aspect_ratio?: number;
30
+ /**
31
+ * Markdown string
32
+ */
33
+ description?: string;
34
+ text_color?: string;
40
35
  };
41
- namespace StartScreen {
42
- let loaders: {};
43
- function open(): void;
44
- }
36
+ text?: StartScreenTextSegment[];
37
+ layout?: 'vertical' | 'horizontal';
38
+ features?: StartScreenFeature[];
39
+ closable?: boolean;
40
+ click?: Function;
41
+ color?: string;
42
+ text_color?: string;
43
+ last?: boolean;
44
+ insert_after?: string;
45
+ insert_before?: string;
46
+ }
47
+ /**
48
+ * Adds a section to the start screen
49
+ */
50
+ export declare function addStartScreenSection(id: string, data: StartScreenSection): {
51
+ delete(): void;
52
+ };
53
+ declare const global: {
54
+ StartScreen: {
55
+ loaders: {};
56
+ vue: null | (Vue & any);
57
+ open(): void;
58
+ updateThumbnails(model_paths?: string[]): void;
59
+ addSection: typeof import("./start_screen").addStartScreenSection;
60
+ };
61
+ addStartScreenSection: typeof import("./start_screen").addStartScreenSection;
62
+ };
63
+ declare global {
64
+ const StartScreen: typeof global.StartScreen;
65
+ const addStartScreenSection: typeof global.addStartScreenSection;
45
66
  }
46
-
47
67
  export {};
@@ -112,7 +112,7 @@ export declare class ModelProject {
112
112
  get nodes_3d(): Record<UUID, THREE.Object3D>;
113
113
  getDisplayName(with_extension?: boolean): string;
114
114
  getFileExtension(): string;
115
- getProjectMemory(): RecentProjectData;
115
+ getProjectMemory(): import("../desktop").RecentProjectData;
116
116
  getMultiFileRuleset(): MultiFileRuleset | undefined;
117
117
  getUVWidth(texture?: Texture): number;
118
118
  getUVHeight(texture?: Texture): number;
@@ -158,5 +158,13 @@ declare global {
158
158
  const updateTabBarVisibility: typeof global.updateTabBarVisibility;
159
159
  const updateProjectResolution: typeof global.updateProjectResolution;
160
160
  const setStartScreen: typeof global.setStartScreen;
161
+ interface BarItemRegistry {
162
+ project_window: Action;
163
+ close_project: Action;
164
+ duplicate_project: Action;
165
+ convert_project: Action;
166
+ switch_tabs: Action;
167
+ tab_overview: Action;
168
+ }
161
169
  }
162
170
  export {};
@@ -3,6 +3,7 @@ export declare class CanvasFrame {
3
3
  ctx: CanvasRenderingContext2D;
4
4
  constructor();
5
5
  constructor(width: number, height: number);
6
+ constructor(source: HTMLCanvasElement | HTMLImageElement);
6
7
  get width(): number;
7
8
  get height(): number;
8
9
  createCanvas(width: number, height: number): void;
@@ -40,7 +40,7 @@ import "./interface/about";
40
40
  import "./interface/action_control";
41
41
  import "./copy_paste";
42
42
  import "./undo";
43
- import './desktop.js';
43
+ import './desktop.ts';
44
44
  import "./interface/setup_settings";
45
45
  import "./interface/settings_window";
46
46
  import "./edit_sessions";
@@ -1,15 +1,17 @@
1
- declare global {
2
- const ProportionalEdit: {
3
- vertex_weights: {};
4
- config: {
5
- enabled: boolean;
6
- range: number;
7
- falloff: string;
8
- selection: string;
9
- };
10
- calculateWeights(mesh: Mesh): void;
11
- editVertices(mesh: Mesh, per_vertex: (vkey: string, blend: number) => void): void;
1
+ export declare const ProportionalEdit: {
2
+ vertex_weights: {};
3
+ config: {
4
+ enabled: boolean;
5
+ range: number;
6
+ falloff: string;
7
+ selection: string;
12
8
  };
9
+ calculateWeights(mesh: Mesh): void;
10
+ editVertices(mesh: Mesh, per_vertex: (vkey: string, blend: number) => void): void;
11
+ };
12
+ declare global {
13
+ interface BarItemRegistry {
14
+ proportional_editing_range: NumSlider;
15
+ proportional_editing: Toggle;
16
+ }
13
17
  }
14
-
15
- export {};
@@ -58,5 +58,9 @@ declare const global: {
58
58
  };
59
59
  declare global {
60
60
  const MirrorModeling: typeof global.MirrorModeling;
61
+ interface BarItemRegistry {
62
+ mirror_modeling: Toggle;
63
+ apply_mirror_modeling: Action;
64
+ }
61
65
  }
62
66
  export {};
@@ -0,0 +1,11 @@
1
+ declare global {
2
+ interface BarItemRegistry {
3
+ opacity_slider: NumSlider;
4
+ weight_brush: Tool;
5
+ slider_weight_brush_size: NumSlider;
6
+ slider_weight_brush_limit: NumSlider;
7
+ weight_brush_xray: Toggle;
8
+ weight_brush_blend_mode: BarSelect;
9
+ }
10
+ }
11
+ export {};
@@ -0,0 +1,140 @@
1
+ import { Property } from "../util/property";
2
+ interface TextureLayerData {
3
+ name?: string;
4
+ in_limbo?: boolean;
5
+ offset?: ArrayVector2;
6
+ scale?: ArrayVector2;
7
+ width?: number;
8
+ height?: number;
9
+ opacity?: number;
10
+ visible?: boolean;
11
+ blend_mode?: LayerBlendMode;
12
+ image_data?: ImageData;
13
+ data_url?: string;
14
+ }
15
+ type LayerBlendMode = 'default' | 'set_opacity' | 'color' | 'multiply' | 'add' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'difference' | 'alpha_mask';
16
+ /**
17
+ * Texture layers always belong to a texture and represent the layers of the texture. Each layer has its own HTML canvas and canvas context
18
+ */
19
+ export declare class TextureLayer {
20
+ name: string;
21
+ uuid: UUID;
22
+ texture: Texture;
23
+ canvas: HTMLCanvasElement;
24
+ ctx: CanvasRenderingContext2D;
25
+ in_limbo: boolean;
26
+ img: HTMLImageElement;
27
+ menu?: Menu;
28
+ /**
29
+ * Layer offset from the top left corner of the texture to the top left corner of the layer
30
+ */
31
+ offset: ArrayVector2;
32
+ /**
33
+ * Layer scale. This is only used by the layer transform tool and should be applied and reset to 1x1 before doing further changes
34
+ */
35
+ scale: ArrayVector2;
36
+ opacity: number;
37
+ visible: boolean;
38
+ blend_mode: LayerBlendMode;
39
+ static properties: Record<string, Property<any>>;
40
+ constructor(data: TextureLayerData, texture?: Texture, uuid?: UUID);
41
+ get width(): number;
42
+ get height(): number;
43
+ get scaled_width(): number;
44
+ get scaled_height(): number;
45
+ get size(): number[];
46
+ get selected(): boolean;
47
+ extend(data: TextureLayerData): void;
48
+ /**
49
+ * Selects the layer
50
+ */
51
+ select(): void;
52
+ clickSelect(event: any): void;
53
+ showContextMenu(event: MouseEvent): void;
54
+ /**
55
+ * Remove the layer
56
+ * @param undo Create an undo point and update the texture
57
+ */
58
+ remove(undo?: boolean): void;
59
+ getUndoCopy(image_data: boolean): any;
60
+ getSaveCopy(): any;
61
+ /**
62
+ * Set the layer into a limbo state, where clicking Place or clicking next to the layer will place it on the layer below
63
+ */
64
+ setLimbo(): void;
65
+ /**
66
+ * Resolves the limbo state by turning the limbo layer into a full layer, or merging it into the layer below
67
+ * @param keep_separate If true, the layer is kept as a separate layer
68
+ */
69
+ resolveLimbo(keep_separate: boolean): void;
70
+ /**
71
+ * Set the layer size. This resizes the canvas, which discards the layer content
72
+ */
73
+ setSize(width: number, height: number): this;
74
+ /**
75
+ * Toggle layer visibility. This creates an undo point
76
+ */
77
+ toggleVisibility(): this;
78
+ /**
79
+ * Scroll the layer panel list to
80
+ */
81
+ scrollTo(): this;
82
+ /**
83
+ * Add the layer to the associated texture above the previously selected layer, select this layer, and scroll the layer panel list to it
84
+ */
85
+ addForEditing(): this;
86
+ /**
87
+ * Merge this texture onto the texture below
88
+ * @param undo Create an undo entry
89
+ */
90
+ mergeDown(undo?: boolean): void;
91
+ /**
92
+ * Expand the layer to include the listed pixels
93
+ * @param points
94
+ */
95
+ expandTo(...points: ArrayVector2[]): void;
96
+ /**
97
+ * Flip the texture along an axis
98
+ * @param axis Flip axis, where 0 is X and 1 is Y
99
+ * @param undo Create an undo entry
100
+ */
101
+ flip(axis: 0 | 1, undo: boolean): void;
102
+ /**
103
+ * Rotate the layer around itself in 90 degree steps
104
+ * @param angle Angle in degrees
105
+ * @param undo Create an undo entry
106
+ */
107
+ rotate(angle: number, undo: boolean): void;
108
+ /**
109
+ * Centers the layer on the texture
110
+ */
111
+ center(): void;
112
+ /**
113
+ * Open the properties dialog
114
+ */
115
+ propertiesDialog(): void;
116
+ /**
117
+ * Get all layers of the active texture
118
+ */
119
+ static all: TextureLayer[];
120
+ /**
121
+ * Get the selected layer
122
+ */
123
+ static selected: TextureLayer | null;
124
+ }
125
+ declare global {
126
+ interface BarItemRegistry {
127
+ layer_opacity: NumSlider;
128
+ layer_blend_mode: BarSelect;
129
+ selection_tool: Tool;
130
+ create_empty_layer: Action;
131
+ import_layer: Action;
132
+ enable_texture_layers: Action;
133
+ disable_texture_layers: Action;
134
+ layer_to_texture_size: Action;
135
+ merge_layer_down: Action;
136
+ crop_layer_to_selection: Action;
137
+ opacity_slider: NumSlider;
138
+ }
139
+ }
140
+ export {};
@@ -20,5 +20,5 @@ declare const global: {
20
20
  };
21
21
  };
22
22
  declare global {
23
- const StateMemory: typeof global.StateMemory;
23
+ const StateMemory: (typeof global.StateMemory) & Record<string, any>;
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockbench-types",
3
- "version": "5.1.0-beta.3-next.2",
3
+ "version": "5.2.0-beta.0-next.1",
4
4
  "description": "Blockbench typescript types",
5
5
  "main": "",
6
6
  "types": "./index.d.ts",
package/type_config.json CHANGED
@@ -29,7 +29,6 @@
29
29
  "texturing/painter",
30
30
  "texturing/texture_groups",
31
31
  "texturing/textures",
32
- "texturing/layers",
33
32
  "undo",
34
33
  "web",
35
34
  "copy_paste",
@@ -1,15 +0,0 @@
1
- // Temporary file since model loader has been rewritten in ts on a different branch
2
-
3
- declare interface ModelLoaderOptions {
4
- id?: string
5
- icon: string
6
- name?: string
7
- description?: string
8
- category?: string
9
- target?: string | string[]
10
- confidential?: boolean
11
- condition?: ConditionResolvable
12
- format_page?: FormatPage
13
- onFormatPage?(): void
14
- onStart?(): void
15
- }
@@ -1,117 +0,0 @@
1
- /// <reference types="three" />
2
-
3
- interface TextureLayerData {
4
- name?: string
5
- in_limbo?: boolean
6
- offset?: ArrayVector2
7
- scale?: ArrayVector2
8
- opacity?: number
9
- visible?: boolean
10
- blend_mode?: 'default' | 'set_opacity' | 'color' | 'multiply' | 'add' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'difference' | 'alpha_mask'
11
- image_data?: ImageData
12
- data_url?: string
13
- }
14
-
15
- /**
16
- * Texture layers always belong to a texture and represent the layers of the texture. Each layer has its own HTML canvas and canvas context
17
- */
18
- declare class TextureLayer {
19
- constructor(data: TextureLayerData, texture: Texture, uuid?: string)
20
-
21
- name: string
22
- uuid: UUID
23
- texture: Texture
24
- canvas: HTMLCanvasElement
25
- ctx: CanvasRenderingContext2D
26
- in_limbo: boolean
27
- img: HTMLImageElement
28
- /**
29
- * Layer offset from the top left corner of the texture to the top left corner of the layer
30
- */
31
- offset: ArrayVector2
32
- /**
33
- * Layer scale. This is only used by the layer transform tool and should be applied and reset to 1x1 before doing further changes
34
- */
35
- scale: ArrayVector2
36
- opacity: number
37
- visible: boolean
38
- blend_mode: 'default' | 'set_opacity' | 'color' | 'multiply' | 'add' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'difference' | 'alpha_mask'
39
-
40
- extend(data: TextureLayerData): void
41
- /**
42
- * Selects the layer
43
- */
44
- select(): void
45
- showContextMenu(event: Event): void
46
- /**
47
- * Remove the layer
48
- * @param undo Create an undo point and update the texture
49
- */
50
- remove(undo: boolean): void
51
- getUndoCopy(image_data: boolean): object
52
- getSaveCopy(): object
53
- /**
54
- * Set the layer into a limbo state, where clicking Place or clicking next to the layer will place it on the layer below
55
- */
56
- setLimbo(): void
57
- /**
58
- * Resolves the limbo state by turning the limbo layer into a full layer, or merging it into the layer below
59
- * @param keep_separate If true, the layer is kept as a separate layer
60
- */
61
- resolveLimbo(keep_separate: boolean): void
62
- /**
63
- * Set the layer size. This resizes the canvas, which discards the layer content
64
- */
65
- setSize(width: number, height: number): void
66
- /**
67
- * Toggle layer visibility. This creates an undo point
68
- */
69
- toggleVisibility(): void
70
- /**
71
- * Scroll the layer panel list to
72
- */
73
- scrollTo(): void
74
- /**
75
- * Add the layer to the associated texture above the previously selected layer, select this layer, and scroll the layer panel list to it
76
- */
77
- addForEditing(): void
78
- /**
79
- * Merge this texture onto the texture below
80
- * @param undo Create an undo entry
81
- */
82
- mergeDown(undo: boolean): void
83
- /**
84
- * Expand the layer to include the listed pixels
85
- * @param points
86
- */
87
- expandTo(...points: ArrayVector2): void
88
- /**
89
- * Flip the texture along an axis
90
- * @param axis Flip axis, where 0 is X and 1 is Y
91
- * @param undo Create an undo entry
92
- */
93
- flip(axis: number, undo: boolean): void
94
- /**
95
- * Rotate the layer around itself in 90 degree steps
96
- * @param angle Angle in degrees
97
- * @param undo Create an undo entry
98
- */
99
- rotate(angle: number, undo: boolean): void
100
- /**
101
- * Centers the layer on the texture
102
- */
103
- center(): void
104
- /**
105
- * Open the properties dialog
106
- */
107
- propertiesDialog(): void
108
-
109
- /**
110
- * Get all layers of the active texture
111
- */
112
- static all: TextureLayer[]
113
- /**
114
- * Get the selected layer
115
- */
116
- static selected: TextureLayer
117
- }