Skip to main content

SpriteError

Enum SpriteError 

Source
#[non_exhaustive]
pub enum SpriteError {
Show 27 variants CropRightLeft, CropLowerUpper, RoundNan, RoundInfinity, DecompressionBomb { pixels: String, }, CIntOverflow { above: bool, }, CLongOverflow, ImageTooWide, SolveCast, Rotation(u64), AlphaSizeMismatch, AlphaBandCount, UnverifiedMode { mode: &'static str, }, NoVertices, Unpack { expected: usize, got: Option<usize>, }, Index { tuple: bool, }, Sprite3d, NoTriangles, NoUv, NegativeSize, NoAtlasData, AtlasUnresolved, Malformed(&'static str), Mesh(MeshError), TooLarge { what: &'static str, }, Charge(ChargeError), Panicked(Payload),
}
Expand description

Why a sprite did not render. Each variant but Self::Malformed, Self::UnverifiedMode, Self::AtlasUnresolved, Self::TooLarge, Self::Charge and Self::Panicked is a case where UnityPy 1.25.2 raises; Self::python gives its exception’s class and message.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CropRightLeft

Pillow’s crop of textureRect: its right edge before its left (ValueError), checked before the lower edge.

§

CropLowerUpper

Its lower edge above its upper (ValueError).

§

RoundNan

round() of a NaN (ValueError).

§

RoundInfinity

round() of an infinity (OverflowError).

§

DecompressionBomb

Pillow’s crop of more than crate::MAX_CROP_PIXELS pixels (DecompressionBombError).

Fields

§pixels: String

The crop’s pixels, exactly, in decimal, as Python counts them.

§

CIntOverflow

A box edge that PyArg_ParseTuple’s i refuses within a C long (OverflowError): past INT_MAX when above, else below INT_MIN.

Fields

§above: bool

Above INT_MAX, else below INT_MIN.

§

CLongOverflow

A box edge past a C long, which PyLong_AsLong refuses before i sees it (OverflowError).

§

ImageTooWide

An image Pillow refuses to make: wider than INT_MAX / 4 - 1 pixels, whatever its height (ImagingNewPrologueSubtype’s MemoryError, which has no message): a crop, its turned size, a mesh’s canvas, a translated triangle’s crop.

§

SolveCast

numpy.linalg.solve of a source corner outside [-2^63, 2^64), which numpy holds in an object array that its solve cannot cast (UFuncTypeError).

§

Rotation(u64)

SpritePackingRotation(n) of 5 to 15 (ValueError).

§

AlphaSizeMismatch

The alpha texture’s decoded size is not the texture’s: Image.merge’s ValueError.

§

AlphaBandCount

A texture of one band (BC4’s L) beside an alpha texture: Image.merge’s ValueError, raised before it compares sizes.

§

UnverifiedMode

A texture, or an alpha texture, whose decoded mode the renderer is not verified on (L), where UnityPy renders it: unityrs’s own refusal (Tier U, PARITY.md section 19.2).

Fields

§mode: &'static str

Pillow’s name for the mode.

§

NoVertices

mask_sprite’s assert positions (AssertionError).

§

Unpack

A tuple unpacked into expected names (ValueError): got fewer, or None for more.

Fields

§expected: usize

The names.

§got: Option<usize>

The tuple’s length, when shorter.

§

Index

An index past a list (IndexError “list index out of range”), or past a tuple when tuple (“tuple index out of range”).

Fields

§tuple: bool

A tuple’s, else a list’s.

§

Sprite3d

render_sprite_mesh: every axis of the vertices varies (ValueError).

§

NoTriangles

render_sprite_mesh: no submesh with vertices (ValueError).

§

NoUv

The standalone mesh renderer was given no UV coordinates.

§

NegativeSize

Image.new of a negative side (ValueError).

§

NoAtlasData

The atlas holds no render data for the sprite’s key: the StopIteration of next() (:78).

§

AtlasUnresolved

The Sprite’s m_SpriteAtlas does not resolve: the caller found no object for it, where UnityPy’s deref_parse_as_object raises its own error (Tier U).

§

Malformed(&'static str)

A field the render reads is missing, or not of the type its typetree gives it, where UnityPy’s behaviour is not characterised (Tier U): named by its path.

§

Mesh(MeshError)

The mesh’s own error (unityrs_meshdecode).

§

TooLarge

A canvas of more than crate::MAX_PIXELS pixels: the bound UnityPy does not have (PARITY.md section 19.3).

Fields

§what: &'static str

What: "canvas", every image the render makes.

§

Charge(ChargeError)

A buffer’s charge or a loop’s work, refused by the caller’s meter.

§

Panicked(Payload)

A panic in the render, caught (crate::contain()).

Implementations§

Source§

impl SpriteError

Source

pub fn python(&self) -> Option<(&'static str, String)>

The class and message of the exception UnityPy raises where this error is returned, or None where it raises none (a bound, a charge, a panic, a Tier U refusal) or the mesh’s error has none.

Trait Implementations§

Source§

impl Debug for SpriteError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SpriteError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SpriteError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ChargeError> for SpriteError

Source§

fn from(source: ChargeError) -> Self

Converts to this type from the input type.
Source§

impl From<DecodeError> for SpriteError

Source§

fn from(e: DecodeError) -> Self

crate::contain()’s errors: a panic, or a charge.

Source§

impl From<MeshError> for SpriteError

Source§

fn from(source: MeshError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.