feat(properties): add 3D Visualization group + General Plot style/Hyperlink
Per the COMMON section of PROPERTIES.md. Insert a "3D Visualization" group (Material, Shadow display) after General for every graphical object, and add Plot style + Hyperlink rows to General. Material / plot style / shadow are sourced from the entity's flags (ByLayer / ByBlock / custom); resolving a custom material or plot-style handle to its name, and reading the hyperlink from XDATA, are follow-ups that need document access. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b9cebab951
commit
f4c60a39a9
2 changed files with 62 additions and 0 deletions
59
src/scene/cache/properties.rs
vendored
59
src/scene/cache/properties.rs
vendored
|
|
@ -39,6 +39,18 @@ pub fn general_section(entity: &EntityType) -> PropSection {
|
||||||
field: "linetype_scale",
|
field: "linetype_scale",
|
||||||
value: PropValue::EditText(format!("{:.4}", common.linetype_scale)),
|
value: PropValue::EditText(format!("{:.4}", common.linetype_scale)),
|
||||||
},
|
},
|
||||||
|
Property {
|
||||||
|
label: "Plot style".into(),
|
||||||
|
field: "plot_style",
|
||||||
|
value: PropValue::ReadOnly(
|
||||||
|
match common.plotstyle_flags {
|
||||||
|
0 => "ByLayer",
|
||||||
|
1 => "ByBlock",
|
||||||
|
_ => "ByColor",
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
),
|
||||||
|
},
|
||||||
Property {
|
Property {
|
||||||
label: "Lineweight".into(),
|
label: "Lineweight".into(),
|
||||||
field: "lineweight",
|
field: "lineweight",
|
||||||
|
|
@ -49,6 +61,11 @@ pub fn general_section(entity: &EntityType) -> PropSection {
|
||||||
field: "transparency",
|
field: "transparency",
|
||||||
value: PropValue::EditText(format!("{transp_pct}")),
|
value: PropValue::EditText(format!("{transp_pct}")),
|
||||||
},
|
},
|
||||||
|
Property {
|
||||||
|
label: "Hyperlink".into(),
|
||||||
|
field: "hyperlink",
|
||||||
|
value: PropValue::ReadOnly(String::new()),
|
||||||
|
},
|
||||||
Property {
|
Property {
|
||||||
label: "Invisible".into(),
|
label: "Invisible".into(),
|
||||||
field: "invisible",
|
field: "invisible",
|
||||||
|
|
@ -61,6 +78,48 @@ pub fn general_section(entity: &EntityType) -> PropSection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The "3D Visualization" group (Material + Shadow display), common to every
|
||||||
|
/// graphical object. Material / plot-style / shadow source is flag-based; a
|
||||||
|
/// custom material handle is shown as "Custom" (name resolution needs the doc).
|
||||||
|
pub fn visualization_section(entity: &EntityType) -> Option<PropSection> {
|
||||||
|
if matches!(
|
||||||
|
entity,
|
||||||
|
EntityType::Block(_)
|
||||||
|
| EntityType::BlockEnd(_)
|
||||||
|
| EntityType::Seqend(_)
|
||||||
|
| EntityType::Unknown(_)
|
||||||
|
) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let common = entity.common();
|
||||||
|
let material = match common.material_flags {
|
||||||
|
0 => "ByLayer",
|
||||||
|
1 => "ByBlock",
|
||||||
|
_ => "Custom",
|
||||||
|
};
|
||||||
|
let shadow = match common.shadow_flags {
|
||||||
|
0 => "Casts and Receives Shadows",
|
||||||
|
1 => "Casts Shadows",
|
||||||
|
2 => "Receives Shadows",
|
||||||
|
_ => "Ignores Shadows",
|
||||||
|
};
|
||||||
|
Some(PropSection {
|
||||||
|
title: "3D Visualization".into(),
|
||||||
|
props: vec![
|
||||||
|
Property {
|
||||||
|
label: "Material".into(),
|
||||||
|
field: "material",
|
||||||
|
value: PropValue::ReadOnly(material.into()),
|
||||||
|
},
|
||||||
|
Property {
|
||||||
|
label: "Shadow display".into(),
|
||||||
|
field: "shadow_display",
|
||||||
|
value: PropValue::ReadOnly(shadow.into()),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn fallback_properties(_handle: Handle, entity: &EntityType) -> PropSection {
|
pub fn fallback_properties(_handle: Handle, entity: &EntityType) -> PropSection {
|
||||||
PropSection {
|
PropSection {
|
||||||
title: "Geometry".into(),
|
title: "Geometry".into(),
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ pub fn properties_sectioned(
|
||||||
text_style_names: &[String],
|
text_style_names: &[String],
|
||||||
) -> Vec<PropSection> {
|
) -> Vec<PropSection> {
|
||||||
let mut sections = vec![properties::general_section(entity)];
|
let mut sections = vec![properties::general_section(entity)];
|
||||||
|
if let Some(viz) = properties::visualization_section(entity) {
|
||||||
|
sections.push(viz);
|
||||||
|
}
|
||||||
let groups = entity.geometry_properties(text_style_names);
|
let groups = entity.geometry_properties(text_style_names);
|
||||||
if groups.is_empty() {
|
if groups.is_empty() {
|
||||||
sections.push(properties::fallback_properties(handle, entity));
|
sections.push(properties::fallback_properties(handle, entity));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue