From 901716adc8aafc9605b97dc3b518be865bc97023 Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Mon, 30 Mar 2015 20:27:18 +0200
Subject: [PATCH] Bugfix: the object parts editor is opened in invalid status
 until user clicks on a tree list item. #2762

---
 lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
index 9956134ce..402989f9e 100644
--- a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
+++ b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
@@ -136,9 +136,13 @@ sub reload_tree {
     }
     $tree->ExpandAll;
     
-    # This will trigger the selection_changed() event
     Slic3r::GUI->CallAfter(sub {
         $self->{tree}->SelectItem($selectedId);
+        
+        # SelectItem() should trigger EVT_TREE_SEL_CHANGED as per wxWidgets docs,
+        # but in fact it doesn't if the given item is already selected (this happens
+        # on first load)
+        $self->selection_changed;
     });
 }