pub struct Player {
pub project: RenFile,
pub engine: Engine,
}Expand description
Topmost pickable item under pt (world space). Moved to renamite-model
so canvas behaviors can hit-test without pulling the player in.
See renamite_model::pick.
Self-contained player: owns the project, hides the borrow plumbing.
Fields§
§project: RenFile§engine: EngineImplementations§
Source§impl Player
impl Player
pub fn new(project: RenFile) -> Result<Player, PlayerError>
pub fn from_ren_str(text: &str) -> Result<Player, PlayerError>
pub fn from_ren_bytes(bytes: &[u8]) -> Result<Player, PlayerError>
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Player, PlayerError>
pub fn from_bytes(bytes: &[u8]) -> Result<Player, PlayerError>
Load from raw bytes, auto-detecting .ren (text) vs .renb (binary)
by magic header. .renb requires the binary feature.
pub fn tick(&mut self, dt_secs: f64) -> &[String]
pub fn bake(&mut self, frames: usize, dt_secs: f64) -> Vec<Scene>
pub fn scene(&self) -> &Scene
pub fn events(&self) -> &[String]
pub fn head(&self) -> f64
pub fn rate(&self) -> FrameRate
pub fn composition(&self) -> CompId
pub fn active_machine_states(&self) -> Option<Vec<usize>>
Sourcepub fn artboard_size(&self) -> (u32, u32)
pub fn artboard_size(&self) -> (u32, u32)
Pixel size of the active composition’s artboard.
Sourcepub fn reevaluate(&mut self)
pub fn reevaluate(&mut self)
Re-evaluate at the current head without advancing time. Call after any
mutation of self.project (e.g. live edits from the embed host).
pub fn pause(&mut self)
pub fn resume(&mut self)
pub fn is_paused(&self) -> bool
Sourcepub fn set_composition(&mut self, comp: CompId) -> bool
pub fn set_composition(&mut self, comp: CompId) -> bool
Switch the active composition (artboard). Resets playback to its range.
Sourcepub fn set_host_override(&mut self, id: NodeId, prop: PropPath, v: Value)
pub fn set_host_override(&mut self, id: NodeId, prop: PropPath, v: Value)
Patch a property for this frame and onward (e.g. game tint / bow stretch).
Host overrides survive tick, win over machine overrides, and take
effect immediately (the scene is re-evaluated here).
Sourcepub fn clear_host_overrides(&mut self)
pub fn clear_host_overrides(&mut self)
Drop every host override patch and re-evaluate.
pub fn set_bool(&mut self, name: &str, v: bool) -> bool
pub fn set_number(&mut self, name: &str, v: f64) -> bool
pub fn fire(&mut self, name: &str) -> bool
Sourcepub fn pointer_move(&mut self, pt: DVec2)
pub fn pointer_move(&mut self, pt: DVec2)
Pointer events apply machine listener side-effects immediately: each routes the pick, then re-evaluates with a zero-dt tick (editor parity).
pub fn pointer_down(&mut self, pt: DVec2)
pub fn pointer_up(&mut self, pt: DVec2)
pub fn pointer_leave(&mut self)
pub fn play_machine(&mut self, id: MachineId) -> bool
pub fn play_timeline(&mut self, loop_mode: LoopMode)
pub fn set_timeline_playback(&mut self, pb: Playback)
Auto Trait Implementations§
impl Freeze for Player
impl RefUnwindSafe for Player
impl Send for Player
impl Sync for Player
impl Unpin for Player
impl UnsafeUnpin for Player
impl UnwindSafe for Player
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.