Skip to content

Commit 626304d

Browse files
IsseWemilk
andauthored
Make time and timeline controlled by blueprint (#11405)
### Related * Closes #7728 ### What Makes time cursor and current timeline be controlled by the blueprint. ### Details We log the time as static for blueprints for it not to affect undo state. This includes some refactors that felt necessary to make tests still work and not be overly complicated: - `TestContext` doesn't require a mutable reference to run. - Can update `TestContext` blueprints via `TestContext::with_blueprint_ctx`. - The blueprint ctx is a struct that implements a helper trait for interacting with blueprints. App also has an equivalent `AppBlueprintCtx`, and `ViewerContext` also implements this trait. - `TimeControl` is no longer stored behind an `RwLock` in app, and instead interacted with through sending `SystemCommand::TimeControlCommands`. The time panel was refactored a bit to allow the normal time panel and blueprint inspector time panel to still share code. This is mostly changing `&mut TimeControl` to `&mut impl TimeControlCtx` which handles writing to blueprints/just updating time control whether this is the blueprint inspector time panel or not. ### TODO - [x] Fix times per timeline with blueprint stored time, probably not store time per timeline in blueprint now and instead "switch out" what time to use. - [x] Fix snapshot tests, the current produced results are most likely wrong. --------- Co-authored-by: Emil Ernerfeldt <[email protected]>
1 parent d7b8e71 commit 626304d

File tree

129 files changed

+3182
-1334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3182
-1334
lines changed

crates/store/re_types/definitions/rerun/blueprint/archetypes/panel_blueprint.fbs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,27 @@ table PanelBlueprint (
1111

1212
// --- Optional ---
1313

14-
/// Current state of the panels.
14+
/// Current state of the panel.
1515
state: rerun.blueprint.components.PanelState ("attr.rerun.component_optional", nullable, order: 1000);
1616

1717
// TODO(jleibs): Add a float to track how expanded the panel is.
1818
}
19+
20+
/// Time panel specific state.
21+
table TimePanelBlueprint (
22+
"attr.rerun.scope": "blueprint",
23+
"attr.rust.derive": "Default"
24+
) {
25+
// --- Required ---
26+
27+
// --- Optional ---
28+
29+
/// Current state of the panel.
30+
state: rerun.blueprint.components.PanelState ("attr.rerun.component_optional", nullable, order: 1000);
31+
32+
/// What timeline the panel is on.
33+
timeline: rerun.blueprint.components.TimelineName ("attr.rerun.component_optional", nullable, order: 2000);
34+
35+
/// What time the time cursor should be on.
36+
time: rerun.blueprint.components.TimeInt ("attr.rerun.component_optional", nullable, order: 2100);
37+
}

crates/store/re_types/definitions/rerun/blueprint/components.fbs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace rerun.blueprint.components;
2+
3+
// ---
4+
5+
/// A reference to a time.
6+
struct TimeInt (
7+
"attr.arrow.transparent",
8+
"attr.rerun.scope": "blueprint",
9+
"attr.python.aliases": "long",
10+
"attr.rust.derive": "Copy, PartialEq, Eq, PartialOrd, Ord",
11+
"attr.rust.repr": "transparent",
12+
"attr.rust.tuple_struct"
13+
) {
14+
time: rerun.datatypes.TimeInt (order: 100);
15+
}

crates/store/re_types/src/blueprint/archetypes/.gitattributes

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/blueprint/archetypes/mod.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/blueprint/archetypes/panel_blueprint.rs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/blueprint/archetypes/time_panel_blueprint.rs

Lines changed: 242 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/blueprint/components/.gitattributes

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/store/re_types/src/blueprint/components/mod.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)