You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWid...

79 lines
2.8 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <AzCore/std/containers/vector.h>
#include <MCore/Source/StandardHeaders.h>
#include <EMotionFX/CommandSystem/Source/SelectionCommands.h>
#include <EMotionStudio/Plugins/StandardPlugins/Source/StandardPluginsConfig.h>
#include <QDialog>
#endif
// forward declarations
QT_FORWARD_DECLARE_CLASS(QLabel)
QT_FORWARD_DECLARE_CLASS(QIcon)
QT_FORWARD_DECLARE_CLASS(QTreeWidget)
QT_FORWARD_DECLARE_CLASS(QTreeWidgetItem)
namespace AzQtComponents
{
class FilteredSearchWidget;
}
namespace EMotionFX
{
class SimulatedObject;
}
namespace EMStudio
{
class SimulatedObjectSelectionWidget
: public QWidget
{
Q_OBJECT // AUTOMOC
MCORE_MEMORYOBJECTCATEGORY(SimulatedObjectSelectionWidget, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH)
public:
SimulatedObjectSelectionWidget(QWidget* parent);
void Update(EMotionFX::Actor* actor, const AZStd::vector<AZStd::string>& selectedSimulatedObjectNames);
QTreeWidget* GetTreeWidget() { return m_treeWidget; }
AzQtComponents::FilteredSearchWidget* GetSearchWidget() { return m_searchWidget; }
// This calls UpdateSelection() and then returns the member array containing the selected items
AZStd::vector<AZStd::string>& GetSelectedSimulatedObjectNames();
signals:
void OnSelectionDone(const AZStd::vector<AZStd::string>& selectedItems);
void OnDoubleClicked(const AZStd::string& item);
public slots:
void Update();
void UpdateSelection();
void ItemDoubleClicked(QTreeWidgetItem* item, int column);
void OnTextFilterChanged(const QString& text);
private:
void AddSimulatedObjectToInterface(const EMotionFX::SimulatedObject* object);
EMotionFX::Actor* m_actor = nullptr;
QTreeWidget* m_treeWidget = nullptr;
AzQtComponents::FilteredSearchWidget* m_searchWidget = nullptr;
AZStd::string m_searchWidgetText;
AZStd::vector<AZStd::string> m_selectedSimulatedObjectNames;
AZStd::vector<AZStd::string> m_oldSelectedSimulatedObjectNames;
};
} // namespace EMStudio