From 40c0edde8517a205baea9ed45013e040d1dccee8 Mon Sep 17 00:00:00 2001 From: Benjamin Jillich Date: Tue, 15 Feb 2022 14:48:15 +0100 Subject: [PATCH] EMotion FX: Automatically clear selection when closing skeleton outliner Signed-off-by: Benjamin Jillich --- .../Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp | 8 ++++---- .../Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp index ec8d1147f2..837acdad67 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp @@ -16,11 +16,8 @@ #include #include - namespace EMotionFX { - int SkeletonOutlinerPlugin::s_iconSize = 16; - SkeletonOutlinerPlugin::SkeletonOutlinerPlugin() : EMStudio::DockWidgetPlugin() , m_mainWidget(nullptr) @@ -30,13 +27,16 @@ namespace EMotionFX SkeletonOutlinerPlugin::~SkeletonOutlinerPlugin() { + // Reset selection on close. + m_skeletonModel->GetSelectionModel().clearSelection(); + m_skeletonModel.reset(); + for (MCore::Command::Callback* callback : m_commandCallbacks) { CommandSystem::GetCommandManager()->RemoveCommandCallback(callback, true); } m_commandCallbacks.clear(); - SkeletonOutlinerNotificationBus::Broadcast(&SkeletonOutlinerNotifications::SingleNodeSelectionChanged, nullptr, nullptr); EMotionFX::SkeletonOutlinerRequestBus::Handler::BusDisconnect(); } diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.h b/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.h index bdb4b24ab3..e28e275422 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.h +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.h @@ -19,7 +19,6 @@ #include #endif - QT_FORWARD_DECLARE_CLASS(QLabel) namespace EMotionFX @@ -73,7 +72,7 @@ namespace EMotionFX AZStd::unique_ptr m_skeletonModel; QModelIndexList m_selectedRows; SkeletonSortFilterProxyModel* m_filterProxyModel; - static int s_iconSize; + static constexpr int s_iconSize = 16; // Callbacks // Works for all commands that use the actor id as well as the joint name mixins