Optionaldata: TextureDataOptionaluuid: stringThe texture's associated canvas. Since 4.9, this is the main source of truth for textures in internal mode.
The 2D context of the texture's associated canvas.
Readonlydisplay_Relative path to the file's directory, used by some formats such as Java Block/Item
Interpolate between frames
Custom frame order
Texture animation frame time
ReadonlyframeTexture ID or key, used by some formats. By default this is a number that increases with every texture that is added
Texture image element
If true, the texture is loaded internally. If false, the texture is loaded directly from a file
Optionalload_Set a function that will run once the next time the texture is loaded
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
Use Texture.internal instead
Whether the texture is multi selected
Whether the texture is used for the models particle system. Used by some formats such as Java Block/Item
OptionalpathReadonlyratioOptionalrelative_Whether the texture is directly selected
Texture selection in paint mode
HTML-style source of the texture's displayed data. Can be a path (desktop app only), or a base64 data URL
The UUID of the project to sync the texture to
Whether the texture is visible. Used for layered textures mode
StaticallStatic OptionalselectedOptionalundo: booleanAdds texture to the textures list and initializes it
Optionalundo: booleanIf true, an undo point is created
Optionaluv_size_from_resolution: booleanApplies the texture to the selected elements
Optionalall: boolean | "blank"If true, the texture is applied to all faces of the elements. If 'blank', the texture is only applied to blank faces
Optionaldata_url: stringWrapper to do edits to the texture.
Optionalcallback: (instance: any) => void | HTMLCanvasElementOptionaloptions: TextureEditOptionsEditing options
Enables 'particle' on this texture if it is not enabled on any other texture
Generate the Java Block/Item folder property from the file path
If layers are enabled, returns the active layer, otherwise returns the texture. Either way, the 'canvas', 'ctx', and 'offset' properties can be used from the returned object
Get the selected layer. If no layer is selected, returns the bottom layer
Returns the content of the texture as PNG as a base64 encoded string
Returns the content of the texture as PNG as a base64 encoded data URL
Get the material that the texture displays. When previewing PBR, this will return the shared PBR material
Get the texture's own material
Optionalbitmap: booleanOptionalbitmap: booleanGet the UV height of the texture if the format uses per texture UV size, otherwise get the project texture height
Get the UV width of the texture if the format uses per texture UV size, otherwise get the project texture width
Loads the texture from it's current source
Optionalcb: () => {}Callback function
Loads file content only.
Does not read png.mcmeta, or attempt to overwrite an existing texture in the project with the same name.
Used internally when loading .bbmodel files
Loads the default white error texture
Optionalerror_id: numberSets the error ID of the texture
Opens the texture in the configured image editor
Shows the texture file in the file explorer
Reloads the texture. Only works in the desktop app
Removes the texture
Optionalno_update: booleanIf true, the texture is silently removed. The interface is not updated, no undo point is created
Opens a dialog to replace the texture with another file
If true, no warning appears of the texture has unsaved changes
Optionalas: anyScroll the texture list to this texture
Turns the texture selection into a layer
Optionalundo: booleanWhether to create an undo entry
Optionalclone: booleanWhen true, the selection is copied into the new layer and also left on the original layer
Start listening for changes to the linked file. Desktop only
Stop listening for changes to the linked file. Desktop only
When editing the same texture in different tabs (via Edit In Blockbench option), sync changes that were made to the texture to other projects
Update everything after a content edit to the texture or one of the layers. Updates the material, the layers, marks the texture as unsaved, syncs changes to other projects
Update the attached img element with the content from the texture's canvas
Redraws the texture content from the layers
Optionalupdate_data_url: booleanIf true, the texture source gets updated as well. This is slower, but is necessary at the end of an edit. During an edit, to preview changes, this can be false
Staticget
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.