From 164d065b057eedee8297e1b62f4ef2ae24acbec5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 03:27:44 +0000 Subject: [PATCH] Defer SaveCachedPose node selection to ensure visual tree is ready Co-authored-by: LoogLong <86428208+LoogLong@users.noreply.github.com> --- FModel/Views/AnimGraphViewer.xaml.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/FModel/Views/AnimGraphViewer.xaml.cs b/FModel/Views/AnimGraphViewer.xaml.cs index 029cf430..471f90a9 100644 --- a/FModel/Views/AnimGraphViewer.xaml.cs +++ b/FModel/Views/AnimGraphViewer.xaml.cs @@ -810,12 +810,17 @@ public partial class AnimGraphViewer else AddLayerTab(targetLayer); - // Select and highlight the SaveCachedPose node in the target layer - if (_layerStates.TryGetValue(targetLayer, out var state) && - state.NodeVisuals.TryGetValue(savePoseNode, out var visual)) + // Select and highlight the SaveCachedPose node in the target layer. + // Use Dispatcher.BeginInvoke to ensure the visual tree is fully updated + // after the tab switch before attempting to select the node. + Dispatcher.BeginInvoke(() => { - SelectNode(savePoseNode, visual.border); - } + if (_layerStates.TryGetValue(targetLayer, out var state) && + state.NodeVisuals.TryGetValue(savePoseNode, out var visual)) + { + SelectNode(savePoseNode, visual.border); + } + }); } ///