Struct hapi_rs::asset::AssetLibrary
source · 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 more