diff --git a/Cargo.lock b/Cargo.lock index bf5ba4f9234c..d3a6042231fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4745,6 +4745,7 @@ dependencies = [ "re_log", "re_log_types", "re_query", + "re_query2", "re_tracing", "re_types", "re_types_core", @@ -4814,6 +4815,7 @@ dependencies = [ "re_log_types", "re_query", "re_query_cache", + "re_query_cache2", "re_renderer", "re_space_view", "re_tracing", diff --git a/crates/re_space_view_spatial/src/contexts/transform_context.rs b/crates/re_space_view_spatial/src/contexts/transform_context.rs index 26c725e57cbb..24b6131ebdc4 100644 --- a/crates/re_space_view_spatial/src/contexts/transform_context.rs +++ b/crates/re_space_view_spatial/src/contexts/transform_context.rs @@ -3,7 +3,7 @@ use nohash_hasher::IntMap; use re_data_store::LatestAtQuery; use re_entity_db::{EntityDb, EntityPath, EntityPropertyMap, EntityTree}; use re_types::{ - components::{DisconnectedSpace, PinholeProjection, Resolution, Transform3D, ViewCoordinates}, + components::{DisconnectedSpace, PinholeProjection, Transform3D, ViewCoordinates}, ComponentNameSet, Loggable as _, }; use re_viewer_context::{IdentifiedViewSystem, ViewContextSystem}; @@ -296,17 +296,9 @@ fn get_cached_transform( entity_db: &EntityDb, query: &LatestAtQuery, ) -> Option { - let mut transform3d = None; entity_db - .query_caches() - .query_archetype_latest_at_pov1_comp0::( - entity_db.store(), - query, - entity_path, - |(_, _, transforms)| transform3d = transforms.first().cloned(), - ) - .ok(); - transform3d + .latest_at_component::(entity_path, query) + .map(|res| res.value) } fn get_cached_pinhole( @@ -314,19 +306,16 @@ fn get_cached_pinhole( entity_db: &EntityDb, query: &re_data_store::LatestAtQuery, ) -> Option<(PinholeProjection, ViewCoordinates)> { - let mut result = None; - entity_db.query_caches() - .query_archetype_latest_at_pov1_comp2::( - entity_db.store(), - query, - entity_path, - |(_, _, image_from_camera, _resolution, camera_xyz)| { - result = image_from_camera.first().map(|image_from_camera| - (*image_from_camera, camera_xyz.and_then(|c| c.first()).cloned().flatten().unwrap_or(ViewCoordinates::RDF))); - } - ) - .ok(); - result + entity_db + .latest_at_archetype::(entity_path, query) + .ok() + .flatten() + .map(|arch| { + ( + arch.image_from_camera, + arch.camera_xyz.unwrap_or(ViewCoordinates::RDF), + ) + }) } fn transform_at( @@ -390,19 +379,9 @@ fn transform_at( }); let is_disconnect_space = || { - let mut disconnected_space = false; - entity_db.query_caches() - .query_archetype_latest_at_pov1_comp0::( - entity_db.store(), - query, - entity_path, - |(_, _, disconnected_spaces)| { - disconnected_space = disconnected_spaces - .first() .map_or(false, |dp| dp.0); - }, - ) - .ok(); - disconnected_space + entity_db + .latest_at_component::(entity_path, query) + .map_or(false, |res| res.value.0) }; // If there is any other transform, we ignore `DisconnectedSpace`. diff --git a/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs b/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs index 78d6de34efea..74b8dca7f9df 100644 --- a/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs +++ b/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs @@ -51,9 +51,6 @@ impl VisualizerSystem for Transform3DArrowsVisualizer { ) -> Result, SpaceViewSystemExecutionError> { let transforms = view_ctx.get::()?; - let query_caches = ctx.recording().query_caches(); - let store = ctx.recording_store(); - let latest_at_query = re_data_store::LatestAtQuery::new(query.timeline, query.latest_at); // Counting all transforms ahead of time is a bit wasteful, but we also don't expect a huge amount, @@ -66,16 +63,10 @@ impl VisualizerSystem for Transform3DArrowsVisualizer { continue; } - if query_caches - .query_archetype_latest_at_pov1_comp0::( - store, - &latest_at_query, - &data_result.entity_path, - |_| {}, - ) - // NOTE: Can only fail if the primary component is missing, which is what we - // want to check here (i.e.: there's no transform for this entity!). - .is_err() + if ctx + .recording() + .latest_at_component::(&data_result.entity_path, &latest_at_query) + .is_none() { continue; }