Struct re_viewer_context::BlueprintUndoState
source · pub struct BlueprintUndoState {
current_time: Option<TimeInt>,
inflection_points: BTreeSet<TimeInt>,
}
Expand description
We store the entire edit history of a blueprint in its store.
When undoing, we move back time, and redoing move it forward. When editing, we first drop all data after the current time.
Fields§
§current_time: Option<TimeInt>
The current blueprint time, used for latest-at.
Everything after this time is in “redo-space”, and will be dropped before new events are appended to the timeline.
If None
, use the max time of the blueprint timeline.
inflection_points: BTreeSet<TimeInt>
Interesting times to undo/redo to.
When the user drags a slider or similar, we get new events recorded on each frame. The user presumably wants to undo the whole slider drag, and not each increment of it.
So we use a heuristic to estimate when such interactions start/stop, and add them to this set.
Implementations§
source§impl BlueprintUndoState
impl BlueprintUndoState
sourcepub fn default_query() -> LatestAtQuery
pub fn default_query() -> LatestAtQuery
Default latest-at query
sourcepub fn oldest_undo_point(&self) -> Option<TimeInt>
pub fn oldest_undo_point(&self) -> Option<TimeInt>
How far back in time can we undo?
pub fn blueprint_query(&self) -> LatestAtQuery
sourcepub fn redo_time(&self) -> Option<TimeInt>
pub fn redo_time(&self) -> Option<TimeInt>
If set, everything after this time is in “redo-space” (futurum).
If None
, there is no undo-buffer.
pub fn set_redo_time(&mut self, time: TimeInt)
pub fn undo(&mut self, blueprint_db: &EntityDb)
pub fn redo(&mut self)
pub fn redo_all(&mut self)
sourcepub fn clear_redo_buffer(&mut self, blueprint_db: &mut EntityDb)
pub fn clear_redo_buffer(&mut self, blueprint_db: &mut EntityDb)
After calling this, there is no way to redo what was once undone.
pub fn update(&mut self, egui_ctx: &Context, blueprint_db: &EntityDb)
Trait Implementations§
source§impl Clone for BlueprintUndoState
impl Clone for BlueprintUndoState
source§fn clone(&self) -> BlueprintUndoState
fn clone(&self) -> BlueprintUndoState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BlueprintUndoState
impl Debug for BlueprintUndoState
source§impl Default for BlueprintUndoState
impl Default for BlueprintUndoState
source§fn default() -> BlueprintUndoState
fn default() -> BlueprintUndoState
source§impl<'de> Deserialize<'de> for BlueprintUndoState
impl<'de> Deserialize<'de> for BlueprintUndoState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for BlueprintUndoState
impl RefUnwindSafe for BlueprintUndoState
impl Send for BlueprintUndoState
impl Sync for BlueprintUndoState
impl Unpin for BlueprintUndoState
impl UnwindSafe for BlueprintUndoState
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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request