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
impl AssetLibrary
Sourcepub fn from_file(
session: Session,
file: impl AsRef<Path>,
) -> Result<AssetLibrary>
pub fn from_file( session: Session, file: impl AsRef<Path>, ) -> Result<AssetLibrary>
Load an asset from file
Sourcepub fn from_memory(session: Session, data: &[u8]) -> Result<AssetLibrary>
pub fn from_memory(session: Session, data: &[u8]) -> Result<AssetLibrary>
Load asset library from memory
Sourcepub fn get_asset_count(&self) -> Result<i32>
pub fn get_asset_count(&self) -> Result<i32>
Get number of assets defined in the current library
Sourcepub fn get_asset_names(&self) -> Result<Vec<String>>
pub fn get_asset_names(&self) -> Result<Vec<String>>
Get asset names this library contains
Sourcepub fn get_first_name(&self) -> Result<Option<String>>
pub fn get_first_name(&self) -> Result<Option<String>>
Returns the name of first asset in the library
Sourcepub fn create_asset_for_node<T: AsRef<str>>(
&self,
name: T,
label: Option<T>,
) -> Result<HoudiniNode>
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.
Sourcepub fn try_create_first(&self) -> Result<HoudiniNode>
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.
Sourcepub fn get_asset_parms(&self, asset: impl AsRef<str>) -> Result<AssetParameters>
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
impl Clone for AssetLibrary
Source§fn clone(&self) -> AssetLibrary
fn clone(&self) -> AssetLibrary
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AssetLibrary
impl !RefUnwindSafe for AssetLibrary
impl Send for AssetLibrary
impl Sync for AssetLibrary
impl Unpin for AssetLibrary
impl !UnwindSafe for AssetLibrary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more