diff --git a/src/app/properties.rs b/src/app/properties.rs index 4c9568378..d6a219414 100644 --- a/src/app/properties.rs +++ b/src/app/properties.rs @@ -74,6 +74,39 @@ impl OpenCADStudio { let mut sections = dispatch::properties_sectioned(handle, entity, &text_style_names); + // Resolve a custom material handle (material_flags == 3) to + // its name in the 3D Visualization group. + { + let common = entity.common(); + if common.material_flags == 3 { + if let Some(mh) = common.material_handle { + if let Some(name) = self.tabs[i] + .scene + .document + .objects + .iter() + .find_map(|(h, o)| match o { + acadrust::objects::ObjectType::Material(m) if *h == mh => { + Some(m.name.clone()) + } + _ => None, + }) + { + for section in sections.iter_mut() { + if let Some(row) = + section.props.iter_mut().find(|p| p.field == "material") + { + row.value = + crate::scene::model::object::PropValue::ReadOnly( + name.clone(), + ); + } + } + } + } + } + } + // Inject viewport-only properties that require doc access. if let acadrust::EntityType::Viewport(vp) = entity { let frozen_names: Vec = vp diff --git a/src/scene/cache/properties.rs b/src/scene/cache/properties.rs index 36f6d3c57..ebafc0a67 100644 --- a/src/scene/cache/properties.rs +++ b/src/scene/cache/properties.rs @@ -11,6 +11,18 @@ pub fn general_section(entity: &EntityType) -> PropSection { }; let transp_pct = (common.transparency.alpha() as f64 / 255.0 * 100.0).round() as u32; + // Hyperlink is stored in XDATA under the "PE_URL" application. + let hyperlink = common + .extended_data + .get_record("PE_URL") + .and_then(|r| { + r.values.iter().find_map(|v| match v { + acadrust::xdata::XDataValue::String(s) if !s.is_empty() => Some(s.clone()), + _ => None, + }) + }) + .unwrap_or_default(); + PropSection { title: "General".into(), props: vec![ @@ -64,7 +76,7 @@ pub fn general_section(entity: &EntityType) -> PropSection { Property { label: "Hyperlink".into(), field: "hyperlink", - value: PropValue::ReadOnly(String::new()), + value: PropValue::ReadOnly(hyperlink), }, Property { label: "Invisible".into(),