Skip to main content

Module write

Module write 

Source
Expand description

Raw texture writes, format promotion and mip chains. The converter is export/Texture2DConverter.py:118-234; field edits and mip termination are classes/legacy_patch/Texture2D.py:14-60. The encode feature supplies etcpak and astcenc; without it compressed writes return a typed refusal.

Structs§

Encoded
Inline image bytes and the fields computed by the writer.
Options
Converter options. Platform blobs are preserved verbatim by object writes.
Source
A Pillow image’s tobytes() storage. Integer/float modes use native byte order, 1 uses MSB-first bits with each row rounded up to a byte. Palette entries are RGBA, permitting palette alpha and PA’s separate alpha band.

Enums§

WriteError
Errors leave the installed object data unchanged.

Functions§

astc_context
Compresses standalone U8 RGBA context storage at a legal 2D ASTC footprint.
image_to_texture2d
image_to_texture2d, including repeated BICUBIC mip resizes when requested. Zero sides write empty data for every known target (PARITY 19.1). Tier U gates precede the encoder availability check; no encoder is needed to represent an empty linear texture.
set_image
Update and re-save a Texture2D, propagating changed state to its parents. None or target zero defaults to m_TextureFormat. Absent optional mip, stream and platform fields stay absent, and platform blobs stay unchanged. Failure preserves the object’s previous installed bytes and changed state. Like UnityPy’s ObjectReader, subsequent reads still see the original data. The returned bytes are the exact updated object serialization.