use anyhow::Result;
use crate::sdf;
use crate::usd::{Attribute, Relationship};
use super::tokens as tok;
pub trait JointBase: crate::usd::SchemaBase {
fn body0_rel(&self) -> Relationship {
self.prim().relationship(tok::A_BODY0)
}
fn create_body0_rel(&self) -> Result<Relationship> {
Ok(self.prim().create_relationship(tok::A_BODY0)?.set_custom(false)?)
}
fn body1_rel(&self) -> Relationship {
self.prim().relationship(tok::A_BODY1)
}
fn create_body1_rel(&self) -> Result<Relationship> {
Ok(self.prim().create_relationship(tok::A_BODY1)?.set_custom(false)?)
}
fn local_pos0_attr(&self) -> Attribute {
self.prim().attribute(tok::A_LOCAL_POS_0)
}
fn create_local_pos0_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_LOCAL_POS_0, "point3f")?
.set_custom(false)?)
}
fn local_rot0_attr(&self) -> Attribute {
self.prim().attribute(tok::A_LOCAL_ROT_0)
}
fn create_local_rot0_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_LOCAL_ROT_0, "quatf")?
.set_custom(false)?)
}
fn local_pos1_attr(&self) -> Attribute {
self.prim().attribute(tok::A_LOCAL_POS_1)
}
fn create_local_pos1_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_LOCAL_POS_1, "point3f")?
.set_custom(false)?)
}
fn local_rot1_attr(&self) -> Attribute {
self.prim().attribute(tok::A_LOCAL_ROT_1)
}
fn create_local_rot1_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_LOCAL_ROT_1, "quatf")?
.set_custom(false)?)
}
fn joint_enabled_attr(&self) -> Attribute {
self.prim().attribute(tok::A_JOINT_ENABLED)
}
fn create_joint_enabled_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_JOINT_ENABLED, "bool")?
.set_custom(false)?)
}
fn collision_enabled_attr(&self) -> Attribute {
self.prim().attribute(tok::A_JOINT_COLLISION_ENABLED)
}
fn create_collision_enabled_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_JOINT_COLLISION_ENABLED, "bool")?
.set_custom(false)?)
}
fn exclude_from_articulation_attr(&self) -> Attribute {
self.prim().attribute(tok::A_EXCLUDE_FROM_ARTICULATION)
}
fn create_exclude_from_articulation_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_EXCLUDE_FROM_ARTICULATION, "bool")?
.set_custom(false)?
.set_variability(sdf::Variability::Uniform)?)
}
fn break_force_attr(&self) -> Attribute {
self.prim().attribute(tok::A_BREAK_FORCE)
}
fn create_break_force_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_BREAK_FORCE, "float")?
.set_custom(false)?)
}
fn break_torque_attr(&self) -> Attribute {
self.prim().attribute(tok::A_BREAK_TORQUE)
}
fn create_break_torque_attr(&self) -> Result<Attribute> {
Ok(self
.prim()
.create_attribute(tok::A_BREAK_TORQUE, "float")?
.set_custom(false)?)
}
}