ActorJointBrowseEdit.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Memory/Memory.h>
  10. #include <AzCore/std/containers/vector.h>
  11. #include <AzQtComponents/Components/Widgets/BrowseEdit.h>
  12. #include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.h>
  13. namespace EMotionFX
  14. {
  15. class ActorInstance;
  16. }
  17. namespace EMStudio
  18. {
  19. class NodeSelectionWindow;
  20. class ActorJointBrowseEdit
  21. : public AzQtComponents::BrowseEdit
  22. {
  23. Q_OBJECT // AUTOMOC
  24. public:
  25. AZ_CLASS_ALLOCATOR_DECL
  26. explicit ActorJointBrowseEdit(QWidget* parent = nullptr);
  27. void SetSingleJointSelection(bool singleSelectionEnabled);
  28. void SetSelectedJoints(const AZStd::vector<SelectionItem>& selectedJoints);
  29. EMotionFX::ActorInstance* GetActorInstance() const;
  30. const AZStd::vector<SelectionItem>& GetPreviouslySelectedJoints() const { return m_previouslySelectedJoints; }
  31. signals:
  32. // Emitted when the new joint selection got accepted from the joint selection window.
  33. void SelectionDone(const AZStd::vector<SelectionItem>& selectedJoints);
  34. // Selection got rejected. In case reaction happened on the SelectionChanged() signal, handle going back to the original state.
  35. void SelectionRejected(const AZStd::vector<SelectionItem>& previouslySelectedJoints);
  36. // Emitted while the selection window is open and selection changes (final selection via SelectionDone() signal).
  37. void SelectionChanged(const AZStd::vector<SelectionItem>& selectedJoints);
  38. private slots:
  39. void OnBrowseButtonClicked();
  40. void OnSelectionDone(const AZStd::vector<SelectionItem>& selectedJoints);
  41. void OnSelectionChanged();
  42. void OnSelectionRejected();
  43. void OnTextEdited(const QString& text);
  44. private:
  45. void UpdatePlaceholderText();
  46. AZStd::vector<SelectionItem> m_previouslySelectedJoints; /// Selected joints before selection window opened.
  47. AZStd::vector<SelectionItem> m_selectedJoints;
  48. NodeSelectionWindow* m_jointSelectionWindow = nullptr;
  49. bool m_singleJointSelection = true;
  50. };
  51. } // namespace EMStudio