fix(scene): unfreeze open on huge xref Inserts
A real DWG with an xref containing ~74k sub-entities froze on the first render: Insert tessellation exploded the block, style-resolved every sub serially, and one bad sub could hang the loop forever. - Insert short-circuits to an insertion marker when the referenced block has more than INSERT_SUB_LIMIT (5_000) sub-entities. Documented as temporary in RENDERING_OPTIMIZATION.md. - Re-run purge_corrupt_entities after resolve_xrefs so parser-garbage inside xref content is caught (initial purge runs before xref load). - build_derived_caches: single pass over entities collecting handles per kind; tessellation reads via doc.get_entity instead of cloning every EntityType. Image decode now parallel too. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
2e985fdc9c
commit
c61d648dc7
3 changed files with 119 additions and 32 deletions
|
|
@ -132,6 +132,17 @@ impl H7CAD {
|
|||
if let Some(base_dir) = path.parent() {
|
||||
let xrefs =
|
||||
crate::io::xref::resolve_xrefs(&mut self.tabs[i].scene.document, base_dir);
|
||||
// xref content arrives un-purged: parser-garbage entities
|
||||
// inside the referenced file can trigger infinite loops in
|
||||
// tessellation. Run the corrupt-entity guard again.
|
||||
let extra_dropped = crate::io::purge_corrupt_entities(
|
||||
&mut self.tabs[i].scene.document,
|
||||
);
|
||||
if extra_dropped > 0 {
|
||||
self.command_line.push_error(&format!(
|
||||
"Warning: {extra_dropped} corrupt xref entities dropped"
|
||||
));
|
||||
}
|
||||
for info in &xrefs {
|
||||
match info.status {
|
||||
crate::io::xref::XrefStatus::Loaded => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue