FBXExporterDialog.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 "EditorDefs.h"
  9. #include "FBXExporterDialog.h"
  10. #include <QMessageBox>
  11. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  12. #include <ui_FBXExporterDialog.h>
  13. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  14. CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent)
  15. : QDialog(pParent)
  16. , m_ui(new Ui::FBXExporterDialog)
  17. {
  18. m_ui->setupUi(this);
  19. setFixedSize(size());
  20. setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
  21. m_ui->m_exportLocalCoordsCheckbox->setChecked(false);
  22. m_bDisplayOnlyFPSSetting = bDisplayOnlyFPSSetting;
  23. connect(m_ui->m_fpsCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &CFBXExporterDialog::OnFPSChange);
  24. }
  25. CFBXExporterDialog::~CFBXExporterDialog()
  26. {
  27. }
  28. float CFBXExporterDialog::GetFPS() const
  29. {
  30. return m_ui->m_fpsCombo->currentText().toFloat();
  31. }
  32. bool CFBXExporterDialog::GetExportCoordsLocalToTheSelectedObject() const
  33. {
  34. return m_ui->m_exportLocalCoordsCheckbox->isChecked();
  35. }
  36. bool CFBXExporterDialog::GetExportOnlyPrimaryCamera() const
  37. {
  38. return m_ui->m_exportOnlyPrimaryCameraCheckBox->isChecked();
  39. }
  40. void CFBXExporterDialog::SetExportLocalCoordsCheckBoxEnable(bool checked)
  41. {
  42. if (!m_bDisplayOnlyFPSSetting)
  43. {
  44. m_ui->m_exportLocalCoordsCheckbox->setEnabled(checked);
  45. }
  46. }
  47. void CFBXExporterDialog::accept()
  48. {
  49. const QString fpsStr = m_ui->m_fpsCombo->currentText();
  50. bool ok;
  51. const double fps = fpsStr.toDouble(&ok);
  52. if (fps <= 0 && !fpsStr.isEmpty() || fpsStr.isEmpty() || !ok)
  53. {
  54. QMessageBox::information(this, QString(), tr("Please enter a correct FPS value"));
  55. m_ui->m_fpsCombo->setCurrentIndex(2);
  56. return;
  57. }
  58. QDialog::accept();
  59. }
  60. void CFBXExporterDialog::OnFPSChange()
  61. {
  62. const QString fpsStr = m_ui->m_fpsCombo->currentText();
  63. if (QString::compare(fpsStr, tr("Custom"), Qt::CaseInsensitive) == 0)
  64. {
  65. m_ui->m_fpsCombo->setCurrentIndex(-1);
  66. }
  67. }
  68. int CFBXExporterDialog::exec()
  69. {
  70. if (m_bDisplayOnlyFPSSetting)
  71. {
  72. m_ui->m_exportLocalCoordsCheckbox->setEnabled(false);
  73. m_ui->m_exportOnlyPrimaryCameraCheckBox->setEnabled(false);
  74. }
  75. m_ui->m_fpsCombo->addItem("24");
  76. m_ui->m_fpsCombo->addItem("25");
  77. m_ui->m_fpsCombo->addItem("30");
  78. m_ui->m_fpsCombo->addItem("48");
  79. m_ui->m_fpsCombo->addItem("60");
  80. m_ui->m_fpsCombo->addItem(tr("Custom"));
  81. m_ui->m_fpsCombo->setCurrentIndex(2);
  82. return QDialog::exec();
  83. }
  84. #include <moc_FBXExporterDialog.cpp>