feat(properties): show XDATA records in Properties panel
This commit is contained in:
parent
a67affcb93
commit
86a29b4b97
3 changed files with 49 additions and 0 deletions
|
|
@ -2563,6 +2563,7 @@ properties =
|
||||||
.ext-line-lineweight = Ext line lineweight
|
.ext-line-lineweight = Ext line lineweight
|
||||||
.ext-line-offset = Ext line offset
|
.ext-line-offset = Ext line offset
|
||||||
.extended-entity = Extended Entity
|
.extended-entity = Extended Entity
|
||||||
|
.extended-data = Extended Data
|
||||||
.extended-lighting = Extended Lighting
|
.extended-lighting = Extended Lighting
|
||||||
.extents-max = Extents Max
|
.extents-max = Extents Max
|
||||||
.extents-min = Extents Min
|
.extents-min = Extents Min
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,27 @@ fn visual_style_properties_text(style: &acadrust::objects::VisualStyle) -> Strin
|
||||||
.join("\n")
|
.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Format an XDATA value for display in the Properties panel.
|
||||||
|
fn format_xdata_value(value: &acadrust::xdata::XDataValue) -> String {
|
||||||
|
use acadrust::xdata::XDataValue;
|
||||||
|
match value {
|
||||||
|
XDataValue::String(s) => s.clone(),
|
||||||
|
XDataValue::ControlString(s) => format!("ControlString: {s}"),
|
||||||
|
XDataValue::LayerName(s) => format!("Layer: {s}"),
|
||||||
|
XDataValue::BinaryData(b) => format!("Binary: {} bytes", b.len()),
|
||||||
|
XDataValue::Handle(h) => format!("Handle: {:X}", h.value()),
|
||||||
|
XDataValue::Point3D(v)
|
||||||
|
| XDataValue::Position3D(v)
|
||||||
|
| XDataValue::Displacement3D(v)
|
||||||
|
| XDataValue::Direction3D(v) => format!("{:.6}, {:.6}, {:.6}", v.x, v.y, v.z),
|
||||||
|
XDataValue::Real(r) | XDataValue::Distance(r) | XDataValue::ScaleFactor(r) => {
|
||||||
|
format!("{r}")
|
||||||
|
}
|
||||||
|
XDataValue::Integer16(i) => format!("{i}"),
|
||||||
|
XDataValue::Integer32(i) => format!("{i}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl OpenCADStudio {
|
impl OpenCADStudio {
|
||||||
/// Rebuild the PropertiesPanel from the current entity selection.
|
/// Rebuild the PropertiesPanel from the current entity selection.
|
||||||
/// Preserves UI state (open pickers, edit buffer) across refreshes.
|
/// Preserves UI state (open pickers, edit buffer) across refreshes.
|
||||||
|
|
@ -613,6 +634,32 @@ impl OpenCADStudio {
|
||||||
entity,
|
entity,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Extended Data (XDATA) section: show attached app records.
|
||||||
|
{
|
||||||
|
use crate::entities::common::ro_prop;
|
||||||
|
let xd = &source_entity.common().extended_data;
|
||||||
|
if !xd.is_empty() {
|
||||||
|
let mut xd_props = Vec::new();
|
||||||
|
for rec in xd.records() {
|
||||||
|
let value_text = rec
|
||||||
|
.values
|
||||||
|
.iter()
|
||||||
|
.map(format_xdata_value)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", ");
|
||||||
|
xd_props.push(ro_prop(
|
||||||
|
&rec.application_name,
|
||||||
|
"xdata_value",
|
||||||
|
value_text,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
sections.push(crate::scene::model::object::PropSection {
|
||||||
|
title: t!("Extended Data").into_owned(),
|
||||||
|
props: xd_props,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Uniform-scale checkbox for block references (#427):
|
// Uniform-scale checkbox for block references (#427):
|
||||||
// while the three scale factors are equal (and the user
|
// while the three scale factors are equal (and the user
|
||||||
// hasn't opted into per-axis editing) the panel shows one
|
// hasn't opted into per-axis editing) the panel shows one
|
||||||
|
|
|
||||||
|
|
@ -1006,6 +1006,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
|
||||||
"Ext line offset" => Some(("properties", "ext-line-offset")),
|
"Ext line offset" => Some(("properties", "ext-line-offset")),
|
||||||
"Ext line weight (DIMLWE)" => Some(("draw", "ext-line-weight-dimlwe")),
|
"Ext line weight (DIMLWE)" => Some(("draw", "ext-line-weight-dimlwe")),
|
||||||
"Extend" => Some(("modify", "extend")),
|
"Extend" => Some(("modify", "extend")),
|
||||||
|
"Extended Data" => Some(("properties", "extended-data")),
|
||||||
"Extended Entity" => Some(("properties", "extended-entity")),
|
"Extended Entity" => Some(("properties", "extended-entity")),
|
||||||
"Extended Lighting" => Some(("properties", "extended-lighting")),
|
"Extended Lighting" => Some(("properties", "extended-lighting")),
|
||||||
"Extension" => Some(("common", "extension")),
|
"Extension" => Some(("common", "extension")),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue