Skip to main content

MeshError

Enum MeshError 

Source
#[non_exhaustive]
pub enum MeshError {
Show 20 variants Assertion(&'static str), NoAttribute(&'static str), UnknownMeshType, VersionType(u8), InvalidFormat { format: u8, table: FormatTable, }, UnknownChannel(u64), NoChannels, OutOfBounds, Struct(StructError), Index(IndexKind), Unpack { expected: u8, got: u8, }, StopIteration, Overflow, ByteRange, Topology, Resource(Error), Charge(ChargeError), WrappedAccess, Unsupported(Unsupported), Malformed(String),
}
Expand description

A failure of the mesh handler (module docs).

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.
§

Assertion(&'static str)

AssertionError: one of process’s or get_triangles’s asserts (helpers/MeshHelper.py:113, :119-124, :134, :138, :148, :631-632). The message is the assert’s own, empty for a bare one.

§

NoAttribute(&'static str)

AttributeError: a field read on an UnknownObject, the class UnityPyBoost’s object mode builds when the class named by the node’s type cannot take its fields (PARITY.md section 9.2), that lacks it ('UnknownObject' object has no attribute 'm_Streams').

§

UnknownMeshType

ValueError: the source is neither a Mesh nor a SpriteRenderData, because object mode built it as an UnknownObject (helpers/MeshHelper.py:171-172).

§

VersionType(u8)

ValueError: the version’s type byte is no UnityVersionType, which its first index raises (helpers/UnityVersion.py:41-42, :99-107).

§

InvalidFormat

ValueError: a channel’s format is not a member of the version’s format enum (helpers/MeshHelper.py:451-462).

Fields

§format: u8

The channel’s format.

§table: FormatTable

The enum the version picks.

§

UnknownChannel(u64)

ValueError: a channel past the version’s last (helpers/MeshHelper.py:395-449).

§

NoChannels

ValueError: get_streams’s max over no channels (helpers/MeshHelper.py:257).

§

OutOfBounds

ValueError: UnityPyBoost’s bounds check (UnityPyBoost/Mesh.cpp:50-56).

§

Struct(StructError)

struct.error (its class’s name is error).

§

Index(IndexKind)

IndexError.

§

Unpack

ValueError: a strip’s or a quad’s indices unpacked from a slice the index buffer cuts short (helpers/MeshHelper.py:655, :673), or a compressed normal’s or tangent’s pair, or a tangent’s pair of signs, that its vector’s odd count cuts short (:534, :552-553).

Fields

§expected: u8

3 for a strip, 4 for a quad, 2 for a pair.

§got: u8

What the slice held.

§

StopIteration

StopIteration: a compressed skin whose bone indices end where a vertex’s fourth is read (next, helpers/MeshHelper.py:605).

§

Overflow

OverflowError: normalize’s square of a finite component past the largest float (v**2, helpers/MeshHelper.py:64), the message CPython’s float_pow gives ERANGE.

§

ByteRange

ValueError: bytes() of an index list holding a value past a byte (helpers/MeshHelper.py:175).

§

Topology

ValueError: a submesh of lines, points or another topology (helpers/MeshHelper.py:678-679).

§

Resource(Error)

The core’s error reading m_StreamData’s bytes (Environment::resource, its port of get_resource_data), as the core reports it.

§

Charge(ChargeError)

A charge the caller’s meter refused: an array’s memory, or the work counted before a loop (docs/plans/extract.md E59). UnityPy has no such bound (PARITY.md section 19.3).

§

WrappedAccess

UnityPyBoost’s uint32_t arithmetic wrapped and its check passed, so it would read outside the vertex data or write past the buffer it allocated, which is undefined behaviour in UnityPy (UnityPyBoost/Mesh.cpp:47-75); the crate refuses before reading (PARITY.md section 19.3).

§

Unsupported(Unsupported)

A part of MeshHandler a later phase ports (module docs of crate::Unsupported).

§

Malformed(String)

A field whose value has a type or a range no version’s typetree gives it, or a node whose type is not the class the field’s typetree names, which UnityPy’s arithmetic or object mode would take in ways no test characterises (PARITY.md section 15.3, Tier U).

Implementations§

Source§

impl MeshError

Source

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

The exception UnityPy raises for this failure: its class’s __name__ and str(e). None for the crate’s own refusals (the last five variants, module docs).

Trait Implementations§

Source§

impl Debug for MeshError

Source§

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

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

impl Display for MeshError

Source§

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

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

impl Error for MeshError

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 MeshError

Source§

fn from(source: ChargeError) -> Self

Converts to this type from the input type.
Source§

impl From<ViewError> for MeshError

Source§

fn from(error: ViewError) -> 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.