forked from 1b-agent/opencadstudio-upstream
Point clouds: scan and region visibility in the cloud record
The manager's switches write the cloud's hidden scans (by the scan identifier its project and scan file carry) and hidden regions (the unassigned points are region 0), as the reference stores them, instead of extended data. A parent switch shows mixed while some of its rows are on. A cloud that shows none of its points draws its extents box. The codec reads and writes both lists. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ae3868944a
commit
09e9e44c19
11 files changed
+147
-86
No files matched your search
@@ -39,7 +39,7 @@ impl OpenCADStudio {
|
||||
data,
|
||||
color,
|
||||
None,
|
||||
&crate::scene::model::point_cloud::hidden(common),
|
||||
&crate::scene::model::point_cloud::hidden(data),
|
||||
) {
|
||||
clouds.push((common.handle, placed));
|
||||
}
|
||||
|
||||
@@ -162,11 +162,11 @@ impl OpenCADStudio {
|
||||
self.refresh_properties();
|
||||
}
|
||||
|
||||
/// A Point Cloud Manager click: a switch writes the cloud's visibility
|
||||
/// extended data as one undo step; the rest is palette state.
|
||||
/// A Point Cloud Manager click: a switch writes the cloud's hidden scans
|
||||
/// and regions as one undo step; the rest is palette state.
|
||||
pub(in crate::app) fn update_pc_manager(&mut self, message: crate::ui::window::pc_manager::PcManagerMsg) -> Task<Message> {
|
||||
use crate::scene::model::point_cloud::VISIBILITY_APP;
|
||||
use crate::ui::window::pc_manager::{self, PcManagerMsg};
|
||||
use crate::scene::model::point_cloud::UNASSIGNED_OFF;
|
||||
use crate::ui::window::pc_manager::{self, PcManagerMsg, Row};
|
||||
let i = self.active_tab;
|
||||
match message {
|
||||
PcManagerMsg::Toggle(handle, row) => {
|
||||
@@ -178,22 +178,19 @@ impl OpenCADStudio {
|
||||
if self.tabs[i].scene.is_layer_locked(handle) {
|
||||
return Task::none();
|
||||
}
|
||||
// A scan named by its file name (automation) is the scan with that name.
|
||||
let row = match row {
|
||||
Row::Scan(key) => Row::Scan(
|
||||
cloud.scans.iter().find(|(name, _)| *name == key).map_or(key, |(_, id)| id.clone()),
|
||||
),
|
||||
row => row,
|
||||
};
|
||||
let hidden = pc_manager::toggled(&cloud.hidden, &cloud.scans, &row);
|
||||
self.push_undo_snapshot(i, "POINTCLOUDMANAGER");
|
||||
self.tabs[i].scene.ensure_app_id(VISIBILITY_APP);
|
||||
let app_handle = self.tabs[i].scene.document.app_ids.get(VISIBILITY_APP).map(|a| a.handle.value());
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
let data = &mut entity.common_mut().extended_data;
|
||||
if let Some(app) = app_handle {
|
||||
data.raw_dwg_eed.retain(|(a, _)| *a != app);
|
||||
}
|
||||
data.remove_record(VISIBILITY_APP);
|
||||
if !hidden.is_empty() {
|
||||
let mut record = codec::xdata::ExtendedDataRecord::new(VISIBILITY_APP);
|
||||
for name in hidden {
|
||||
record.add_value(codec::xdata::XDataValue::String(name));
|
||||
}
|
||||
data.add_record(record);
|
||||
if let Some(codec::EntityType::Extended(extended)) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
if let codec::entities::ExtendedEntityData::PointCloudEx(data) = &mut extended.data {
|
||||
data.hidden_regions = if hidden.iter().any(|h| h == UNASSIGNED_OFF) { vec![0] } else { Vec::new() };
|
||||
data.hidden_scans = hidden.into_iter().filter(|h| h != UNASSIGNED_OFF).collect();
|
||||
}
|
||||
}
|
||||
self.tabs[i].scene.bump_entities(&[(handle, crate::scene::ChangeKind::Modified)]);
|
||||
|
||||
@@ -146,8 +146,8 @@ impl OpenCADStudio {
|
||||
name,
|
||||
show_intensity: false,
|
||||
show_cropping: true,
|
||||
unknown_bl0: 0,
|
||||
unknown_bl1: 0,
|
||||
hidden_scans: Vec::new(),
|
||||
hidden_regions: Vec::new(),
|
||||
stylization_type: 1,
|
||||
intensity_color_scheme: String::new(),
|
||||
current_color_scheme: String::new(),
|
||||
|
||||
Reference in new issue
Block a user