Skip to content

Commit 24490ea

Browse files
committed
more annotations, convert all examples to use new defaults/overrides
1 parent 082a342 commit 24490ea

File tree

19 files changed

+52
-22
lines changed

19 files changed

+52
-22
lines changed

crates/build/re_types_builder/src/codegen/python/views.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn init_method(reporter: &Reporter, objects: &Objects, obj: &Object) -> String {
5959
name: Utf8Like | None = None,
6060
visible: datatypes.BoolLike | None = None,
6161
defaults: list[AsComponents | Iterable[DescribedComponentBatch]] = None,
62-
overrides: dict[EntityPathLike, list[AsComponents | Iterable[DescribedComponentBatch]]] = None,
62+
overrides: dict[EntityPathLike, AsComponents | Iterable[AsComponents | Iterable[DescribedComponentBatch]]] = None,
6363
"#
6464
.to_owned();
6565

examples/python/blueprint/blueprint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def main() -> None:
3333
name="Rect 1",
3434
origin="/",
3535
contents=["/**"],
36-
defaults=[rr.components.Radius(2)], # Default all rectangles to have a radius of 2
37-
overrides={"rect/0": [rr.components.Radius(1)]}, # Override the radius of rect/0 to be 1
36+
defaults=[rr.Boxes2D.from_fields(radii=1)], # Default all rectangles to have a radius of 1
37+
overrides={"rect/0": rr.Boxes2D.from_fields(radii=2)}, # Override the radius of rect/0 to be 2
3838
),
3939
),
4040
rrb.BlueprintPanel(state="collapsed"),

examples/python/dna/dna.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def main() -> None:
7878
origin="/",
7979
overrides={
8080
"helix/structure/scaffolding/beads": [
81+
# TODO: visible time range override is.. special.
8182
rrb.VisibleTimeRange(
8283
"stable_time",
8384
start=rrb.TimeRangeBoundary.cursor_relative(seconds=-0.3),

examples/python/graphs/graphs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ def log_blueprint() -> None:
165165
force_link=ForceLink(enabled=False),
166166
force_many_body=ForceManyBody(enabled=False),
167167
force_collision_radius=ForceCollisionRadius(enabled=True),
168-
defaults=[ShowLabels(False)],
168+
defaults=[rr.GraphNodes.from_fields(show_labels=False)],
169169
),
170170
rrb.GraphView(
171171
origin="lattice",
172172
name="Lattice",
173173
force_link=ForceLink(distance=60),
174174
force_many_body=ForceManyBody(strength=-60),
175-
defaults=[ShowLabels(False), Radius(10)],
175+
defaults=[rr.GraphNodes.from_fields(show_labels=False, radii=10)],
176176
),
177177
rrb.Horizontal(
178178
rrb.GraphView(

examples/python/nuscenes_dataset/nuscenes_dataset/__main__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ def main() -> None:
318318
name=sensor_name,
319319
origin=f"world/ego_vehicle/{sensor_name}",
320320
contents=["$origin/**", "world/anns"],
321-
# TODO(#6670): Can't specify rr.components.FillMode.MajorWireframe right now, need to use batch type instead.
322-
overrides={"world/anns": [rr.components.FillModeBatch("majorwireframe")]},
321+
overrides={"world/anns": rr.Boxes3D.from_fields(fill_mode="majorwireframe")},
323322
)
324323
for sensor_name in nuscene_sensor_names(nusc, args.scene_name)
325324
]
@@ -330,9 +329,8 @@ def main() -> None:
330329
name="3D",
331330
origin="world",
332331
# Set the image plane distance to 5m for all camera visualizations.
333-
defaults=[rr.components.ImagePlaneDistance(5.0)],
334-
# TODO(#6670): Can't specify rr.components.FillMode.MajorWireframe right now, need to use batch type instead.
335-
overrides={"world/anns": [rr.components.FillModeBatch("solid")]},
332+
defaults=[rr.Pinhole.from_fields(image_plane_distance=5.0)],
333+
overrides={"world/anns": rr.Boxes3D.from_fields(fill_mode="solid")},
336334
),
337335
rrb.Vertical(
338336
rrb.TextDocumentView(origin="description", name="Description"),

examples/python/plots/plots.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def main() -> None:
154154
rrb.TimeSeriesView(
155155
name="Spiral",
156156
origin="/spiral",
157+
# TODO: type annotation issue
157158
overrides={"spiral": rr.SeriesLine.from_fields(name=["0.01t cos(0.01t)", "0.01t sin(0.01t)"])},
158159
),
159160
row_shares=[2, 1],

examples/python/rgbd/rgbd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def main() -> None:
190190
rrb.Spatial2DView(
191191
name="RGB & Depth",
192192
origin="world/camera/image",
193-
overrides={"world/camera/image/rgb": [rr.components.Opacity(0.5)]},
193+
overrides={"world/camera/image/rgb": rr.Image.from_fields(opacity=0.5)},
194194
),
195195
rrb.Tabs(
196196
rrb.Spatial2DView(name="RGB", origin="world/camera/image", contents="world/camera/image/rgb"),

rerun_py/rerun_sdk/rerun/blueprint/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,17 @@ def __init__(
4343
contents: ViewContentsLike,
4444
name: Utf8Like | None,
4545
visible: BoolLike | None = None,
46+
<<<<<<< HEAD
4647
properties: dict[str, AsComponents] | None = None,
4748
defaults: list[AsComponents | Iterable[DescribedComponentBatch]] | None = None,
4849
overrides: dict[EntityPathLike, list[AsComponents | Iterable[DescribedComponentBatch]]] | None = None,
4950
) -> None:
51+
=======
52+
properties: dict[str, AsComponents] = {},
53+
defaults: list[AsComponents | Iterable[DescribedComponentBatch]] = [],
54+
overrides: dict[EntityPathLike, AsComponents | Iterable[AsComponents | Iterable[DescribedComponentBatch]]] = {},
55+
):
56+
>>>>>>> 2e8b494065 (more annotations, convert all examples to use new defaults/overrides)
5057
"""
5158
Construct a blueprint for a new view.
5259

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
from typing import cast
23

34
from ..._baseclasses import DescribedComponentBatch
45

@@ -16,4 +17,6 @@ def as_component_batches(self) -> list[DescribedComponentBatch]:
1617
1718
TODO(#8129): In the future visualizer overrides should be handled with tagging overrides instead.
1819
"""
19-
return [DescribedComponentBatch(self, self.component_descriptor())]
20+
from ...blueprint.components.visualizer_overrides import VisualizerOverrides
21+
batch = cast(VisualizerOverrides, self)
22+
return [DescribedComponentBatch(batch, batch.component_descriptor())]

rerun_py/rerun_sdk/rerun/blueprint/views/bar_chart_view.py

Lines changed: 3 additions & 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/views/dataframe_view.py

Lines changed: 3 additions & 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/views/graph_view.py

Lines changed: 3 additions & 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/views/map_view.py

Lines changed: 3 additions & 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/views/spatial2d_view.py

Lines changed: 3 additions & 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/views/spatial3d_view.py

Lines changed: 3 additions & 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/views/tensor_view.py

Lines changed: 3 additions & 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/views/text_document_view.py

Lines changed: 3 additions & 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/views/text_log_view.py

Lines changed: 3 additions & 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/views/time_series_view.py

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

0 commit comments

Comments
 (0)