Skip to content

Commit

Permalink
Don't make top-level spaces their own children (#1100)
Browse files Browse the repository at this point in the history
* Don't make top-level spaces their own children
* Allow view coordinates to be logged at the root
  • Loading branch information
jleibs committed Feb 6, 2023
1 parent 513ffde commit 81162f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
10 changes: 9 additions & 1 deletion crates/re_viewer/src/misc/space_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,15 @@ impl SpaceInfoCollection {
.child_spaces
.insert(tree.path.clone(), transform);

add_children(entity_db, &mut spaces_info, &mut space_info, tree, &query);
for child_tree in tree.children.values() {
add_children(
entity_db,
&mut spaces_info,
&mut space_info,
child_tree,
&query,
);
}
spaces_info.spaces.insert(tree.path.clone(), space_info);
}
spaces_info
Expand Down
15 changes: 10 additions & 5 deletions rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,8 @@ fn log_transform(
timeless: bool,
) -> PyResult<()> {
let entity_path = parse_entity_path(entity_path)?;
if entity_path.len() == 1 {
// Stop people from logging a transform to a root-entity, such as "world" (which doesn't have a parent).
return Err(PyTypeError::new_err("Transforms are between a child entity and its parent, so root entities cannot have transforms"));
if entity_path.is_root() {
return Err(PyTypeError::new_err("Transforms are between a child entity and its parent, so the root cannot have a transform"));
}
let mut session = global_session();
let time_point = time(timeless);
Expand Down Expand Up @@ -517,16 +516,22 @@ fn log_view_coordinates_up_handedness(
}

fn log_view_coordinates(
entity_path: &str,
entity_path_str: &str,
coordinates: ViewCoordinates,
timeless: bool,
) -> PyResult<()> {
if coordinates.handedness() == Some(coordinates::Handedness::Left) {
re_log::warn_once!("Left-handed coordinate systems are not yet fully supported by Rerun");
}

// We normally disallow logging to root, but we make an exception for view_coordinates
let entity_path = if entity_path_str == "/" {
EntityPath::root()
} else {
parse_entity_path(entity_path_str)?
};

let mut session = global_session();
let entity_path = parse_entity_path(entity_path)?;
let time_point = time(timeless);

// We currently log view coordinates from inside the bridge because the code
Expand Down

1 comment on commit 81162f9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: 81162f9 Previous: 513ffde Ratio
datastore/insert/batch/rects/insert 581341 ns/iter (± 1816) 577770 ns/iter (± 2455) 1.01
datastore/latest_at/batch/rects/query 1768 ns/iter (± 17) 1768 ns/iter (± 5) 1
datastore/latest_at/missing_components/primary 322 ns/iter (± 0) 306 ns/iter (± 0) 1.05
datastore/latest_at/missing_components/secondaries 386 ns/iter (± 0) 380 ns/iter (± 1) 1.02
datastore/range/batch/rects/query 156226 ns/iter (± 751) 154859 ns/iter (± 411) 1.01
mono_points_arrow/generate_message_bundles 44830054 ns/iter (± 1022837) 50956811 ns/iter (± 846471) 0.88
mono_points_arrow/generate_messages 122902393 ns/iter (± 1086635) 137610020 ns/iter (± 1321254) 0.89
mono_points_arrow/encode_log_msg 149246589 ns/iter (± 676380) 165160509 ns/iter (± 1263062) 0.90
mono_points_arrow/encode_total 322241218 ns/iter (± 3088609) 354421741 ns/iter (± 1969213) 0.91
mono_points_arrow/decode_log_msg 174191655 ns/iter (± 821289) 183898147 ns/iter (± 955174) 0.95
mono_points_arrow/decode_message_bundles 61822021 ns/iter (± 1017663) 74763783 ns/iter (± 912654) 0.83
mono_points_arrow/decode_total 236279081 ns/iter (± 1625218) 256548802 ns/iter (± 1649946) 0.92
batch_points_arrow/generate_message_bundles 317957 ns/iter (± 242) 318498 ns/iter (± 897) 1.00
batch_points_arrow/generate_messages 6109 ns/iter (± 19) 6145 ns/iter (± 16) 0.99
batch_points_arrow/encode_log_msg 360397 ns/iter (± 1402) 366155 ns/iter (± 1499) 0.98
batch_points_arrow/encode_total 708681 ns/iter (± 1286) 715970 ns/iter (± 4210) 0.99
batch_points_arrow/decode_log_msg 343083 ns/iter (± 662) 348352 ns/iter (± 1066) 0.98
batch_points_arrow/decode_message_bundles 2076 ns/iter (± 8) 2067 ns/iter (± 11) 1.00
batch_points_arrow/decode_total 353207 ns/iter (± 530) 355217 ns/iter (± 1003) 0.99
arrow_mono_points/insert 5985380036 ns/iter (± 12515274) 7027707613 ns/iter (± 20467739) 0.85
arrow_mono_points/query 1725116 ns/iter (± 14642) 1713386 ns/iter (± 14194) 1.01
arrow_batch_points/insert 2643889 ns/iter (± 7633) 2609538 ns/iter (± 9836) 1.01
arrow_batch_points/query 17007 ns/iter (± 44) 16972 ns/iter (± 96) 1.00
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.