pub struct Animation {
pub header: AnimationHeader,
pub joints: Vec<JointData>,
pub constraints: Vec<Constraint>,
}Fields§
§header: AnimationHeader§joints: Vec<JointData>§constraints: Vec<Constraint>Implementations§
Source§impl Animation
impl Animation
pub fn new() -> Self
pub fn set_priority(&mut self, priority: i32) -> &mut Self
pub fn set_duration(&mut self, duration: f32) -> &mut Self
pub fn set_joint_priority(&mut self, priority: i32) -> &mut Self
pub fn drop_empty_joints(&mut self) -> &mut Self
pub fn drop_position_keys(&mut self) -> &mut Self
pub fn drop_position( &mut self, joints: impl Fn(&JointData) -> bool, ) -> &mut Self
pub fn drop_zero_position_keys(&mut self, epsilon: f32) -> &mut Self
pub fn drop_rotation_keys(&mut self) -> &mut Self
pub fn drop_rotation( &mut self, joints: impl Fn(&JointData) -> bool, ) -> &mut Self
pub fn cleanup_keys(&mut self) -> &mut Self
Sourcepub fn cleanup_keys_with(&mut self, strategy: DuplicateKeyStrategy) -> &mut Self
pub fn cleanup_keys_with(&mut self, strategy: DuplicateKeyStrategy) -> &mut Self
Cleanup duplicate keyframe times with a customizable strategy.
pub fn joint(&self, name: &str) -> Option<&JointData>
pub fn joint_mut(&mut self, name: &str) -> Option<&mut JointData>
pub fn position_reset_from_skeleton<'a>( skeleton: &SkeletonDefinition, joint_names: impl IntoIterator<Item = &'a str>, priority: i32, ) -> Result<Self>
pub fn position_reset_from_bones<'a>( bones: impl IntoIterator<Item = &'a SkeletonBone>, priority: i32, ) -> Result<Self>
pub fn add_skeleton_positions( &mut self, skeleton: &SkeletonDefinition, ) -> Result<&mut Self>
Sourcepub fn from_llsd(llsd: &Llsd, check_enabled: bool) -> Result<Self>
pub fn from_llsd(llsd: &Llsd, check_enabled: bool) -> Result<Self>
Creates an animation from LLSD data, typically from Firestorm poser files.
This function parses LLSD-XML data exported by Firestorm’s poser system and converts it into an animation structure. Firestorm stores pose data in LLSD-XML format in the user’s configuration directory.
§Arguments
llsd- The parsed LLSD data containing joint posescheck_enabled- If true, only includes joints where the “enabled” field is true
§File Locations
Firestorm poser files are typically found at:
- Linux:
~/.firestorm_x64/user_settings/poses/ - Windows:
%APPDATA%/Firestorm_x64/user_settings/poses/ - macOS:
~/Library/Application Support/Firestorm_x64/user_settings/poses/
§Example
use std::fs::File;
use std::io::BufReader;
use avatar_anim::Animation;
// Load LLSD-XML file from Firestorm poses directory
let file = BufReader::new(File::open("my_pose.xml")?);
let llsd = llsd_rs::xml::from_reader(file).map_err(|e| avatar_anim::AnimError::Llsd(e.to_string()))?;
// Convert to animation, including only enabled joints
let animation = Animation::from_llsd(&llsd, true)?;Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Load an animation from a .anim file
§Example
use avatar_anim::Animation;
let animation = Animation::from_file("my_animation.anim")?;Trait Implementations§
Source§impl BinRead for Animation
impl BinRead for Animation
Source§fn read_options<R: Read + Seek>(
reader: &mut R,
endian: Endian,
_args: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( reader: &mut R, endian: Endian, _args: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T from the reader assuming native-endian byte order. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for Animation
impl BinWrite for Animation
Source§fn write_options<W: Write + Seek>(
&self,
writer: &mut W,
endian: Endian,
_args: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, writer: &mut W, endian: Endian, _args: Self::Args<'_>, ) -> BinResult<()>
Source§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming little-endian byte order. Read moreSource§fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self to the writer assuming native-endian byte order. Read moreSource§fn write_be_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_be_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Write
Self to the writer, assuming big-endian byte order, using the
given arguments. Read moreimpl StructuralPartialEq for Animation
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl Send for Animation
impl Sync for Animation
impl Unpin for Animation
impl UnsafeUnpin for Animation
impl UnwindSafe for Animation
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