Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary ordered-float #1461

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/re_data_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ document-features = "0.2"
itertools = "0.10"
nohash-hasher = "0.2"
once_cell = "1.15.0"
ordered-float = { version = "3.2", features = ["serde"] }
serde = { version = "1", features = ["derive", "rc"], optional = true }
thiserror = "1.0"

Expand Down
6 changes: 3 additions & 3 deletions crates/re_data_store/src/editable_auto_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#[serde(bound = "T: serde::Serialize, for<'de2> T: serde::Deserialize<'de2>")]
pub enum EditableAutoValue<T>
where
T: std::fmt::Debug + Eq + PartialEq + Clone + Default + serde::Serialize,
T: std::fmt::Debug + Clone + Default + PartialEq + serde::Serialize,
for<'de2> T: serde::Deserialize<'de2>,
{
/// The user explicitly specified what they wanted
Expand All @@ -17,7 +17,7 @@ where

impl<T> Default for EditableAutoValue<T>
where
T: std::fmt::Debug + Eq + PartialEq + Clone + Default + serde::Serialize,
T: std::fmt::Debug + Clone + Default + PartialEq + serde::Serialize,
for<'de2> T: serde::Deserialize<'de2>,
{
fn default() -> Self {
Expand All @@ -27,7 +27,7 @@ where

impl<T> EditableAutoValue<T>
where
T: std::fmt::Debug + Eq + PartialEq + Clone + Default + serde::Serialize,
T: std::fmt::Debug + Clone + Default + PartialEq + serde::Serialize,
for<'de2> T: serde::Deserialize<'de2>,
{
pub fn is_auto(&self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_data_store/src/entity_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl EntityPropertyMap {

// ----------------------------------------------------------------------------

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct EntityProperties {
Expand All @@ -42,7 +42,7 @@ pub struct EntityProperties {
/// Distance of the projection plane (frustum far plane).
///
/// Only applies to pinhole cameras when in a spatial view, using 3D navigation.
pub pinhole_image_plane_distance: EditableAutoValue<ordered_float::NotNan<f32>>,
pub pinhole_image_plane_distance: EditableAutoValue<f32>,
}

impl EntityProperties {
Expand Down
1 change: 0 additions & 1 deletion crates/re_viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ macaw = { workspace = true, features = ["with_serde"] }
mint = "0.5"
ndarray = "0.15"
nohash-hasher = "0.2"
ordered-float = { version = "3.2", features = ["serde"] }
poll-promise = "0.2"
rand = { version = "0.8", features = ["small_rng"] }
rfd = "0.11"
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/misc/transform_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn transform_at(
// Images are spanned in their local x/y space.
// Center it and move it along z, scaling the further we move.
let props = entity_properties.get(entity_path);
let distance: f32 = props.pinhole_image_plane_distance.get().into_inner();
let distance = *props.pinhole_image_plane_distance.get();

let focal_length = pinhole.focal_length_in_pixels();
let focal_length = glam::vec2(focal_length.x(), focal_length.y());
Expand Down
7 changes: 2 additions & 5 deletions crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,7 @@ fn entity_props_ui(
query_latest_single::<Transform>(&ctx.log_db.entity_db, entity_path, &query)
{
ui.label("Image plane distance");
let mut distance: f32 =
entity_props.pinhole_image_plane_distance.get().into_inner();
let mut distance = *entity_props.pinhole_image_plane_distance.get();
let speed = (distance * 0.05).at_least(0.01);
if ui
.add(
Expand All @@ -428,9 +427,7 @@ fn entity_props_ui(
.changed()
{
entity_props.pinhole_image_plane_distance =
EditableAutoValue::UserEdited(
ordered_float::NotNan::new(distance).unwrap(),
);
EditableAutoValue::UserEdited(distance);
}
ui.end_row();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl CamerasPart {
return;
};

let frustum_length: f32 = props.pinhole_image_plane_distance.get().into_inner();
let frustum_length = *props.pinhole_image_plane_distance.get();

scene.space_cameras.push(SpaceCamera3D {
entity_path: entity_path.clone(),
Expand Down
5 changes: 2 additions & 3 deletions crates/re_viewer/src/ui/view_spatial/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ impl ViewSpatialState {
.data_blueprints_individual()
.get(&entity_path);
if properties.pinhole_image_plane_distance.is_auto() {
properties.pinhole_image_plane_distance = EditableAutoValue::Auto(
ordered_float::NotNan::new(default_image_plane_distance).unwrap(),
);
properties.pinhole_image_plane_distance =
EditableAutoValue::Auto(default_image_plane_distance);
data_blueprint
.data_blueprints_individual()
.set(entity_path, properties);
Expand Down