pub struct SSRuntimeContext { /* private fields */ }Implementations§
Source§impl SSRuntimeContext
impl SSRuntimeContext
pub fn new(data: Option<Box<[u8]>>) -> Result<SSRuntimeContext, JsValue>
pub fn reset(&mut self)
pub fn bind_resource(&mut self, resource: &SSRuntimeResource) -> bool
pub fn load_ssab_copy(&mut self, data: &[u8]) -> bool
pub fn get_render_mode(&self) -> u8
pub fn set_render_mode(&mut self, mode: u8)
pub fn setup_animation(&mut self, name: &str) -> Result<(), JsValue>
pub fn setup_animation_by_hash(&mut self, name_hash: u32) -> Result<(), JsValue>
Sourcepub fn prepare_frame_data(&mut self, frame_no: f32) -> Result<usize, JsValue>
pub fn prepare_frame_data(&mut self, frame_no: f32) -> Result<usize, JsValue>
Build the frame data for frame_no and return its byte length. Read the
bytes with get_frame_data_buf, which does not evaluate again.
Evaluating the frame is the expensive half of a tick, so it happens here once. The buf/len pair is pure, like every other one on this type.
Sourcepub fn get_frame_data_buf(&self) -> *const u8
pub fn get_frame_data_buf(&self) -> *const u8
Pointer to what the last prepare_frame_data built. Null before the
first call; valid until the next one.
pub fn get_frame_data_len(&self) -> usize
pub fn get_world_matrices_buf(&self) -> *const f32
pub fn get_world_matrices_len(&self) -> usize
pub fn get_mesh_vertices_x_buf(&self) -> *const f32
pub fn get_mesh_vertices_x_len(&self) -> usize
pub fn get_mesh_vertices_y_buf(&self) -> *const f32
pub fn get_mesh_vertices_y_len(&self) -> usize
pub fn get_mesh_uvs_buf(&self) -> *const f32
pub fn get_mesh_uvs_len(&self) -> usize
pub fn get_mesh_indices_buf(&self) -> *const i32
pub fn get_mesh_indices_len(&self) -> usize
pub fn get_mesh_vertex_offsets_buf(&self) -> *const u32
pub fn get_mesh_vertex_offsets_len(&self) -> usize
pub fn get_mesh_index_offsets_buf(&self) -> *const u32
pub fn get_mesh_index_offsets_len(&self) -> usize
pub fn get_nines_vertices_buf(&self) -> *const f32
pub fn get_nines_vertices_len(&self) -> usize
pub fn get_nines_uvs_buf(&self) -> *const f32
pub fn get_nines_uvs_len(&self) -> usize
pub fn get_nines_box_coords_buf(&self) -> *const f32
pub fn get_nines_box_coords_len(&self) -> usize
pub fn get_nines_indices_buf(&self) -> *const i32
pub fn get_nines_indices_len(&self) -> usize
pub fn get_nines_vertex_offsets_buf(&self) -> *const u32
pub fn get_nines_vertex_offsets_len(&self) -> usize
pub fn get_nines_index_offsets_buf(&self) -> *const u32
pub fn get_nines_index_offsets_len(&self) -> usize
pub fn get_local_uvs_buf(&self) -> *const f32
pub fn get_local_uvs_len(&self) -> usize
pub fn get_cell_meta_buf(&self) -> *const f32
pub fn get_cell_meta_len(&self) -> usize
pub fn get_local_vertices_buf(&self) -> *const f32
pub fn get_local_vertices_len(&self) -> usize
pub fn get_shape_vertices_buf(&self) -> *const f32
pub fn get_shape_vertices_len(&self) -> usize
pub fn get_shape_vertex_box_coords_buf(&self) -> *const f32
pub fn get_shape_vertex_box_coords_len(&self) -> usize
pub fn get_shape_vertex_counts_buf(&self) -> *const i32
pub fn get_shape_vertex_counts_len(&self) -> usize
pub fn get_ssab_buf(&self) -> Result<*const u8, JsValue>
pub fn get_ssab_len(&self) -> Result<usize, JsValue>
pub fn get_frame_no(&self) -> f32
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
true once the configured loops have completed, and sticky until the
next play / setup_animation. Never true under an infinite loop
count, and never raised by stop.
This is a state, not a pulse: to notify once, take its rising edge.
pub fn just_looped(&self) -> bool
pub fn is_playing(&self) -> bool
pub fn is_playing_forward(&self) -> bool
pub fn is_pausing(&self) -> bool
Sourcepub fn is_clock_playing(&self) -> bool
pub fn is_clock_playing(&self) -> bool
The character’s clock: true from play until stop or the next
setup, after track 0 has finished as well.
Sourcepub fn is_clock_pausing(&self) -> bool
pub fn is_clock_pausing(&self) -> bool
true while pause holds a playing clock, after track 0 has finished
as well. Implies is_clock_playing.
Sourcepub fn is_stack_in_motion(&self) -> bool
pub fn is_stack_in_motion(&self) -> bool
true while the track stack would move the pose on a running clock for
a reason other than track 0’s own animation stepping: a fade on any
track, or another source still playing on a track that is heard.
Independent of the clock; read it with is_clock_playing and
is_clock_pausing.
pub fn get_skip_frames(&self) -> bool
pub fn get_playback_direction(&self) -> WebPlaybackDirection
pub fn get_playback_style(&self) -> WebPlaybackStyle
pub fn get_loop_count(&self) -> i32
pub fn get_remaining_loops(&self) -> i32
pub fn get_start_frame(&self) -> i32
pub fn get_end_frame(&self) -> i32
pub fn get_frame_rate(&self) -> i32
pub fn get_speed_scale(&self) -> f32
pub fn set_skip_frames(&mut self, skip: bool)
pub fn set_loop_count(&mut self, loop_count: i32)
pub fn set_frame_rate(&mut self, frame_rate: i32)
pub fn set_playback_direction( &mut self, direction: WebPlaybackDirection, style: WebPlaybackStyle, )
pub fn set_speed_scale(&mut self, speed_scale: f32)
Sourcepub fn set_animation_section(
&mut self,
start_frame: i32,
end_frame: i32,
) -> Result<(), JsValue>
pub fn set_animation_section( &mut self, start_frame: i32, end_frame: i32, ) -> Result<(), JsValue>
Throws Invalid parameter when both ends are in range and the end is
before the start; the section and the playhead stay as they were.
pub fn set_coordinate_system(&mut self, coordinate_system: WebCoordinateSystem)
pub fn get_coordinate_system(&self) -> WebCoordinateSystem
pub fn set_origin(&mut self, origin: WebOrigin)
pub fn get_origin(&self) -> WebOrigin
pub fn set_unit(&mut self, unit: WebUnit)
pub fn get_unit(&self) -> WebUnit
pub fn update(&mut self, delta: f32) -> f32
pub fn play(&mut self)
pub fn play_with_start_frame(&mut self, frame_no: f32)
Sourcepub fn pause(&mut self)
pub fn pause(&mut self)
Holds playback in place (idempotent). is_playing stays true; read
is_pausing to tell a held animation from a running one.
pub fn stop(&mut self)
pub fn set_frame_no(&mut self, frame: f32)
pub fn next_frame(&mut self)
pub fn prev_frame(&mut self)
pub fn set_track_animation( &mut self, track: u32, name: &str, ) -> Result<(), JsValue>
pub fn set_track_animation_by_hash( &mut self, track: u32, hash: u32, ) -> Result<(), JsValue>
pub fn set_track_alpha(&mut self, track: u32, alpha: f32) -> Result<(), JsValue>
pub fn get_track_alpha(&self, track: u32) -> Option<f32>
Sourcepub fn set_track_blend(&mut self, track: u32, blend: u32) -> Result<(), JsValue>
pub fn set_track_blend(&mut self, track: u32, blend: u32) -> Result<(), JsValue>
blend: 0 = mix (lerp onto what is below), 1 = additive (offset from the setup pose).
pub fn get_track_blend(&self, track: u32) -> Option<u32>
Sourcepub fn set_track_sync(&mut self, track: u32, sync: u32) -> Result<(), JsValue>
pub fn set_track_sync(&mut self, track: u32, sync: u32) -> Result<(), JsValue>
sync: 0 = free (start from the head), 1 = start (start at track 0’s phase).
Set it before laying an animation on the track.
pub fn get_track_sync(&self, track: u32) -> Option<u32>
pub fn get_track_count(&self) -> u32
pub fn clear_track(&mut self, track: u32) -> Result<(), JsValue>
pub fn crossfade( &mut self, track: u32, name: &str, duration_ms: f32, ) -> Result<(), JsValue>
pub fn crossfade_by_hash( &mut self, track: u32, hash: u32, duration_ms: f32, ) -> Result<(), JsValue>
pub fn fade_track( &mut self, track: u32, target_alpha: f32, duration_ms: f32, ) -> Result<(), JsValue>
pub fn get_track_fade_progress(&self, track: u32) -> Option<f32>
pub fn cancel_track_fade(&mut self, track: u32) -> Result<(), JsValue>
pub fn set_track_frame(&mut self, track: u32, frame: f32) -> Result<(), JsValue>
pub fn get_track_frame(&self, track: u32) -> Option<f32>
pub fn set_track_speed(&mut self, track: u32, speed: f32) -> Result<(), JsValue>
pub fn get_track_speed(&self, track: u32) -> Option<f32>
pub fn set_track_frame_rate( &mut self, track: u32, frame_rate: i32, ) -> Result<(), JsValue>
pub fn get_track_frame_rate(&self, track: u32) -> Option<i32>
pub fn set_track_skip_frames( &mut self, track: u32, skip: bool, ) -> Result<(), JsValue>
pub fn get_track_skip_frames(&self, track: u32) -> Option<bool>
pub fn set_track_playback_direction( &mut self, track: u32, direction: WebPlaybackDirection, style: WebPlaybackStyle, ) -> Result<(), JsValue>
pub fn get_track_playback_direction( &self, track: u32, ) -> Option<WebPlaybackDirection>
pub fn get_track_playback_style(&self, track: u32) -> Option<WebPlaybackStyle>
Sourcepub fn set_track_loop_count(
&mut self,
track: u32,
loop_count: i32,
) -> Result<(), JsValue>
pub fn set_track_loop_count( &mut self, track: u32, loop_count: i32, ) -> Result<(), JsValue>
Belongs to the animation on the track: laying another one there starts it looping forever again, so state the count after laying it.
pub fn get_track_loop_count(&self, track: u32) -> Option<i32>
Sourcepub fn is_track_finished(&self, track: u32) -> bool
pub fn is_track_finished(&self, track: u32) -> bool
is_finished for one track; false for a track with no animation.
Sourcepub fn track_just_looped(&self, track: u32) -> bool
pub fn track_just_looped(&self, track: u32) -> bool
just_looped for one track.
Sourcepub fn set_track_outgoing_event_threshold(
&mut self,
track: u32,
threshold: f32,
) -> Result<(), JsValue>
pub fn set_track_outgoing_event_threshold( &mut self, track: u32, threshold: f32, ) -> Result<(), JsValue>
The outgoing side of a crossfade on the track fires events while its
share, 1 - t, is at least this. Silent from the start by default.
pub fn get_track_outgoing_event_threshold(&self, track: u32) -> Option<f32>
pub fn get_track_main_source(&self, track: u32) -> Option<u32>
pub fn add_track_source( &mut self, track: u32, name: &str, weight: f32, ) -> Result<u32, JsValue>
pub fn add_track_source_by_hash( &mut self, track: u32, hash: u32, weight: f32, ) -> Result<u32, JsValue>
pub fn set_source_weight( &mut self, handle: u32, weight: f32, ) -> Result<(), JsValue>
pub fn get_source_weight(&self, handle: u32) -> Option<f32>
pub fn set_source_frame( &mut self, handle: u32, frame: f32, ) -> Result<(), JsValue>
pub fn get_source_frame(&self, handle: u32) -> Option<f32>
Sourcepub fn get_source_animation_index(&self, handle: u32) -> Option<u32>
pub fn get_source_animation_index(&self, handle: u32) -> Option<u32>
Which animation the source plays, as an index into the ssab’s animations; the table a passed event index addresses.
Sourcepub fn get_current_animation_index(&self) -> Option<u32>
pub fn get_current_animation_index(&self) -> Option<u32>
Which animation track 0’s main source plays, as an index into the ssab’s animations; a crossfade or a track animation on track 0 changes it from the call on.
pub fn set_source_event_threshold( &mut self, handle: u32, threshold: f32, ) -> Result<(), JsValue>
pub fn get_source_event_threshold(&self, handle: u32) -> Option<f32>
pub fn get_passed_event_source_handle(&self, index: i32) -> u32
pub fn get_passed_event_count(&self) -> i32
pub fn get_passed_event_index(&self, index: i32) -> i32
Sourcepub fn get_active_event_instance(
&mut self,
slot_index: u32,
) -> WebEventInstanceInfo
pub fn get_active_event_instance( &mut self, slot_index: u32, ) -> WebEventInstanceInfo
Mirror of ss_runtime_get_active_event_instance. Returns SS6 defaults
(is_synthetic_default = true, loop_num = 1, speed = 1.0) when no
event is active. Most Players should pass the returned value directly
to SSRuntimeInstanceSlot::step, which resolves the labels internally.
Sourcepub fn get_active_effect_event(&mut self, slot_index: u32) -> WebEffectEventInfo
pub fn get_active_effect_event(&mut self, slot_index: u32) -> WebEffectEventInfo
Mirror of ss_runtime_get_active_effect_event.
Sourcepub fn find_part_index(&self, part_name: &str) -> i32
pub fn find_part_index(&self, part_name: &str) -> i32
Mirror of ss_runtime_find_part_index. -1 if not loaded / not found.
Sourcepub fn set_part_visibility_override(
&mut self,
part: u32,
force: u8,
cascade: bool,
) -> Result<(), JsValue>
pub fn set_part_visibility_override( &mut self, part: u32, force: u8, cascade: bool, ) -> Result<(), JsValue>
Mirror of ss_runtime_set_part_visibility_override.
force: 0=clear/revert, 1=force-hide. Anything else, 2 (reserved for
force-visible) included, is rejected.
Sourcepub fn clear_part_visibility_override(
&mut self,
part: u32,
) -> Result<(), JsValue>
pub fn clear_part_visibility_override( &mut self, part: u32, ) -> Result<(), JsValue>
Mirror of ss_runtime_clear_part_visibility_override.
Sourcepub fn set_part_color_override(
&mut self,
part: u32,
blend_op: u8,
rgba: u32,
priority_mode: u8,
) -> Result<(), JsValue>
pub fn set_part_color_override( &mut self, part: u32, blend_op: u8, rgba: u32, priority_mode: u8, ) -> Result<(), JsValue>
Mirror of ss_runtime_set_part_color_override. rgba packed 0xRRGGBBAA
(fills all four corners); blend_op: 0=Mix 1=Mul 2=Add 3=Sub;
priority_mode: 0=OverwriteOnNextKeyframe 1=HoldUntilNextAnimation 2=Permanent.
Sourcepub fn set_part_color_override_corners(
&mut self,
part: u32,
blend_op: u8,
rgba_ltrtlbrb: &[u32],
priority_mode: u8,
) -> Result<(), JsValue>
pub fn set_part_color_override_corners( &mut self, part: u32, blend_op: u8, rgba_ltrtlbrb: &[u32], priority_mode: u8, ) -> Result<(), JsValue>
Mirror of ss_runtime_set_part_color_override_corners. rgba_ltrtlbrb =
4 packed RGBA in ssruntime corner order lt, rt, lb, rb.
Sourcepub fn clear_part_color_override(&mut self, part: u32) -> Result<(), JsValue>
pub fn clear_part_color_override(&mut self, part: u32) -> Result<(), JsValue>
Mirror of ss_runtime_clear_part_color_override.
Sourcepub fn set_part_cell_override(
&mut self,
part: u32,
cellmap_name_hash: u32,
cell_name_hash: u32,
priority_mode: u8,
) -> Result<(), JsValue>
pub fn set_part_cell_override( &mut self, part: u32, cellmap_name_hash: u32, cell_name_hash: u32, priority_mode: u8, ) -> Result<(), JsValue>
Mirror of ss_runtime_set_part_cell_override. (0, 0) reverts to the
animation; Normal + Mask parts only; errors if the cell is unresolvable.
Sourcepub fn clear_part_cell_override(&mut self, part: u32) -> Result<(), JsValue>
pub fn clear_part_cell_override(&mut self, part: u32) -> Result<(), JsValue>
Mirror of ss_runtime_clear_part_cell_override.
Sourcepub fn clear_all_part_overrides(&mut self)
pub fn clear_all_part_overrides(&mut self)
Mirror of ss_runtime_clear_all_part_overrides.
Trait Implementations§
Source§impl From<SSRuntimeContext> for JsValue
impl From<SSRuntimeContext> for JsValue
Source§fn from(value: SSRuntimeContext) -> Self
fn from(value: SSRuntimeContext) -> Self
Source§impl FromWasmAbi for SSRuntimeContext
impl FromWasmAbi for SSRuntimeContext
Source§impl IntoWasmAbi for SSRuntimeContext
impl IntoWasmAbi for SSRuntimeContext
Source§impl LongRefFromWasmAbi for SSRuntimeContext
impl LongRefFromWasmAbi for SSRuntimeContext
Source§type Abi = WasmPtr<WasmRefCell<SSRuntimeContext>>
type Abi = WasmPtr<WasmRefCell<SSRuntimeContext>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SSRuntimeContext>
type Anchor = RcRef<SSRuntimeContext>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for SSRuntimeContext
impl OptionFromWasmAbi for SSRuntimeContext
Source§impl OptionIntoWasmAbi for SSRuntimeContext
impl OptionIntoWasmAbi for SSRuntimeContext
Source§impl RefFromWasmAbi for SSRuntimeContext
impl RefFromWasmAbi for SSRuntimeContext
Source§type Abi = WasmPtr<WasmRefCell<SSRuntimeContext>>
type Abi = WasmPtr<WasmRefCell<SSRuntimeContext>>
Self are recovered from.Source§type Anchor = RcRef<SSRuntimeContext>
type Anchor = RcRef<SSRuntimeContext>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for SSRuntimeContext
impl RefMutFromWasmAbi for SSRuntimeContext
Source§type Abi = WasmPtr<WasmRefCell<SSRuntimeContext>>
type Abi = WasmPtr<WasmRefCell<SSRuntimeContext>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SSRuntimeContext>
type Anchor = RcRefMut<SSRuntimeContext>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for SSRuntimeContext
impl SupportsInstanceProperty for SSRuntimeContext
impl SupportsStaticProperty for SSRuntimeContext
Source§impl TryFromJsValue for SSRuntimeContext
impl TryFromJsValue for SSRuntimeContext
Source§fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
Source§const NULLABLE: bool = false
const NULLABLE: bool = false
Self accepts null as a distinct value space, as
Nullable<T> does. An enclosing Option then passes null through
instead of reading it as None, so Option<T> is itself nullable
exactly when T is not. JsValue does not set this: it accepts
null as one value among all of them, not as a distinct space, and
Option<JsValue> reads it as None like the ABI does. This is the
JS-value side of NullableFromWasmAbi, which claims null at the
ABI.Source§impl VectorFromWasmAbi for SSRuntimeContext
impl VectorFromWasmAbi for SSRuntimeContext
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SSRuntimeContext]>
Source§impl VectorIntoWasmAbi for SSRuntimeContext
impl VectorIntoWasmAbi for SSRuntimeContext
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SSRuntimeContext]>) -> Self::Abi
Source§impl WasmDescribeVector for SSRuntimeContext
impl WasmDescribeVector for SSRuntimeContext
Auto Trait Implementations§
impl Freeze for SSRuntimeContext
impl RefUnwindSafe for SSRuntimeContext
impl Send for SSRuntimeContext
impl Sync for SSRuntimeContext
impl Unpin for SSRuntimeContext
impl UnsafeUnpin for SSRuntimeContext
impl UnwindSafe for SSRuntimeContext
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
Source§impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
Source§type MaybeAbi = <T as FromWasmAbi>::Abi
type MaybeAbi = <T as FromWasmAbi>::Abi
Option<Self>.Source§unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>
Source§impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
Source§type MaybeAbi = <T as IntoWasmAbi>::Abi
type MaybeAbi = <T as IntoWasmAbi>::Abi
Option<Self>.Source§fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
Option<Self> ABI.Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.