AssetEditorWindow.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 <AzCore/Asset/AssetCommon.h>
  11. #include <AzCore/UserSettings/UserSettings.h>
  12. #include <AzToolsFramework/AssetEditor/AssetEditorBus.h>
  13. #include <QWidget>
  14. #endif
  15. namespace Ui
  16. {
  17. class AssetEditorWindowClass;
  18. }
  19. /**
  20. * Window pane wrapper for the Asset Editor widget.
  21. */
  22. class AssetEditorWindow
  23. : public QWidget
  24. , AzToolsFramework::AssetEditor::AssetEditorWidgetRequestsBus::Handler
  25. {
  26. Q_OBJECT
  27. public:
  28. AZ_CLASS_ALLOCATOR(AssetEditorWindow, AZ::SystemAllocator);
  29. explicit AssetEditorWindow(QWidget* parent = nullptr);
  30. ~AssetEditorWindow() override;
  31. //////////////////////////////////////////////////////////////////////////
  32. // AssetEditorWindow
  33. //////////////////////////////////////////////////////////////////////////
  34. void CreateAsset(const AZ::Data::AssetType& assetType, const AZ::Uuid& interestedComponentId) override;
  35. void OpenAsset(const AZ::Data::Asset<AZ::Data::AssetData>& asset) override;
  36. void OpenAssetById(const AZ::Data::AssetId assetId) override;
  37. void SaveAssetAs(const AZStd::string_view assetPath) override;
  38. static void RegisterViewClass();
  39. static void RegisterViewClass(const AZ::Data::Asset<AZ::Data::AssetData>& asset);
  40. protected Q_SLOTS:
  41. void OnAssetSaveFailed(const AZStd::string& error);
  42. void OnAssetOpened(const AZ::Data::Asset<AZ::Data::AssetData>& asset);
  43. protected:
  44. void closeEvent(QCloseEvent* event) override;
  45. private:
  46. QScopedPointer<Ui::AssetEditorWindowClass> m_ui;
  47. };