NodeTreeSelectionHandler.h 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 <AzCore/Math/Crc.h>
  11. #include <AzCore/std/string/string.h>
  12. #include <AzCore/Memory/SystemAllocator.h>
  13. #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
  14. #include <SceneAPI/SceneUI/RowWidgets/NodeTreeSelectionWidget.h>
  15. #include <SceneAPI/SceneCore/DataTypes/ManifestBase/ISceneNodeSelectionList.h>
  16. #endif
  17. class QWidget;
  18. /*
  19. =============================================================
  20. = Handler Documentation =
  21. =============================================================
  22. Handler Name: "NodeTreeSelection"
  23. Available Attributes:
  24. FilterName - Name of the filter type used in the summary label.
  25. FilterType - Uuid for the type(s) to filter for. This attribute can be added multiple times. By default all
  26. types will be considered but by adding one or more of filters only classes that match the uuid
  27. of the given type or are derived of that type will be used for the selected and total count.
  28. The object is an end-point it will also show in the selection graph, otherwise end-points are hidden.
  29. FilterVirtualType - Crc32 or name (string) for the type(s) to filter for. This attribute can be added multiple
  30. times. By default all types will be considered but by adding one or more of filters only objects
  31. that match any of the virtual types will be used for the selected and total count.
  32. The object is an end-point it will also show in the selection graph, otherwise end-points are hidden.
  33. NarrowSelection - If set to true only filter types will have a checkbox, otherwise all entries can be selected.
  34. */
  35. namespace AZ
  36. {
  37. namespace SceneAPI
  38. {
  39. namespace UI
  40. {
  41. AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
  42. class SCENE_UI_API NodeTreeSelectionHandler
  43. : public QObject
  44. , public AzToolsFramework::PropertyHandler<DataTypes::ISceneNodeSelectionList, NodeTreeSelectionWidget>
  45. {
  46. AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
  47. Q_OBJECT
  48. public:
  49. AZ_CLASS_ALLOCATOR_DECL
  50. QWidget* CreateGUI(QWidget* parent) override;
  51. u32 GetHandlerName() const override;
  52. bool AutoDelete() const override;
  53. bool IsDefaultHandler() const override;
  54. void ConsumeAttribute(NodeTreeSelectionWidget* widget, u32 attrib,
  55. AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  56. void WriteGUIValuesIntoProperty(size_t index, NodeTreeSelectionWidget* GUI, property_t& instance,
  57. AzToolsFramework::InstanceDataNode* node) override;
  58. bool ReadValuesIntoGUI(size_t index, NodeTreeSelectionWidget* GUI, const property_t& instance,
  59. AzToolsFramework::InstanceDataNode* node) override;
  60. static void Register();
  61. static void Unregister();
  62. protected:
  63. virtual void ConsumeFilterNameAttribute(NodeTreeSelectionWidget* widget,
  64. AzToolsFramework::PropertyAttributeReader* attrValue);
  65. virtual void ConsumeFilterTypeAttribute(NodeTreeSelectionWidget* widget,
  66. AzToolsFramework::PropertyAttributeReader* attrValue);
  67. virtual void ConsumeFilterVirtualTypeAttribute(NodeTreeSelectionWidget* widget,
  68. AzToolsFramework::PropertyAttributeReader* attrValue);
  69. virtual void ConsumeNarrowSelectionAttribute(NodeTreeSelectionWidget* widget,
  70. AzToolsFramework::PropertyAttributeReader* attrValue);
  71. private:
  72. static NodeTreeSelectionHandler* s_instance;
  73. };
  74. } // UI
  75. } // SceneAPI
  76. } // AZ