-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Visible History to support more general time queries #4123
Conversation
static VISIBLE_HISTORY_COMPONENT_NAMES: once_cell::sync::Lazy<Vec<ComponentName>> = | ||
once_cell::sync::Lazy::new(|| { | ||
[ | ||
ComponentName::from("rerun.components.Position2D"), | ||
ComponentName::from("rerun.components.Position3D"), | ||
ComponentName::from("rerun.components.LineStrip2D"), | ||
ComponentName::from("rerun.components.LineStrip3D"), | ||
ComponentName::from("rerun.components.TensorData"), | ||
ComponentName::from("rerun.components.Vector3D"), | ||
ComponentName::from("rerun.components.HalfSizes2D"), | ||
ComponentName::from("rerun.components.HalfSizes3D"), | ||
] | ||
.into() | ||
}); | ||
|
||
fn should_display_visible_history( | ||
ctx: &mut ViewerContext<'_>, | ||
entity_path: Option<&EntityPath>, | ||
) -> bool { | ||
if let Some(entity_path) = entity_path { | ||
let store = ctx.store_db.store(); | ||
let component_names = store.all_components(ctx.rec_cfg.time_ctrl.timeline(), entity_path); | ||
if let Some(component_names) = component_names { | ||
if !component_names | ||
.iter() | ||
.any(|name| VISIBLE_HISTORY_COMPONENT_NAMES.contains(name)) | ||
{ | ||
return false; | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really how it should be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried it on the web build but it doesn't seem to do anything?
I might be doing something wrong, but it's hard to tell without any on-hover pop-ups explaining what each button/label/etc does.
23-11-03_09.05.38.patched.mp4
@teh-cmc looks like I've introduced a last minute bug 🤦🏻 Onto fixing it. |
I don't quite get why you made the Relative/Infinite things checkboxes since they clearly exclude each other. Also not being relative implying absolute took me a lil bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great feature overall, leveraging abilities we already have ⭐
code lgtm for the most part, the reason I put request changes is the ui concerns prior to the code review
@@ -17,14 +17,15 @@ pub fn query_archetype_with_history<'a, A: Archetype + 'a, const N: usize>( | |||
re_log_types::TimeType::Sequence => history.sequences, | |||
}; | |||
|
|||
if visible_history == 0 { | |||
if !history.enabled || visible_history == VisibleHistory::OFF { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to clarify, when can it happen that one is off but the other is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How the visible history is stored is not fully normalised: there is a slight duplication:
- the enabled/disabled bool
- the fact that
{from: Relative(0), to: Relative(0)}
(that's whatVisibleHistory::OFF
is) disable the feature for all practical purposes.
I've introduced that "enabled" bool to allow the user to disable the feature without losing their configured boundaries (ie. that checkbox next to the Visible History
label). Overall, better UX I believe, but the cost is this check.
BTW, the test against VisibleHistory::OFF
could actually be dropped and the result would be the same. So it can be seen as an optimisation to avoid a range query when we know none is needed :)
Co-authored-by: Andreas Reich <[email protected]>
Co-authored-by: Andreas Reich <[email protected]>
Co-authored-by: Andreas Reich <[email protected]>
Makes sense, I'll try that. |
I attempted to do that with bf65bf6. It's kind of tricky though. Please give it a good try 🙏🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love those improvements. worked great when I played around with it
What
Scope
Out-of-scope
TODO
Checklist