EditorWindow.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #include <AzCore/Interface/Interface.h>
  9. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  10. #include <AzToolsFramework/API/ViewPaneOptions.h>
  11. #include <LyViewPaneNames.h>
  12. #include <Editor/ConfigurationWidget.h>
  13. #include <Editor/EditorWindow.h>
  14. #include <Editor/ui_EditorWindow.h>
  15. #include <Blast/BlastSystemBus.h>
  16. namespace Blast
  17. {
  18. namespace Editor
  19. {
  20. EditorWindow::EditorWindow(QWidget* parent)
  21. : QWidget(parent)
  22. , m_ui(new Ui::EditorWindowClass())
  23. {
  24. m_ui->setupUi(this);
  25. const BlastGlobalConfiguration& configuration =
  26. AZ::Interface<Blast::BlastSystemRequests>::Get()->GetGlobalConfiguration();
  27. m_ui->m_BlastConfigurationWidget->SetConfiguration(configuration);
  28. connect(
  29. m_ui->m_BlastConfigurationWidget, &Blast::Editor::ConfigurationWidget::onConfigurationChanged, this,
  30. &EditorWindow::SaveConfiguration);
  31. }
  32. void EditorWindow::RegisterViewClass()
  33. {
  34. AzToolsFramework::ViewPaneOptions options;
  35. options.preferedDockingArea = Qt::LeftDockWidgetArea;
  36. options.saveKeyName = "BlastConfiguration";
  37. options.isPreview = true;
  38. AzToolsFramework::RegisterViewPane<EditorWindow>(
  39. "Blast Configuration (Experimental)", LyViewPane::CategoryTools, options);
  40. }
  41. void EditorWindow::SaveConfiguration(const BlastGlobalConfiguration& configuration)
  42. {
  43. AZ::Interface<Blast::BlastSystemRequests>::Get()->SetGlobalConfiguration(configuration);
  44. }
  45. } // namespace Editor
  46. } // namespace Blast
  47. #include <Editor/moc_EditorWindow.cpp>