Skip to main content

Attribute

Struct Attribute 

Source
pub struct Attribute<T: NumericPrimitive, S: AttributeShape> { /* private fields */ }
Expand description

A typed numeric geometry attribute handle.

T determines the numeric primitive storage and S determines whether the attribute is fixed-tuple or jagged. The handle retains its node, part, owner, and name identity. Data operations use cached metadata so they do not add a hidden HAPI query to hot paths.

Implementations§

Source§

impl<T: NumericPrimitive, S: AttributeShape> Attribute<T, S>

Source

pub fn info(&self) -> &AttributeInfo

Returns the currently cached metadata.

Source

pub fn name(&self) -> &CStr

Returns the attribute name.

Source

pub fn part_id(&self) -> i32

Returns the HAPI part to which this handle is bound.

Source

pub fn owner(&self) -> AttributeOwner

Returns the element owner of this attribute.

Source

pub fn storage(&self) -> StorageType

Returns the HAPI storage implied by T and S.

Source

pub fn refresh(&mut self) -> Result<()>

Refreshes cached metadata from HAPI.

Call this after cooking or otherwise changing geometry when the attribute’s count, tuple size, or array element total may have changed. The cache is updated only if the attribute still exists and retains the numeric storage implied by T and S.

Source

pub fn delete(self) -> Result<()>

Deletes this attribute from its bound node and part.

Source§

impl<T: NumericPrimitive> Attribute<T, Fixed>

Source

pub fn get(&self) -> Result<Vec<T>>

Reads the complete fixed-tuple attribute as a flat vector.

The result length is count * tuple_size using cached metadata.

Source

pub fn read_into(&self, data: &mut Vec<T>) -> Result<()>

Reads the complete attribute into a reusable vector.

data is resized to count * tuple_size before the HAPI call.

Source

pub fn get_range(&self, range: Range<usize>) -> Result<Vec<T>>

Reads a range of owned elements as flattened tuples.

Source

pub fn read_range_into( &self, range: Range<usize>, data: &mut Vec<T>, ) -> Result<()>

Reads a range of owned elements into a reusable flattened vector.

Source

pub fn set(&self, data: &[T]) -> Result<()>

Replaces the complete fixed-tuple attribute.

Returns an error unless data.len() == count * tuple_size.

Source

pub fn set_range(&self, range: Range<usize>, data: &[T]) -> Result<()>

Replaces a range of owned elements from flattened tuples.

Source

pub fn set_unique(&self, value: &[T]) -> Result<()>

Assigns the same tuple value to every element of the attribute.

value must contain exactly tuple_size numeric values.

Source§

impl<T: NumericPrimitive> Attribute<T, Jagged>

Source

pub fn get(&self) -> Result<JaggedArrayData<T>>

Reads the complete HAPI array attribute.

Source

pub fn set(&self, values: &JaggedArrayData<T>) -> Result<()>

Replaces the complete HAPI array attribute.

The number of sizes must equal the cached attribute count. The JaggedArrayData constructor additionally guarantees that sizes are nonnegative and sum to the flattened data length.

Trait Implementations§

Source§

impl<T: Clone + NumericPrimitive, S: Clone + AttributeShape> Clone for Attribute<T, S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + NumericPrimitive, S: Debug + AttributeShape> Debug for Attribute<T, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, S> !RefUnwindSafe for Attribute<T, S>

§

impl<T, S> !UnwindSafe for Attribute<T, S>

§

impl<T, S> Forget for Attribute<T, S>

§

impl<T, S> Freeze for Attribute<T, S>

§

impl<T, S> Move for Attribute<T, S>

§

impl<T, S> Send for Attribute<T, S>

§

impl<T, S> Sync for Attribute<T, S>

§

impl<T, S> Unpin for Attribute<T, S>

§

impl<T, S> UnsafeUnpin for Attribute<T, S>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.