PropertiesWidget.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #if !defined(Q_MOC_RUN)
  10. #include "EditorCommon.h"
  11. #include <QWidget>
  12. #include <QTimer>
  13. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  14. #include <AzToolsFramework/UI/PropertyEditor/ComponentEditor.hxx>
  15. #endif
  16. class PropertiesWidget
  17. : public QWidget
  18. , public AzToolsFramework::IPropertyEditorNotify
  19. , public AzToolsFramework::ToolsApplicationEvents::Bus::Handler
  20. {
  21. Q_OBJECT
  22. public:
  23. PropertiesWidget(EditorWindow* editorWindow,
  24. QWidget* parent = nullptr);
  25. virtual ~PropertiesWidget();
  26. QSize sizeHint() const override { return QSize(400, -1); }
  27. //IPropertyEditorNotify Interface
  28. void BeforePropertyModified(AzToolsFramework::InstanceDataNode* pNode) override;
  29. void AfterPropertyModified(AzToolsFramework::InstanceDataNode* pNode) override;
  30. void SetPropertyEditingActive(AzToolsFramework::InstanceDataNode* pNode) override;
  31. void SetPropertyEditingComplete(AzToolsFramework::InstanceDataNode* pNode) override;
  32. void SealUndoStack() override;
  33. void RequestPropertyContextMenu(AzToolsFramework::InstanceDataNode* node, const QPoint& globalPos) override;
  34. //ToolsApplicationEvents Interface
  35. void InvalidatePropertyDisplay(AzToolsFramework::PropertyModificationRefreshLevel level) override;
  36. void TriggerRefresh(AzToolsFramework::PropertyModificationRefreshLevel refreshLevel = AzToolsFramework::PropertyModificationRefreshLevel::Refresh_EntireTree, const AZ::Uuid* componentType = nullptr);
  37. void TriggerImmediateRefresh(AzToolsFramework::PropertyModificationRefreshLevel refreshLevel = AzToolsFramework::PropertyModificationRefreshLevel::Refresh_EntireTree, const AZ::Uuid* componentType = nullptr);
  38. // Notify the properties pane when a selected entity has been recreated
  39. void SelectedEntityPointersChanged();
  40. void SetSelectedEntityDisplayNameWidget(QLineEdit* selectedEntityDisplayNameWidget);
  41. void SetEditorOnlyCheckbox(QCheckBox* editorOnlyCheckbox);
  42. float GetScrollValue();
  43. void SetScrollValue(float scrollValue);
  44. AZ::Entity::ComponentArrayType GetSelectedComponents();
  45. public slots:
  46. void UserSelectionChanged(HierarchyItemRawPtrList* items);
  47. private slots:
  48. void Refresh(AzToolsFramework::PropertyModificationRefreshLevel refreshLevel = AzToolsFramework::PropertyModificationRefreshLevel::Refresh_EntireTree, const AZ::Uuid* componentType = nullptr);
  49. private:
  50. EditorWindow* m_editorWindow;
  51. QTimer m_refreshTimer;
  52. SerializeHelpers::SerializedEntryList m_preValueChanges;
  53. PropertiesContainer* m_propertiesContainer;
  54. AZStd::string m_canvasUndoXml;
  55. AZ::Uuid m_componentTypeToRefresh;
  56. AzToolsFramework::PropertyModificationRefreshLevel m_refreshLevel;
  57. };