Textures are saved in the global
textures.selected will return the currently selected texture. If single_texture is enabled in the current format, only one texture can exist at a time.
new Texture( data, uuid )
Creates a new texture
idTexture key used in java edition and OBJ models
folderSubfolder of the textures folder that the texture is in.
namespaceTexture namespace, used for mods
pathFull texture path
particleWhether to use the texture as the particle texture for java edition models
sourceSource string of the texture. Can either be a base64 string or a path. Paths will usually have
?2or similar appended to make them update after being changed.
selectedWhether the texture is selected
show_iconWhether the source of the texture should be displayed in the textures list.
dark_boxIf true, the UV editor will use a dark border for this texture. Calculated from the average color of the texture
errorNumerical error code:
1File error, texture could not be loaded
2Invalid aspect ratio
3Placeholder texture, the actual texture gets defined by the parent model
ratioTexture aspect ratio
frameCountReturns the frame count if the texture is an animated texture
imgHTML Image instance of the texture
savedWhether the texture is saved
modeHow the texture source is handled. Can be
'bitmap'. Link textures are loaded from a path on the computer, so textures in the web app are always mode bitmap.
THREE.JS materials are saved in a separate location to increase performance. You can get the material using the texture's uuid.
Returns the translated error message of the texture.
Texture#extend( data: Object )
Copy properties from
data into the texture.
load( callback: Function )
Loads the texture by updating its source.
callbackfunction to call after the update is finished. The update is asynchronous.
Texture#fromJavaLink( link: String, path_array: Array )
Tries to load the texture from a java edition resource pack using the relative path provided in the model file and the absolute path of the model.
Texture#fromFile( file: String )
Loads the texture from a file object, as used in Blockbench.import.
Texture#fromPath( path: String )
Loads the texture from an absolute path.
Texture#fromDataURL( data_url: String )
Loads the texture from a data URL (base64 encoded image)
Attempts to load the texture from the default resource pack if defined in the Blockbench settings.
Texture#loadEmpty( error_id: Number )
Loads the texture with an empty (error) texture and sets the error code to
Texture#add( undo: Boolean )
Adds the texture to Blockbench and takes care of applying the texture to all cubes if required by the format.
undoWhether to create an undo point for adding the texture.
Texture#generateFolder( path: String )
Generate the java edition texture folder from a given path.
Texture#updateSource( data_url: String )
Updates the source of the texture. This is used if the texture gets edited. Also updates the material and UV Editor view of the texture
Only update the THREE.JS material of the texture.
Texture#reopen( force: Boolean )
Opens a file dialog to replace the texture source with another file.
forceIf true, Blockbench won't show a warning message if the texture has unsaved changes.
Reloads the texture to update changes to the file. This is usually not necessary as the texture updates automatically when there are any changes.
Texture#select( event: Event )
Select this texture.
Texture#remove( no_update: Boolean )
Removes the texture.
no_updateIf true, don't update the interface and don't create an undo point
Marks this texture as particle texture for java edition models.
Marks this texture as particle texture for java edition models, unless there is already a particle texture.
apply( all: Boolean )
Applies the texture to all selected cubes. Creates an undo point.
allWhen true, apply the texture to all faces
Returns the link of the texture as used in java edition block/item models.
Show the source file of the texture in a new Explorer/Finder window.
Open the texture in the preferred image editor as specified in the settings.
Texture#showContextMenu( event )
Show the context menu of the texture using the position of the event.
Opens the texture menu dialog.
Texture#edit( callback: Function, options: Object )
Edits the texture using the callback function.
callback Function to edit the texture. If omitted, the texture will be converted to an editable texture but won't be edited.
Texture#save( as: Boolean )
Saves changes to the texture.
as If true, a file dialog will be opened even if the location of the file is known.
Returns the base64 string of the texture.
Tool to control animated textures.
Updates the playback speed of animated textures.
Sets all animated textures back to frame 0 and stops playing.
Updates whether the animation button displays a play or pause icon.