Skip to main content

CharacterRig

Struct CharacterRig 

Source
pub struct CharacterRig {
    pub name: String,
    pub joints: Vec<RigJoint>,
    pub morph_bindings: Vec<MorphBinding>,
    pub regions: Vec<RigBodyRegion>,
    pub metadata: HashMap<String, String>,
}
Expand description

The complete character rig.

Fields§

§name: String§joints: Vec<RigJoint>§morph_bindings: Vec<MorphBinding>§regions: Vec<RigBodyRegion>§metadata: HashMap<String, String>

Implementations§

Source§

impl CharacterRig

Source

pub fn new(name: impl Into<String>) -> Self

Create a new, empty rig.

Source

pub fn add_joint(&mut self, joint: RigJoint)

Add a joint to the rig.

Source

pub fn add_morph_binding(&mut self, binding: MorphBinding)

Add a morph binding.

Source

pub fn add_region(&mut self, region: RigBodyRegion)

Add a body region.

Source

pub fn joint_count(&self) -> usize

Number of joints in the rig.

Source

pub fn morph_binding_count(&self) -> usize

Number of morph bindings.

Source

pub fn get_joint(&self, name: &str) -> Option<&RigJoint>

Look up a joint by name.

Source

pub fn root_joints(&self) -> Vec<&RigJoint>

Return all joints that have no parent (i.e. root joints).

Source

pub fn children_of(&self, parent: &str) -> Vec<&RigJoint>

Return all joints whose parent is parent.

Source

pub fn joint_depth(&self, name: &str) -> usize

Return the depth of name in the joint hierarchy (root = 0).

Source

pub fn bindings_for_param(&self, param: &str) -> Vec<&MorphBinding>

Return all bindings driven by param.

Source

pub fn bindings_for_joint(&self, joint: &str) -> Vec<&MorphBinding>

Return all bindings that have joint as their joint driver.

Source

pub fn evaluate_morphs( &self, params: &HashMap<String, f32>, ) -> HashMap<String, f32>

Evaluate all morph weights given the current parameter state.

Source

pub fn to_json(&self) -> String

Serialize the rig to a JSON string.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.