feat: apply Lookup rows to block references

Expose writable Lookup outputs as reference choices and materialize each selected row's parameter geometry.
This commit is contained in:
Karim Jerbi committed 2026-10-17 23:57:58 +01:00
1 parent ba457d693c
commit 86c0e05878
5 files changed
+296 -8

No files matched your search

+14 -5
View File
@@ -915,10 +915,15 @@ impl OpenCADStudio {
xref_rows(&mut sections, ins, &br.xref_path, factor, overrides);
}
// A dynamic block's visibility states, picked like its grip.
if let Some(row) = Self::visibility_property(doc, handle) {
let mut custom_properties = Vec::new();
custom_properties.extend(Self::visibility_property(doc, handle));
if let Some(row) = crate::scene::block_lookup::reference_property(doc, handle) {
custom_properties.push(row);
}
if !custom_properties.is_empty() {
sections.push(crate::scene::model::object::PropSection {
title: t!("Custom").into_owned(),
props: vec![row],
props: custom_properties,
});
}
// An associative array's counts and spacings.
@@ -1601,8 +1606,9 @@ impl OpenCADStudio {
// text derives its paper height from the two endpoints,
// while annotative text exposes that paper height and a
// separate calculated model height.
if let Some(factor) =
self.tabs[i].scene.annotative_text_height_factor(entity.common().handle)
if let Some(factor) = self.tabs[i]
.scene
.annotative_text_height_factor(entity.common().handle)
{
// Annotative text stores the model height of its default scale;
// the Height row edits the paper height at the displayed scale.
@@ -1633,7 +1639,10 @@ impl OpenCADStudio {
for section in sections.iter_mut() {
if let Some(row) = section.props.iter_mut().find(|row| row.field == "height") {
let editable = !aligned
&& !matches!(row.value, crate::scene::model::object::PropValue::ReadOnly(_));
&& !matches!(
row.value,
crate::scene::model::object::PropValue::ReadOnly(_)
);
*row = crate::entities::common::num_prop(
t!("Paper text height").as_ref(),
"height",
+26
View File
@@ -3408,6 +3408,32 @@ impl OpenCADStudio {
self.apply_visibility_state(handle, state);
}
}
} else if field == "dyn_lookup" {
self.tabs[i].properties.edit_choice_open = false;
let mut changed = false;
for &handle in &handles {
if self.tabs[i].scene.is_layer_locked(handle) {
continue;
}
let result = crate::scene::block_lookup::evaluate_reference_choice(
&self.tabs[i].scene.document,
handle,
&value,
);
match result {
Ok(Some(staged)) => {
self.apply_action_document(i, staged);
self.tabs[i].scene.bump_geometry();
self.tabs[i].dirty = true;
changed = true;
}
Ok(None) => {}
Err(error) => self.command_line.push_error(crate::t!(error).as_ref()),
}
}
if changed {
self.finish_pending_history(i);
}
} else if field == "block" {
// Name dropdown on a block reference: re-point the
// selected inserts to the picked definition. A stale