forked from 1b-agent/opencadstudio-upstream
Count: measured messages and listing, groups, Current area, boundary checks, fills and solids recoloured
- COUNTCOLOR / COUNTERRORCOLOR / COUNTSERVICE reject any other value with the range message; COUNTTABLE ? lists in the reference order, padded, 22 lines a page with Press ENTER to continue:, then the totals. - Target picks report N found / N found, M total; several objects (or one that is not a block reference) count their copies, shown as Geometries in the palette. - Current area is the area in use (kept aside by Entire model space), otherwise all of model space; an invalid Object boundary ends with the reference message. - Count colours reach solids and fills; the palette list and the count are recomputed only when the drawing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d830e40bfa
commit
0a26709d13
31 files changed
+214
-60
No files matched your search
@@ -1451,6 +1451,7 @@ impl Scene {
|
||||
}
|
||||
}
|
||||
}
|
||||
m.color = self.count_color(handle, m.color, self.current_bg());
|
||||
if tint_selected && self.selected.contains(&handle) {
|
||||
m.color = [0.15, 0.55, 1.00, m.color[3]];
|
||||
}
|
||||
@@ -1752,6 +1753,7 @@ impl Scene {
|
||||
)
|
||||
});
|
||||
}
|
||||
model.color = self.count_color(context.root_handle, model.color, hatch_bg);
|
||||
if tint_selected && self.selected.contains(&context.root_handle) {
|
||||
model.color = [0.15, 0.55, 1.00, model.color[3]];
|
||||
}
|
||||
|
||||
+31
-2
@@ -4007,6 +4007,9 @@ impl Scene {
|
||||
);
|
||||
}
|
||||
}
|
||||
if self.meshes.contains_key(&h) {
|
||||
material.diffuse = self.count_color(h, material.diffuse, bg);
|
||||
}
|
||||
(h, material)
|
||||
})
|
||||
})
|
||||
@@ -4108,9 +4111,28 @@ impl Scene {
|
||||
return;
|
||||
}
|
||||
self.count_display = display;
|
||||
self.hatch_cache.borrow_mut().clear();
|
||||
self.recolor_meshes();
|
||||
self.bump_geometry_no_blocks();
|
||||
}
|
||||
|
||||
/// The colour count mode gives an object drawn as part of `handle` (a
|
||||
/// top-level entity): the count colours, else faded; unchanged outside
|
||||
/// count mode.
|
||||
pub(crate) fn count_color(&self, handle: Handle, color: [f32; 4], bg: [f32; 4]) -> [f32; 4] {
|
||||
let Some(count) = &self.count_display else {
|
||||
return color;
|
||||
};
|
||||
let [r, g, b, _] = if count.errors.contains(&handle) {
|
||||
count.error_color
|
||||
} else if count.counted.contains(&handle) {
|
||||
count.color
|
||||
} else {
|
||||
return crate::scene::cache::block_cache::fade_toward_bg(color, bg);
|
||||
};
|
||||
[r, g, b, color[3]]
|
||||
}
|
||||
|
||||
/// Fade the colours of wires that belong to entities outside the REFEDIT
|
||||
/// keep set (no-op when not editing). The geometry is untouched, so
|
||||
/// hit-testing still works on faded entities. In count mode the counted
|
||||
@@ -4118,8 +4140,7 @@ impl Scene {
|
||||
fn apply_refedit_fade(&self, wires: &mut [WireModel], bg: [f32; 4]) {
|
||||
if let Some(count) = &self.count_display {
|
||||
for w in wires.iter_mut() {
|
||||
let h = Self::handle_from_wire_name(&w.name);
|
||||
w.color = match h {
|
||||
w.color = match Self::handle_from_wire_name(&w.name) {
|
||||
Some(h) if count.errors.contains(&h) => count.error_color,
|
||||
Some(h) if count.counted.contains(&h) => count.color,
|
||||
_ => crate::scene::cache::block_cache::fade_toward_bg(w.color, bg),
|
||||
@@ -8745,6 +8766,14 @@ impl Scene {
|
||||
self.material_base_dir.as_deref(),
|
||||
);
|
||||
}
|
||||
if self.count_display.is_some() {
|
||||
let own = transformed.instance_color.or(set.display_color()).unwrap_or([1.0; 4]);
|
||||
let color = self.count_color(context.root_handle, own, self.current_bg());
|
||||
transformed.instance_color = Some(color);
|
||||
if let Some(material) = transformed.material.as_mut() {
|
||||
material.diffuse = color;
|
||||
}
|
||||
}
|
||||
transformed.instance_handle = Some(context.root_handle);
|
||||
out.push(transformed);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user