Struct rusty_spine::Bone
source · [−]pub struct Bone { /* private fields */ }
Expand description
A bone within the Skeleton hierarchy.
Bones can be acquired from a Skeleton and a safe BoneHandle can be obtained using the handle method to store long-term references to a specific bone.
The hierarchy can be traversed using parent and children, and specific bones can be located using Skeleton::find_bone.
Implementations
sourceimpl Bone
impl Bone
pub fn set_to_setup_pose(&mut self)
pub fn update(&mut self)
pub fn update_world_transform(&mut self)
pub fn update_world_transform_with(
&mut self,
x: f32,
y: f32,
rotation: f32,
scale_x: f32,
scale_y: f32,
shear_x: f32,
shear_y: f32
)
pub fn update_applied_transform(&mut self)
pub fn world_rotation_x(&self) -> f32
pub fn world_rotation_y(&self) -> f32
pub fn world_scale_x(&self) -> f32
pub fn world_scale_y(&self) -> f32
pub fn world_to_local(&self, world_x: f32, world_y: f32) -> (f32, f32)
pub fn local_to_world(&self, local_x: f32, local_y: f32) -> (f32, f32)
pub fn world_to_local_rotation(&self, world_rotation: f32) -> f32
pub fn local_to_world_rotation(&self, local_rotation: f32) -> f32
pub fn rotate_world(&self, degrees: f32)
pub fn handle(&self) -> BoneHandle
pub fn x(&self) -> f32
pub fn set_x(&mut self, value: f32)
pub fn y(&self) -> f32
pub fn set_y(&mut self, value: f32)
pub fn rotation(&self) -> f32
pub fn set_rotation(&mut self, value: f32)
pub fn scale_x(&self) -> f32
pub fn set_scale_x(&mut self, value: f32)
pub fn scale_y(&self) -> f32
pub fn set_scale_y(&mut self, value: f32)
pub fn shear_x(&self) -> f32
pub fn set_shear_x(&mut self, value: f32)
pub fn shear_y(&self) -> f32
pub fn set_shear_y(&mut self, value: f32)
pub fn applied_x(&self) -> f32
pub fn set_applied_x(&mut self, value: f32)
pub fn applied_y(&self) -> f32
pub fn set_applied_y(&mut self, value: f32)
pub fn applied_rotation(&self) -> f32
pub fn set_applied_rotation(&mut self, value: f32)
pub fn applied_scale_x(&self) -> f32
pub fn set_applied_scale_x(&mut self, value: f32)
pub fn applied_scale_y(&self) -> f32
pub fn set_applied_scale_y(&mut self, value: f32)
pub fn applied_shear_x(&self) -> f32
pub fn set_applied_shear_x(&mut self, value: f32)
pub fn applied_shear_y(&self) -> f32
pub fn set_applied_shear_y(&mut self, value: f32)
pub fn a(&self) -> f32
pub fn set_a(&mut self, value: f32)
pub fn b(&self) -> f32
pub fn set_b(&mut self, value: f32)
pub fn c(&self) -> f32
pub fn set_c(&mut self, value: f32)
pub fn d(&self) -> f32
pub fn set_d(&mut self, value: f32)
pub fn world_x(&self) -> f32
pub fn set_world_x(&mut self, value: f32)
pub fn world_y(&self) -> f32
pub fn set_world_y(&mut self, value: f32)
pub fn sorted(&self) -> bool
pub fn active(&self) -> bool
pub fn data(&self) -> CTmpRef<'_, Self, BoneData>
pub fn data_mut(&mut self) -> CTmpMut<'_, Self, BoneData>
pub fn parent(&self) -> Option<CTmpRef<'_, Self, Bone>>
pub fn parent_mut(&mut self) -> Option<CTmpMut<'_, Self, Bone>>
pub fn children_count(&self) -> i32
sourcepub fn children(&self) -> CTmpPtrIterator<'_, Bone, Bone, spBone>ⓘNotable traits for CTmpPtrIterator<'a, P, T, C>impl<'a, P, T, C> Iterator for CTmpPtrIterator<'a, P, T, C>where
T: NewFromPtr<C>, type Item = CTmpRef<'a, P, T>;
pub fn children(&self) -> CTmpPtrIterator<'_, Bone, Bone, spBone>ⓘNotable traits for CTmpPtrIterator<'a, P, T, C>impl<'a, P, T, C> Iterator for CTmpPtrIterator<'a, P, T, C>where
T: NewFromPtr<C>, type Item = CTmpRef<'a, P, T>;
T: NewFromPtr<C>, type Item = CTmpRef<'a, P, T>;
An iterator over the children of this bone.
use rusty_spine::{BoneHandle, Skeleton};
fn traverse_bones(
bone_handle: BoneHandle,
skeleton: &Skeleton,
ident: usize,
) {
if let Some(bone) = bone_handle.get(skeleton) {
println!(
"{:ident$}{name}",
"",
ident = ident,
name = bone.data().name()
);
for child in bone.children() {
traverse_bones(child.handle(), skeleton, ident + 2);
}
}
}
// Traverse all bones in a skeleton
let root_bone = skeleton.bone_root().handle();
traverse_bones(root_bone, &skeleton, 0);
pub fn children_mut(&mut self) -> CTmpMutIterator<'_, Bone, Bone, spBone>ⓘNotable traits for CTmpMutIterator<'a, P, T, C>impl<'a, P, T, C> Iterator for CTmpMutIterator<'a, P, T, C>where
T: NewFromPtr<C>, type Item = CTmpMut<'a, P, T>;
T: NewFromPtr<C>, type Item = CTmpMut<'a, P, T>;
pub fn children_at_index(&self, index: i32) -> Option<CTmpRef<'_, Self, Bone>>
pub fn children_at_index_mut(
&mut self,
index: i32
) -> Option<CTmpMut<'_, Self, Bone>>
pub fn set_y_down(y_down: bool)
pub fn is_y_down() -> bool
pub fn c_ptr(&self) -> *mut spBone
sourceimpl Bone
impl Bone
pub fn position(&self) -> Vector2<f32>
pub fn set_position(&mut self, position: impl Into<Vector2<f32>>)
pub fn world_position(&self) -> Vector2<f32>
pub fn set_world_position(&mut self, position: impl Into<Vector2<f32>>)
pub fn applied_position(&self) -> Vector2<f32>
pub fn set_applied_position(&mut self, position: impl Into<Vector2<f32>>)
pub fn scale(&self) -> Vector2<f32>
pub fn set_scale(&mut self, scale: impl Into<Vector2<f32>>)
pub fn world_scale(&self) -> Vector2<f32>
pub fn applied_scale(&self) -> Vector2<f32>
pub fn set_applied_scale(&mut self, scale: impl Into<Vector2<f32>>)
pub fn shear(&self) -> Vector2<f32>
pub fn set_shear(&mut self, shear: impl Into<Vector2<f32>>)
pub fn applied_shear(&self) -> Vector2<f32>
pub fn set_applied_shear(&mut self, shear: impl Into<Vector2<f32>>)
pub fn world_rotation(&self) -> Vector2<f32>
Trait Implementations
sourceimpl NewFromPtr<spBone> for Bone
impl NewFromPtr<spBone> for Bone
unsafe fn new_from_ptr(c_bone: *const spBone) -> Self
Auto Trait Implementations
impl RefUnwindSafe for Bone
impl Send for Bone
impl Sync for Bone
impl Unpin for Bone
impl UnwindSafe for Bone
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more