NodeListSelectionHandler.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/NodeListSelectionWidget.h>
  15. #endif
  16. class QWidget;
  17. /*
  18. =============================================================
  19. = Handler Documentation =
  20. =============================================================
  21. Handler Name: "NodeListSelection"
  22. Available Attributes:
  23. o "DisabledOption" - Option presented to the user as the first option which will generally be interpreted
  24. as the default or disabled option. For instance, "Disable Vertex Coloring" as the
  25. default for selecting available vertex coloring options.
  26. o "ClassTypeIdFilter" - The UUID of the graph object class type to be listed. If not set all available graph
  27. objects will be listed.
  28. o "RequiresExactTypeId" - When 'ClassTypeIdFilter' is set setting this to true will cause only instances of
  29. the exact class to be listed, otherwise any class derived from the given UUID will be used.
  30. o "UseShortNames" - Whether or not to display the full scene graph path or only the short name.
  31. o "ExcludeEndPoints" - Whether or not graph nodes marked as end-points should be considered for displaying.
  32. o "DefaultToDisabled" - Whether or not the default option is the disabled option or the first entry if the value
  33. hasn't not been set or has become invalid. This requires 'DisabledOption' to be set,
  34. otherwise the first entry will be choosen.
  35. */
  36. namespace AZ
  37. {
  38. namespace SceneAPI
  39. {
  40. namespace UI
  41. {
  42. class NodeListSelectionHandler
  43. : public QObject, public AzToolsFramework::PropertyHandler<AZStd::string, NodeListSelectionWidget>
  44. {
  45. Q_OBJECT
  46. public:
  47. AZ_CLASS_ALLOCATOR_DECL
  48. QWidget* CreateGUI(QWidget* parent) override;
  49. u32 GetHandlerName() const override;
  50. bool AutoDelete() const override;
  51. void ConsumeAttribute(NodeListSelectionWidget* widget, u32 attrib,
  52. AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
  53. void WriteGUIValuesIntoProperty(size_t index, NodeListSelectionWidget* GUI, property_t& instance,
  54. AzToolsFramework::InstanceDataNode* node) override;
  55. bool ReadValuesIntoGUI(size_t index, NodeListSelectionWidget* GUI, const property_t& instance,
  56. AzToolsFramework::InstanceDataNode* node) override;
  57. static void Register();
  58. static void Unregister();
  59. protected:
  60. virtual void ConsumeDisabledOptionAttribute(NodeListSelectionWidget* widget,
  61. AzToolsFramework::PropertyAttributeReader* attrValue);
  62. virtual void ConsumeClassTypeIdAttribute(NodeListSelectionWidget* widget,
  63. AzToolsFramework::PropertyAttributeReader* attrValue);
  64. virtual void ConsumeRequiredExactTypeIdAttribute(NodeListSelectionWidget* widget,
  65. AzToolsFramework::PropertyAttributeReader* attrValue);
  66. virtual void ConsumeUseShortNameAttribute(NodeListSelectionWidget* widget,
  67. AzToolsFramework::PropertyAttributeReader* attrValue);
  68. virtual void ConsumeExcludeEndPointsAttribute(NodeListSelectionWidget* widget,
  69. AzToolsFramework::PropertyAttributeReader* attrValue);
  70. virtual void ConsumeDefaultToDisabledAttribute(NodeListSelectionWidget* widget,
  71. AzToolsFramework::PropertyAttributeReader* attrValue);
  72. private:
  73. static NodeListSelectionHandler* s_instance;
  74. };
  75. } // UI
  76. } // SceneAPI
  77. } // AZ