use anyhow::Result;
use crate::schemas::geom;
use crate::usd::Attribute;
use super::tokens as tok;
pub trait FieldBase: geom::Xformable {}
pub trait FieldAsset: FieldBase {
fn file_path_attr(&self) -> Attribute {
self.prim().attribute(tok::A_FILE_PATH)
}
fn create_file_path_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_FILE_PATH, "asset")?
.set_custom(false)?)
}
fn field_name_attr(&self) -> Attribute {
self.prim().attribute(tok::A_FIELD_NAME)
}
fn create_field_name_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_FIELD_NAME, "token")?
.set_custom(false)?
.set_variability(crate::sdf::Variability::Uniform)?)
}
fn field_index_attr(&self) -> Attribute {
self.prim().attribute(tok::A_FIELD_INDEX)
}
fn create_field_index_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_FIELD_INDEX, "int")?
.set_custom(false)?
.set_variability(crate::sdf::Variability::Uniform)?)
}
fn field_data_type_attr(&self) -> Attribute {
self.prim().attribute(tok::A_FIELD_DATA_TYPE)
}
fn create_field_data_type_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_FIELD_DATA_TYPE, "token")?
.set_custom(false)?
.set_variability(crate::sdf::Variability::Uniform)?)
}
fn vector_data_role_hint_attr(&self) -> Attribute {
self.prim().attribute(tok::A_VECTOR_DATA_ROLE_HINT)
}
fn create_vector_data_role_hint_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_VECTOR_DATA_ROLE_HINT, "token")?
.set_custom(false)?
.set_variability(crate::sdf::Variability::Uniform)?)
}
}