diff --git a/src/io/xref.rs b/src/io/xref.rs index d8a83de73..8a00bcfe5 100644 --- a/src/io/xref.rs +++ b/src/io/xref.rs @@ -34,28 +34,25 @@ pub struct XrefInfo { /// /// Returns a list of [`XrefInfo`] describing each xref block found. pub fn resolve_xrefs(doc: &mut CadDocument, base_dir: &Path) -> Vec { - // Collect xref blocks: (name, raw_path, block_record_handle, is_loaded) - // is_loaded == Some(false) means the host DWG marked this xref Unloaded - // via XREF→Unload; respect that and skip reading the external file. - let xref_entries: Vec<(String, String, Handle, Option)> = doc + // Collect xref blocks: (name, raw_path, block_record_handle) + // + // Note: `BlockRecord::is_loaded` (the DWG R2000+ "loaded" bit) turned out + // to be unreliable as a signal of AutoCAD's Unload state — different + // files with xrefs the manager calls "Loaded" carry both `Some(true)` + // and `Some(false)` on disk. Until we identify the actual on-disk + // representation of XREF→Unload (likely in an XREF dependency record + // or ACAD_XREF_PANEL_DATA xrecord), we auto-resolve every xref and + // rely on frustum culling to keep the GPU bounded. + let xref_entries: Vec<(String, String, Handle)> = doc .block_records .iter() .filter(|br| (br.flags.is_xref || br.flags.is_xref_overlay) && !br.xref_path.is_empty()) - .map(|br| (br.name.clone(), br.xref_path.clone(), br.handle, br.is_loaded)) + .map(|br| (br.name.clone(), br.xref_path.clone(), br.handle)) .collect(); let mut result = Vec::new(); - for (block_name, raw_path, br_handle, is_loaded) in xref_entries { - if is_loaded == Some(false) { - result.push(XrefInfo { - name: block_name, - path: raw_path, - status: XrefStatus::Unloaded, - }); - continue; - } - + for (block_name, raw_path, br_handle) in xref_entries { let resolved = resolve_path(&raw_path, base_dir); let status = match &resolved {