feat(properties): editable Annotative toggle for MText and MLeader

The Annotative row becomes an editable toggle for the two entity types that
carry a native per-object annotative flag — MTEXT (is_annotative) and
MULTILEADER (enable_annotation_scale). Turning it on flags the object
annotative (it then scales with the current annotation scale in model space);
turning it off clears the flag AND removes the per-object annotation context
(the AcDbContextDataManager -> ACDB_ANNOTATIONSCALES leaf subtree) plus the
legacy annotative XDATA markers, via scene::annotative::set_entity_annotative /
clear_annotation_context, so the object stops resolving annotative instead of
staying on through a stale context. The shared SCALE objects are left intact.

Style-derived types (text/dimension/leader/table/insert) keep a read-only
Annotative row — their state comes from the assigned style, and making a single
object annotative there needs a per-object context object (a dedicated
acadrust ObjectContextData writer) which is out of scope here. Verified an
existing annotative DWG round-trips its 134 per-object contexts through a
save/reload unchanged, so the far more common open-and-save path is unaffected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-13 09:32:22 +03:00
1 parent fb8e2aeec1
commit fc5e93dcc1
3 files changed
+105 -14

No files matched your search

+19 -7
View File
@@ -680,14 +680,26 @@ impl OpenCADStudio {
),
);
}
// The read-only text rows get an explicit Yes/No; MLeader
// keeps its editable toggle.
// MTEXT carries a per-object annotative flag, so its
// row is an editable toggle (like MLeader's); the
// style-derived types stay read-only Yes/No.
if anno_field == "annotative" {
set_row(
&mut sections,
"annotative",
if is_anno { "Yes" } else { "No" }.to_string(),
);
if let acadrust::EntityType::MText(t) = entity {
set_row_value(
&mut sections,
"annotative",
crate::scene::model::object::PropValue::BoolToggle {
field: "is_annotative",
value: t.is_annotative,
},
);
} else {
set_row(
&mut sections,
"annotative",
if is_anno { "Yes" } else { "No" }.to_string(),
);
}
}
if is_anno {
// The applied annotation scale follows the current
+32 -7
View File
@@ -2296,14 +2296,39 @@ impl OpenCADStudio {
if !handles.is_empty() {
self.push_undo_snapshot(i, "CHPROP");
for &handle in &handles {
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
match field {
"invisible" => {
crate::scene::view::dispatch::toggle_invisible(entity)
match field {
// Per-object annotative flag (MTEXT / MULTILEADER): a
// doc-aware toggle so turning it off also removes the
// per-object annotation context, not just the flag.
"is_annotative" | "enable_annotation_scale" => {
let cur = match self.tabs[i].scene.document.get_entity(handle) {
Some(acadrust::EntityType::MText(t)) => t.is_annotative,
Some(acadrust::EntityType::MultiLeader(m)) => {
m.enable_annotation_scale
}
_ => continue,
};
crate::scene::annotative::set_entity_annotative(
&mut self.tabs[i].scene.document,
handle,
!cur,
);
}
"invisible" => {
if let Some(entity) =
self.tabs[i].scene.document.get_entity_mut(handle)
{
crate::scene::view::dispatch::toggle_invisible(entity);
}
}
_ => {
if let Some(entity) =
self.tabs[i].scene.document.get_entity_mut(handle)
{
crate::scene::view::dispatch::apply_geom_prop(
entity, field, "toggle",
);
}
_ => crate::scene::view::dispatch::apply_geom_prop(
entity, field, "toggle",
),
}
}
}