Skip to content

Commit b66ff13

Browse files
committed
Remove visibletimerange archetype workaround
1 parent d8641f8 commit b66ff13

File tree

7 files changed

+87
-32
lines changed

7 files changed

+87
-32
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ table VisualizerOverrides (
1414
"attr.rerun.scope": "blueprint",
1515
"attr.python.aliases": "str, Sequence[str]"
1616
) {
17-
/// Names of the visualizers that should be active.
17+
/// Names of the visualizers that should be active.
1818
ranges: [rerun.blueprint.components.VisualizerOverride] ("attr.rerun.component_required", order: 1000);
1919
}

docs/content/reference/migration/migration-0-23.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Setting up styles for a plot.
154154

155155
Before:
156156
```py
157+
# ...
157158
rrb.TimeSeriesView(
158159
name="Trig",
159160
origin="/trig",
@@ -170,9 +171,11 @@ rrb.TimeSeriesView(
170171
"classification/samples": [rrb.VisualizerOverrides("SeriesPoint")], # This ensures that the `SeriesPoint` visualizers is used for this entity.
171172
},
172173
),
174+
# ...
173175
```
174176
After:
175177
```py
178+
# ...
176179
rrb.TimeSeriesView(
177180
name="Trig",
178181
origin="/trig",
@@ -189,11 +192,47 @@ rrb.TimeSeriesView(
189192
"classification/samples": rrb.VisualizerOverrides("SeriesPoint"), # This ensures that the `SeriesPoint` visualizers is used for this entity.
190193
},
191194
),
195+
# ...
192196
```
193197

194-
195198
⚠️ Warning: Just like regular log/send calls, overlapping component types still overwrite each other.
196199
E.g. overriding a box radius will also override point radius on the same entity.
197200
In a future release, components tagged with a different archetype or field name can live side by side,
198201
but for the moment the Viewer is not able to make this distinction.
199202
For details see [#6889](https://github.com/rerun-io/rerun/issues/6889).
203+
204+
205+
### Visible time range overrides have to specify the underlying archetype
206+
207+
(Note that this functionallity broken in at least Rerun 0.21 and 0.22 but is fixed now. See [#8557](https://github.com/rerun-io/rerun/issues/8557))
208+
209+
Before:
210+
```py
211+
# ...
212+
overrides={
213+
"helix/structure/scaffolding/beads": [
214+
rrb.VisibleTimeRange(
215+
"stable_time",
216+
start=rrb.TimeRangeBoundary.cursor_relative(seconds=-0.3),
217+
end=rrb.TimeRangeBoundary.cursor_relative(seconds=0.3),
218+
),
219+
],
220+
},
221+
# ...
222+
```
223+
224+
After:
225+
```py
226+
# ...
227+
overrides={
228+
"helix/structure/scaffolding/beads": rrb.VisibleTimeRanges(
229+
rrb.VisibleTimeRange(
230+
timelines="stable_time",
231+
starts=rrb.TimeRangeBoundary.cursor_relative(seconds=-0.3),
232+
ends=rrb.TimeRangeBoundary.cursor_relative(seconds=0.3),
233+
),
234+
),
235+
}
236+
# ...
237+
```
238+

rerun_py/rerun_sdk/rerun/blueprint/__init__.py

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

rerun_py/rerun_sdk/rerun/blueprint/archetypes/visible_time_ranges_ext.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,42 @@ def __init__(self: Any, ranges: datatypes.VisibleTimeRangeArrayLike) -> None:
3838
self.__attrs_init__(ranges=ranges)
3939
return
4040
self.__attrs_clear__()
41+
42+
43+
class VisibleTimeRangeExt:
44+
"""Extension for [VisibleTimeRange][rerun.datatypes.VisibleTimeRange]."""
45+
46+
def __init__(
47+
self: Any,
48+
timeline: datatypes.Utf8Like,
49+
range: datatypes.TimeRangeLike | None = None,
50+
*,
51+
start: datatypes.TimeRangeBoundary | None = None,
52+
end: datatypes.TimeRangeBoundary | None = None,
53+
) -> None:
54+
"""
55+
Create a new instance of the VisibleTimeRange datatype.
56+
57+
Parameters
58+
----------
59+
timeline:
60+
Name of the timeline this applies to.
61+
range:
62+
Time range to use for this timeline.
63+
start:
64+
Low time boundary for sequence timeline. Specify this instead of `range`.
65+
end:
66+
High time boundary for sequence timeline. Specify this instead of `range`.
67+
68+
"""
69+
from . import TimeRange
70+
71+
if range is None:
72+
if start is None or end is None:
73+
raise ValueError("Specify either start_and_end or both start & end")
74+
range = TimeRange(start=start, end=end)
75+
else:
76+
if start is not None or end is not None:
77+
raise ValueError("Specify either start_and_end or both start & end, not both")
78+
79+
self.__attrs_init__(timeline=timeline, range=range)

rerun_py/rerun_sdk/rerun/blueprint/components/visible_time_range.py

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

rerun_py/rerun_sdk/rerun/blueprint/components/visible_time_range_ext.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/python/release_checklist/check_time_range_individual_overrides.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ def blueprint() -> rrb.BlueprintLike:
3232
rrb.Spatial3DView(
3333
origin="/",
3434
overrides={
35-
"helix/structure/scaffolding/beads": [
35+
"helix/structure/scaffolding/beads": rrb.VisibleTimeRanges(
3636
rrb.VisibleTimeRange(
37-
"stable_time",
38-
start=rrb.TimeRangeBoundary.cursor_relative(seconds=-0.3),
39-
end=rrb.TimeRangeBoundary.cursor_relative(seconds=0.3),
37+
timelines="stable_time",
38+
starts=rrb.TimeRangeBoundary.cursor_relative(seconds=-0.3),
39+
ends=rrb.TimeRangeBoundary.cursor_relative(seconds=0.3),
4040
),
41-
],
41+
),
4242
},
4343
),
4444
rrb.Vertical(

0 commit comments

Comments
 (0)