NodeTreeSelectionWidget.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. #if !defined(Q_MOC_RUN)
  10. #include <QWidget>
  11. #include <AzCore/Math/Uuid.h>
  12. #include <AzCore/std/string/string.h>
  13. #include <AzCore/std/smart_ptr/unique_ptr.h>
  14. #include <AzCore/std/containers/set.h>
  15. #include <AzCore/Memory/SystemAllocator.h>
  16. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  17. #include <SceneAPI/SceneUI/SceneUIConfiguration.h>
  18. #include <SceneAPI/SceneUI/SceneWidgets/SceneGraphWidget.h>
  19. #endif
  20. namespace AZ
  21. {
  22. namespace SceneAPI
  23. {
  24. namespace DataTypes
  25. {
  26. class ISceneNodeSelectionList;
  27. }
  28. namespace UI
  29. {
  30. // QT space
  31. namespace Ui
  32. {
  33. class NodeTreeSelectionWidget;
  34. }
  35. class SCENE_UI_API NodeTreeSelectionWidget : public QWidget
  36. {
  37. Q_OBJECT
  38. public:
  39. AZ_CLASS_ALLOCATOR_DECL
  40. explicit NodeTreeSelectionWidget(QWidget* parent);
  41. ~NodeTreeSelectionWidget() override;
  42. void SetList(const DataTypes::ISceneNodeSelectionList& list);
  43. void CopyListTo(DataTypes::ISceneNodeSelectionList& target);
  44. void SetFilterName(const AZStd::string& name);
  45. void SetFilterName(AZStd::string&& name);
  46. void AddFilterType(const Uuid& idProperty);
  47. void AddFilterVirtualType(Crc32 name);
  48. void UseNarrowSelection(bool enable);
  49. void UpdateSelectionLabel();
  50. signals:
  51. void valueChanged();
  52. protected:
  53. void SelectButtonClicked();
  54. void ListChangesAccepted();
  55. void ListChangesCanceled();
  56. virtual void ResetNewTreeWidget(const Containers::Scene& scene);
  57. size_t CalculateSelectedCount();
  58. size_t CalculateTotalCount();
  59. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  60. AZStd::set<Uuid> m_filterTypes;
  61. AZStd::set<Crc32> m_filterVirtualTypes;
  62. AZStd::string m_filterName;
  63. QScopedPointer<Ui::NodeTreeSelectionWidget> ui;
  64. AZStd::unique_ptr<SceneGraphWidget> m_treeWidget;
  65. AZStd::unique_ptr<DataTypes::ISceneNodeSelectionList> m_list;
  66. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  67. bool m_narrowSelection;
  68. };
  69. } // UI
  70. } // SceneAPI
  71. } // AZ