Skip to main content

Module ngui

Module ngui 

Source
Expand description

NGUI-shaped atlases for the cutter’s reference (tools/parity/ngui_cutter.py, docs/BATCH_SPEC.md section 5): the atlas MonoBehaviour with a typetree, the MonoScript its m_Script names, its Material and the Texture2D sheets, inline or streamed from a .resS, in bundles whose views join them.

Every object is a V, a typed value that gives both its typetree nodes and its little-endian bytes, in the layout UnityPy 1.25.2 reads them by (helpers/TypeTreeHelper.py:182-263): a value whose node is aligned (a bool, a string, TypelessData, every vector here) is followed by zeros up to a multiple of 4, a pair is its first then its second, and a node whose first child is Array is a vector, its count an int. A Material’s m_TexEnvs holds pairs whose first is a string or a FastPropertyName struct with a name, as UnityPy types it either way (classes/generated.py:11477).

A typetree row’s level is a u8, so nodes, [write] and [file] refuse a value deeper than it holds, and a length or count past an int, with a BuildError, before any level is added or any size narrowed. Each file gives each object a type record of its own, so a file mixes shapes freely ([file]). scenes lists the scenes tools/parity/ngui_scenes.py asks cargo for.

Owner: P1b, the NGUI cutter’s reference (docs/plans/extract.md section 3, item 3).

Modules§

format
TextureFormat values the scenes use.

Structs§

AtlasEntry
One entry of an atlas’s m_RenderDataMap: its key (a GUID’s words and an id) and its SpriteAtlasData’s texture, alpha texture (null: none), rectangle and settings.
AtlasScene
A scene: bundles, the inputs cut (each over its view) and the options.
CutOptions
The cutter’s options (docs/BATCH_SPEC.md 1.5), the sheet scope own_files_by_name being version 1’s only one.
Mesh
A Sprite’s mesh: its vertices (each in channel 0), its submeshes (firstByte, indexCount, topology 0) and its indices.
Object
One object: its path id, class id and value (a V::Struct whose type is the class’s name, written as the root node Base), its bytes cut to cut when that is set (a read that runs out), and trailing zero bytes stored after them (a read that ends before the object does, which UnityPy’s check_read refuses).
SceneBundle
One bundle of a scene: its spec id, its bytes and its deps.
SpriteSpec
A Sprite: its name, textureRect and settingsRaw, m_PixelsToUnits, its texture’s and alpha texture’s pointers and its mesh.

Enums§

BuildError
Why a value has no typetree or no bytes.
PropName
A _MainTex-style property name: a plain string, or a FastPropertyName struct with a name.
V
A typed value: its typetree nodes and its bytes (nodes, [write]).

Functions§

atlas
An NGUI atlas: a MonoBehaviour whose m_Script is script, with material, mSprites (sprites, each shaped as the first or as sprite’s), mPixelSize 1, and extra fields after them.
depth
How many levels below its own row v’s rows reach, counted without recursion.
failure_scenes
Every failure scene, by name.
file
A SerializedFile (format 22, little-endian, engine 2022.3.0f1) of objects, each with a type record of its own, with the given externals (archive:/CAB-x/CAB-x). With type_trees false it stores no typetree, so UnityPy reads its objects by the TPK’s.
file_on
[file], its target platform platform (a BuildTarget value) when that is set, else the default’s.
material
A Material (class 21) whose m_SavedProperties.m_TexEnvs holds envs, each a property name and its texture pointer, the names written as kind.
material_tpk
A Material (class 21) of every field of the 2022.3 layout, the one a stripped Material is read by, its m_TexEnvs holding envs (plain names): material’s value with the keyword lists, flags, tag map, shader passes, m_Ints and texture stacks between, all empty. The fields and their order are UnityPy’s generated Material class’s (generated.py, MIT); the two flags are a UInt8 and an aligned bool, as AssetStudio’s Material reader (MIT) reads them.
mono_behaviour
A MonoBehaviour (class 114): the head, then fields.
mono_script
A MonoScript (class 115) of class_name, in no namespace, with the 2022.3 fields of UnityPy’s generated MonoScript class (generated.py, MIT) and AssetStudio’s MonoScript reader (MIT), the layout a stripped one is read by, m_PropertiesHash (a Hash128) among them.
nodes
The typetree rows of the field name holding v, its own row at level; BuildError::TooDeep when a row would pass level 255.
packed
settingsRaw of a packed rectangle Sprite turned by rotation (SpritePackingRotation, bits 2 to 5).
pair
A pair.
pixel
Pixel (x, y) of a sheet, y counted from the image’s top (the row order Texture2D.image gives, after UnityPy’s flip): [base + x + 16 y, 0x40 + x, 0x80 + y, 0xFF - x - y], each byte wrapping, the last left out for RGB24. Every channel of a sheet up to 15 x 15 is distinct from the zeros a crop pads with.
pptr
A pointer to a target.
s
A string value.
scenes
Every scene, by name.
set_field
object with its field name set to value (in place, keeping its position) and renamed rename when that is set; a field it lacks is appended. A scene’s way to give a builder’s object another shape.
sheet
A sheet’s image_data as Unity stores it, bottom row first, of pixels: 4 bytes a pixel, or 3 (rgb).
sprite
An NGUI UISpriteData: name, its rectangle, then the borders and paddings, which the cutter does not apply (docs/BATCH_SPEC.md section 5).
sprite_atlas
A SpriteAtlas named name (none: no m_Name field, so peek_name finds none) of entries, in order.
sprite_scenes
Every sprites scene, by name.
st
A struct of ty.
texture
A Texture2D (class 28) with data inline in image_data, and no m_StreamData (a tree from before 5.3).
texture_streamed
A Texture2D (class 28) with an empty image_data and an m_StreamData naming len bytes at offset of the resource path (empty: no stream).
vector
A vector of items, each shaped as shape.
write
v’s bytes, in the order and alignment nodes describes; refuses a value nodes refuses at level 0, and a length past an int.