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
TextureFormatvalues the scenes use.
Structs§
- Atlas
Entry - One entry of an atlas’s
m_RenderDataMap: its key (aGUID’s words and an id) and itsSpriteAtlasData’s texture, alpha texture (null: none), rectangle and settings. - Atlas
Scene - A scene: bundles, the inputs cut (each over its view) and the options.
- CutOptions
- The cutter’s options (
docs/BATCH_SPEC.md1.5), the sheet scopeown_files_by_namebeing 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::Structwhose type is the class’s name, written as the root nodeBase), its bytes cut tocutwhen that is set (a read that runs out), andtrailingzero bytes stored after them (a read that ends before the object does, which UnityPy’scheck_readrefuses). - Scene
Bundle - One bundle of a scene: its spec
id, its bytes and itsdeps. - Sprite
Spec - A Sprite: its name,
textureRectandsettingsRaw,m_PixelsToUnits, its texture’s and alpha texture’s pointers and its mesh.
Enums§
- Build
Error - Why a value has no typetree or no bytes.
- Prop
Name - A
_MainTex-style property name: a plain string, or aFastPropertyNamestruct with aname. - V
- A typed value: its typetree nodes and its bytes (
nodes, [write]).
Functions§
- atlas
- An NGUI atlas: a MonoBehaviour whose
m_Scriptisscript, withmaterial,mSprites(sprites, each shaped as the first or assprite’s),mPixelSize1, andextrafields 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) ofobjects, each with a type record of its own, with the given externals (archive:/CAB-x/CAB-x). Withtype_treesfalse it stores no typetree, so UnityPy reads its objects by the TPK’s. - file_on
- [
file], its target platformplatform(aBuildTargetvalue) when that is set, else the default’s. - material
- A Material (class 21) whose
m_SavedProperties.m_TexEnvsholdsenvs, each a property name and its texture pointer, the names written askind. - material_
tpk - A Material (class 21) of every field of the 2022.3 layout, the one a
stripped Material is read by, its
m_TexEnvsholdingenvs(plain names):material’s value with the keyword lists, flags, tag map, shader passes,m_Intsand texture stacks between, all empty. The fields and their order are UnityPy’s generatedMaterialclass’s (generated.py, MIT); the two flags are aUInt8and an alignedbool, as AssetStudio’sMaterialreader (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 generatedMonoScriptclass (generated.py, MIT) and AssetStudio’sMonoScriptreader (MIT), the layout a stripped one is read by,m_PropertiesHash(aHash128) among them. - nodes
- The typetree rows of the field
nameholdingv, its own row atlevel;BuildError::TooDeepwhen a row would pass level 255. - packed
settingsRawof a packed rectangle Sprite turned byrotation(SpritePackingRotation, bits 2 to 5).- pair
- A
pair. - pixel
- Pixel
(x, y)of a sheet,ycounted from the image’s top (the row orderTexture2D.imagegives, 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 objectwith its fieldnameset tovalue(in place, keeping its position) and renamedrenamewhen 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_dataas Unity stores it, bottom row first, ofpixels: 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.mdsection 5). - sprite_
atlas - A
SpriteAtlasnamedname(none: nom_Namefield, sopeek_namefinds none) ofentries, in order. - sprite_
scenes - Every
spritesscene, by name. - st
- A struct of
ty. - texture
- A
Texture2D(class 28) withdatainline inimage_data, and nom_StreamData(a tree from before 5.3). - texture_
streamed - A
Texture2D(class 28) with an emptyimage_dataand anm_StreamDatanaminglenbytes atoffsetof the resourcepath(empty: no stream). - vector
- A
vectorofitems, each shaped asshape. - write
v’s bytes, in the order and alignmentnodesdescribes; refuses a valuenodesrefuses at level 0, and a length past anint.