Skip to content

Commit

Permalink
addressing reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Dec 15, 2023
1 parent fbd7752 commit d397007
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/re_data_source/src/data_loader/loader_archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fn load_point_cloud(
{
// TODO(#4532): `.ply` data loader should support 2D point cloud & meshes
let points3d = re_types::archetypes::Points3D::from_file_contents(contents)?;
DataRow::from_archetype(RowId::new(), timepoint, entity_path.clone(), &points3d)?
DataRow::from_archetype(RowId::new(), timepoint, entity_path, &points3d)?
},
//
];
Expand Down
1 change: 0 additions & 1 deletion crates/re_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ half = { workspace = true, features = ["bytemuck"] }
infer.workspace = true
itertools.workspace = true
linked-hash-map.workspace = true
mime_guess.workspace = true
mime_guess2.workspace = true
ndarray.workspace = true
once_cell.workspace = true
Expand Down
8 changes: 6 additions & 2 deletions crates/re_types/src/archetypes/points3d_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl Points3D {
///
/// The media type will be inferred from the path (extension), or the contents if that fails.
#[cfg(not(target_arch = "wasm32"))]
pub fn from_file(filepath: &std::path::Path) -> anyhow::Result<Self> {
pub fn from_file_path(filepath: &std::path::Path) -> anyhow::Result<Self> {
use anyhow::Context as _;

let file = std::fs::File::open(filepath)
Expand All @@ -38,6 +38,8 @@ impl Points3D {
}

fn from_ply(ply: &ply_rs::ply::Ply<ply_rs::ply::DefaultElement>) -> Points3D {
re_tracing::profile_function!();

use std::borrow::Cow;

use linked_hash_map::LinkedHashMap;
Expand Down Expand Up @@ -125,6 +127,7 @@ fn from_ply(ply: &ply_rs::ply::Ply<ply_rs::ply::DefaultElement>) -> Points3D {
const PROP_RED: &str = "red";
const PROP_GREEN: &str = "green";
const PROP_BLUE: &str = "blue";
const PROP_ALPHA: &str = "alpha";
const PROP_RADIUS: &str = "radius";
const PROP_LABEL: &str = "label";

Expand All @@ -148,7 +151,8 @@ fn from_ply(ply: &ply_rs::ply::Ply<ply_rs::ply::DefaultElement>) -> Points3D {
props.get(PROP_GREEN).and_then(u8),
props.get(PROP_BLUE).and_then(u8),
) {
this.color = Some(Color::new((r, g, b)));
let a = props.get(PROP_ALPHA).and_then(u8).unwrap_or(255);
this.color = Some(Color::new((r, g, b, a)));
};

if let Some(radius) = props.get(PROP_RADIUS).and_then(f32) {
Expand Down

0 comments on commit d397007

Please sign in to comment.