hapi_rs::asset

Struct AssetLibrary

Source
pub struct AssetLibrary {
    pub file: Option<PathBuf>,
    /* private fields */
}
Expand description

A handle to a loaded HDA file

Fields§

§file: Option<PathBuf>

Implementations§

Source§

impl AssetLibrary

Source

pub fn from_file( session: Session, file: impl AsRef<Path>, ) -> Result<AssetLibrary>

Load an asset from file

Source

pub fn from_memory(session: Session, data: &[u8]) -> Result<AssetLibrary>

Load asset library from memory

Source

pub fn get_asset_count(&self) -> Result<i32>

Get number of assets defined in the current library

Source

pub fn get_asset_names(&self) -> Result<Vec<String>>

Get asset names this library contains

Source

pub fn get_first_name(&self) -> Result<Option<String>>

Returns the name of first asset in the library

Source

pub fn create_asset_for_node<T: AsRef<str>>( &self, name: T, label: Option<T>, ) -> Result<HoudiniNode>

Create a node for an asset. This function is a convenient form of Session::create_node in a way that it makes sure that a correct parent network node is also created for assets other than Object level such as Cop, Top, etc.

Source

pub fn try_create_first(&self) -> Result<HoudiniNode>

Try to create the first found asset in the library. This is a convenience function for:

use hapi_rs::session::{new_in_process};
let session = new_in_process(None).unwrap();
let lib = session.load_asset_file("otls/hapi_geo.hda").unwrap();
let names = lib.get_asset_names().unwrap();
session.create_node(&names[0]).unwrap();

Except that it also handles non Object level assets, e.g. Cop network HDA.

Source

pub fn get_asset_parms(&self, asset: impl AsRef<str>) -> Result<AssetParameters>

Returns a struct holding the asset parameter information and values

Trait Implementations§

Source§

impl Clone for AssetLibrary

Source§

fn clone(&self) -> AssetLibrary

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AssetLibrary

Source§

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

Formats the value using the given formatter. Read more

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.