From 0cd991e42f2382c0c8ef1906f03909a9d03a3127 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 21 Jul 2026 15:59:26 +0300 Subject: [PATCH] fix(xref): show merged xref layers in Layer Manager on attach (#407) XATTACH / XRELOAD merge the xref's layer and linetype tables into the document, but the Layers panel cache only rebuilds via sync_with_viewports - which nothing triggered until the file was saved and reopened. Refresh the layer panel (and ribbon mirrors) right after the merge in both paths. Co-Authored-By: Claude Fable 5 --- src/app/command_driver.rs | 4 ++++ src/app/commands/blocks.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/app/command_driver.rs b/src/app/command_driver.rs index a56bbc601..605f7081d 100644 --- a/src/app/command_driver.rs +++ b/src/app/command_driver.rs @@ -396,6 +396,10 @@ impl OpenCADStudio { &mut self.tabs[i].scene, &path, ); + // Resolving the xref merged its layer / linetype tables + // into the document — mirror them into the Layers panel + // and ribbon dropdowns now, not on the next reopen (#407). + self.refresh_layer_panel(); } // Record where this draw ended so ARC_CONT can continue from it // (before `entity` is moved into commit_entity). diff --git a/src/app/commands/blocks.rs b/src/app/commands/blocks.rs index f7e871ac9..0abc2e227 100644 --- a/src/app/commands/blocks.rs +++ b/src/app/commands/blocks.rs @@ -540,6 +540,10 @@ impl OpenCADStudio { self.tabs[i].scene.populate_hatches_from_document(); self.tabs[i].scene.populate_images_from_document(); self.tabs[i].scene.populate_meshes_from_document(); + // The reload may have merged new xref layers / + // linetypes — mirror them into the Layers panel and + // ribbon dropdowns (#407). + self.refresh_layer_panel(); } } else { self.command_line