diff --git a/hecl/blender/hecl/sact/SACTAction.py b/hecl/blender/hecl/sact/SACTAction.py index 1a25ce9a9..742becd32 100644 --- a/hecl/blender/hecl/sact/SACTAction.py +++ b/hecl/blender/hecl/sact/SACTAction.py @@ -176,13 +176,13 @@ class SACTAction_load(bpy.types.Operator): bpy.context.scene.render.frame_map_old = action_obj.hecl_fps bpy.context.scene.render.frame_map_new = 60 bpy.context.scene.frame_start = 0 - bpy.context.scene.frame_end = action_obj.frame_range[1] * (60 / action_obj.hecl_fps) + bpy.context.scene.frame_end = int(action_obj.frame_range[1] * (60 / action_obj.hecl_fps)) else: bpy.context.scene.render.fps = action_obj.hecl_fps bpy.context.scene.render.frame_map_old = action_obj.hecl_fps bpy.context.scene.render.frame_map_new = action_obj.hecl_fps bpy.context.scene.frame_start = 0 - bpy.context.scene.frame_end = action_obj.frame_range[1] + bpy.context.scene.frame_end = int(action_obj.frame_range[1]) # Events #SACTEvent.clear_action_events(self, context, actor_data) diff --git a/hecl/include/hecl/Blender/FindBlender.hpp b/hecl/include/hecl/Blender/FindBlender.hpp index 7ebdde3ca..bfce482a0 100644 --- a/hecl/include/hecl/Blender/FindBlender.hpp +++ b/hecl/include/hecl/Blender/FindBlender.hpp @@ -3,11 +3,10 @@ #include "hecl/hecl.hpp" namespace hecl::blender { -constexpr uint32_t MinBlenderMajorSearch = 2; -constexpr uint32_t MaxBlenderMajorSearch = 2; -constexpr uint32_t MinBlenderMinorSearch = 83; -constexpr uint32_t MaxBlenderMinorSearch = 93; - std::optional FindBlender(int& major, int& minor); - +bool IsVersionSupported(int major, int minor); +std::pair GetLatestSupportedVersion(); +std::pair GetEarliestSupportedVersion(); +std::pair GetRecommendedVersion(); +void SetOverridePath(std::string_view overridePath); } // namespace hecl::blender diff --git a/hecl/lib/Blender/Connection.cpp b/hecl/lib/Blender/Connection.cpp index bb596b22c..19527c565 100644 --- a/hecl/lib/Blender/Connection.cpp +++ b/hecl/lib/Blender/Connection.cpp @@ -466,8 +466,9 @@ Connection::Connection(int verbosityLevel) { BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender")); } else if (lineStr == "INVALIDBLENDERVER") { _closePipe(); + auto [major, minor] = hecl::blender::GetEarliestSupportedVersion(); BlenderLog.report(logvisor::Fatal, FMT_STRING("Installed blender version must be >= {}.{}"), - MinBlenderMajorSearch, MinBlenderMinorSearch); + major, minor); } else if (lineStr == "NOADDON") { _closePipe(); if (blenderAddonPath != "SKIPINSTALL") diff --git a/hecl/lib/Blender/FindBlender.cpp b/hecl/lib/Blender/FindBlender.cpp index a3c59f114..01eb76c5a 100644 --- a/hecl/lib/Blender/FindBlender.cpp +++ b/hecl/lib/Blender/FindBlender.cpp @@ -2,9 +2,24 @@ #include "hecl/SteamFinder.hpp" +#include #include namespace hecl::blender { +namespace { +struct SBlenderVersion { + uint32_t Major; + uint32_t Minor; +}; +// Supported blender versions in reverse order, with the most recently supported version first +constexpr std::array SupportedVersions{ + SBlenderVersion{3, 0}, SBlenderVersion{2, 93}, SBlenderVersion{2, 92}, + SBlenderVersion{2, 91}, SBlenderVersion{2, 90}, SBlenderVersion{2, 83}, +}; +// The most recent version with the most testing +constexpr SBlenderVersion RecommendedVersion{2, 93}; +static std::string OverridePath; +} // namespace #ifdef __APPLE__ #define DEFAULT_BLENDER_BIN "/Applications/Blender.app/Contents/MacOS/blender" @@ -40,8 +55,14 @@ std::optional FindBlender(int& major, int& minor) { major = 0; minor = 0; - /* User-specified blender path */ - auto blenderBin = GetEnv("BLENDER_BIN"); + std::optional blenderBin; + if (!OverridePath.empty()) { + blenderBin = {OverridePath}; + } else { + /* User-specified blender path */ + blenderBin = GetEnv("BLENDER_BIN"); + } + if (blenderBin && !RegFileExists(blenderBin->c_str())) { blenderBin.reset(); } @@ -63,19 +84,11 @@ std::optional FindBlender(int& major, int& minor) { wchar_t wProgFiles[256]; if (GetEnvironmentVariableW(L"ProgramFiles", wProgFiles, 256)) { auto progFiles = nowide::narrow(wProgFiles); - for (size_t major = MaxBlenderMajorSearch; major >= MinBlenderMajorSearch; --major) { - bool found = false; - for (size_t minor = MaxBlenderMinorSearch; minor >= MinBlenderMinorSearch; --minor) { - std::string blenderBinBuf = fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"), - progFiles, major, minor); - if (RegFileExists(blenderBinBuf.c_str())) { - blenderBin = std::move(blenderBinBuf); - found = true; - break; - } - } - - if (found) { + for (const auto& version : SupportedVersions) { + std::string blenderBinBuf = + fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"), progFiles, major, minor); + if (RegFileExists(blenderBinBuf.c_str())) { + blenderBin = std::move(blenderBinBuf); break; } } @@ -147,4 +160,21 @@ std::optional FindBlender(int& major, int& minor) { return blenderBin; } +bool IsVersionSupported(int major, int minor) { + const auto* it = + std::find_if(SupportedVersions.cbegin(), SupportedVersions.cend(), + [&major, &minor](const auto& version) { return version.Major == major && version.Minor == minor; }); + return it != nullptr; +} + +std::pair GetLatestSupportedVersion() { + return {SupportedVersions.front().Major, SupportedVersions.front().Minor}; +} +std::pair GetEarliestSupportedVersion() { + return {SupportedVersions.back().Major, SupportedVersions.back().Minor}; +} + +std::pair GetRecommendedVersion() { return {RecommendedVersion.Major, RecommendedVersion.Minor}; } + +void SetOverridePath(std::string_view overridePath) { OverridePath = overridePath; } } // namespace hecl::blender diff --git a/metaforce-gui/FileDirDialog.hpp b/metaforce-gui/FileDirDialog.hpp index ade623493..6eeca5a52 100644 --- a/metaforce-gui/FileDirDialog.hpp +++ b/metaforce-gui/FileDirDialog.hpp @@ -5,5 +5,7 @@ class FileDirDialog : public QFileDialog { Q_OBJECT public: - FileDirDialog(QWidget* parent = nullptr) : QFileDialog(parent) { setFileMode(QFileDialog::Directory); } + FileDirDialog(QWidget* parent = nullptr, QFileDialog::FileMode mode = QFileDialog::Directory) : QFileDialog(parent) { + setFileMode(mode); + } }; diff --git a/metaforce-gui/MainWindow.cpp b/metaforce-gui/MainWindow.cpp index 7b3ef4649..ebc336005 100644 --- a/metaforce-gui/MainWindow.cpp +++ b/metaforce-gui/MainWindow.cpp @@ -14,6 +14,8 @@ #include "FileDirDialog.hpp" #include "ExtractZip.hpp" +#include "hecl/Blender/FindBlender.hpp" + #if _WIN32 #include #include @@ -131,6 +133,7 @@ MainWindow::MainWindow(QWidget* parent) m_dlManager.fetchIndex(); setPath(m_settings.value(QStringLiteral("working_dir")).toString()); + setBlenderOverride(m_settings.value(QStringLiteral("blender_override_path")).toString()); resize(1024, 768); } @@ -154,6 +157,9 @@ void MainWindow::onExtract() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color")); env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON")); + if (!m_blenderOverridePath.isEmpty() && QFile::exists(m_blenderOverridePath)) { + env.insert(QStringLiteral("BLENDER_BIN"), m_blenderOverridePath); + } m_heclProc.setProcessEnvironment(env); disconnect(&m_heclProc, qOverload(&QProcess::finished), nullptr, nullptr); connect(&m_heclProc, qOverload(&QProcess::finished), this, &MainWindow::onExtractFinished); @@ -189,6 +195,9 @@ void MainWindow::onPackage() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color")); env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON")); + if (!m_blenderOverridePath.isEmpty() && QFile::exists(m_blenderOverridePath)) { + env.insert(QStringLiteral("BLENDER_BIN"), m_blenderOverridePath); + } m_heclProc.setProcessEnvironment(env); disconnect(&m_heclProc, qOverload(&QProcess::finished), nullptr, nullptr); connect(&m_heclProc, qOverload(&QProcess::finished), this, &MainWindow::onPackageFinished); @@ -302,8 +311,14 @@ void MainWindow::onBinaryDownloaded(QuaZip& file) { m_ui->downloadErrorLabel->setText(tr("Download successful - Press 'Extract' to continue."), true); } if (!err && !m_ui->sysReqTable->isBlenderVersionOk()) { - m_ui->downloadErrorLabel->setText( - tr("Blender 2.90 or greater must be installed. Please download via Steam or blender.org.")); + auto [recMajor, recMinor] = hecl::blender::GetRecommendedVersion(); + auto [minMajor, minMinor] = hecl::blender::GetEarliestSupportedVersion(); + insertContinueNote( + tr("Blender %1.%2 or greater must be installed (%3.%4 recommended). Please download via Steam or blender.org.") + .arg(minMajor) + .arg(minMinor) + .arg(recMajor) + .arg(recMinor)); } } @@ -318,6 +333,8 @@ void MainWindow::disableOperations() { m_ui->launchBtn->setEnabled(false); m_ui->pathEdit->setEnabled(false); m_ui->browseBtn->setEnabled(false); + m_ui->blenderEdit->setEnabled(false); + m_ui->blenderBtn->setEnabled(false); m_ui->downloadButton->setEnabled(false); m_ui->warpBtn->setEnabled(false); } @@ -326,6 +343,8 @@ void MainWindow::enableOperations() { disableOperations(); m_ui->pathEdit->setEnabled(true); m_ui->browseBtn->setEnabled(true); + m_ui->blenderEdit->setEnabled(true); + m_ui->blenderBtn->setEnabled(true); if (hecl::com_enableCheats->toBoolean()) { m_ui->warpBtn->show(); @@ -357,7 +376,14 @@ void MainWindow::enableOperations() { } if (!m_ui->sysReqTable->isBlenderVersionOk()) { - insertContinueNote(tr("Blender 2.90 or greater must be installed. Please download via Steam or blender.org.")); + auto [recMajor, recMinor] = hecl::blender::GetRecommendedVersion(); + auto [minMajor, minMinor] = hecl::blender::GetEarliestSupportedVersion(); + insertContinueNote( + tr("Blender %1.%2 or greater must be installed (%3.%4 recommended). Please download via Steam or blender.org.") + .arg(minMajor) + .arg(minMinor) + .arg(recMajor) + .arg(recMinor)); } else if (m_ui->launchBtn->isEnabled()) { insertContinueNote(tr("Package complete - Press 'Launch' to start Metaforce.")); } else if (m_ui->packageBtn->isEnabled()) { @@ -520,9 +546,46 @@ void MainWindow::initSlots() { setPath(dialog.selectedFiles().at(0)); }); connect(m_ui->pathEdit, &QLineEdit::editingFinished, [this]() { setPath(m_ui->pathEdit->text()); }); + connect(m_ui->blenderEdit, &QLineEdit::editingFinished, [this]() { setBlenderOverride(m_ui->blenderEdit->text()); }); + connect(m_ui->blenderBtn, &QPushButton::clicked, [this]() { + FileDirDialog dialog(this, QFileDialog::ExistingFiles); + dialog.setNameFilter(QStringLiteral("blender")); + dialog.setDirectory(m_path); + dialog.setWindowTitle(tr("Select Blender binary")); + int res = dialog.exec(); + if (res == QFileDialog::Rejected) + return; + + if (dialog.selectedFiles().size() <= 0) + return; + + setBlenderOverride(dialog.selectedFiles().at(0)); + }); connect(m_ui->downloadButton, &QPushButton::clicked, this, &MainWindow::onDownloadPressed); } +void MainWindow::setBlenderOverride(const QString& path) { + const QFileInfo finfo(path); + + QString usePath; + if (!path.isEmpty() && finfo.isFile()) { + usePath = finfo.absoluteFilePath(); + } + + m_blenderOverridePath = usePath; + hecl::blender::SetOverridePath(m_blenderOverridePath.toStdString()); + int major = 0; + int minor = 0; + auto realPath = hecl::blender::FindBlender(major, minor); + m_blenderOverridePath.fromStdString(*realPath); + + m_settings.setValue(QStringLiteral("blender_override_path"), m_blenderOverridePath); + auto oldState = m_ui->blenderEdit->blockSignals(true); + m_ui->blenderEdit->setText(m_blenderOverridePath); + m_ui->blenderEdit->blockSignals(oldState); + + m_ui->sysReqTable->updateBlender(); +} void MainWindow::setTextTermFormatting(const QString& text) { m_inContinueNote = false; diff --git a/metaforce-gui/MainWindow.hpp b/metaforce-gui/MainWindow.hpp index 2c4de4f32..1c431b0d1 100644 --- a/metaforce-gui/MainWindow.hpp +++ b/metaforce-gui/MainWindow.hpp @@ -35,6 +35,7 @@ class MainWindow : public QMainWindow { QString m_path; QString m_metaforcePath; QString m_heclPath; + QString m_blenderOverridePath; QProcess m_heclProc; DownloadManager m_dlManager; QStringList m_warpSettings; @@ -77,4 +78,5 @@ private: void initGraphicsApiOption(QRadioButton* action, bool hidden, bool isDefault); void initNumberComboOption(QComboBox* action, hecl::CVar* cvar); void initCheckboxOption(QCheckBox* action, hecl::CVar* cvar); + void setBlenderOverride(const QString& path); }; diff --git a/metaforce-gui/MainWindow.ui b/metaforce-gui/MainWindow.ui index f8a7ca099..83a6e6bd7 100644 --- a/metaforce-gui/MainWindow.ui +++ b/metaforce-gui/MainWindow.ui @@ -21,7 +21,85 @@ - + + + + + + + 0 + 0 + + + + + 32 + 16777215 + + + + ... + + + + + + + + 0 + 0 + + + + Extract Directory: + + + pathEdit + + + + + + + + 0 + 0 + + + + + 1 + 0 + + + + + + + + + + + Blender Override Path: + + + + + + + + 32 + 16777215 + + + + ... + + + + + + 2 @@ -251,8 +329,8 @@ 0 0 - 428 - 592 + 464 + 656 @@ -402,8 +480,8 @@ 0 0 - 161 - 89 + 155 + 80 @@ -451,8 +529,8 @@ 0 0 - 212 - 47 + 209 + 32 @@ -486,8 +564,8 @@ 0 0 - 210 - 366 + 189 + 358 @@ -629,6 +707,232 @@ &System Check + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + <html><head/><body><p align="center"><span style=" color:#ff0000;">Continuous track selected!<br/>Continuous builds are built after every commit <br/>and have </span><span style=" font-weight:600; color:#ff0000;">no</span><span style=" color:#ff0000;"> guarantee of working at all.</span></p></body></html> + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 68 + 68 + 68 + + + + + + + + QAbstractItemView::NoSelection + + + + + + + 12 + + + + + Downloaded Metaforce version: + + + + + + + none + + + + + + + Recommended Metaforce version: + + + + + + + fetching... + + + + + + + Update track: + + + + + + + + 0 + 0 + + + + + Stable + + + + + Development + + + + + Continuous + + + + + + + + + + false + + + 0 + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 164 + 166 + 168 + + + + + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + @@ -711,220 +1015,7 @@ - - - - - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 68 - 68 - 68 - - - - - - - - QAbstractItemView::NoSelection - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - 12 - - - - - Downloaded Metaforce version: - - - - - - - none - - - - - - - Recommended Metaforce version: - - - - - - - fetching... - - - - - - - Update track: - - - - - - - - 0 - 0 - - - - - Stable - - - - - Development - - - - - Continuous - - - - - - - - - - - - - - - 255 - 47 - 0 - - - - - - - - - 255 - 47 - 0 - - - - - - - - - 164 - 166 - 168 - - - - - - - - - - - true - - - - - - <html><head/><body><p align="center"><span style=" color:#ff0000;">Continuous track selected!<br/>Continuous builds are built after every commit <br/>and have </span><span style=" font-weight:600; color:#ff0000;">no</span><span style=" color:#ff0000;"> guarantee of working at all.</span></p></body></html> - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - false - - - 0 - - - - <html><head/><body><p align="center"><span style=" color:#1a5fb4;">Development track selected!<br/>Development builds are considered unstable and may cause crashes.</span></p></body></html> @@ -934,19 +1025,6 @@ - - - - Qt::Vertical - - - - 0 - 0 - - - - @@ -1205,19 +1283,19 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;"> -<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt; font-weight:600;">About Metaforce</span></p> -<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt;"><br />The Metaforce frontend UI is designed and built by </span><a href="https://axiodl.com"><span style=" font-family:'Noto Sans'; font-size:10pt; text-decoration: underline; color:#007af4;">Axiomatic Data Laboratories</span></a><span style=" font-family:'Noto Sans'; font-size:10pt;"> Copyright 2020<br /><br /></span><span style=" font-family:'Noto Sans'; font-size:10pt; font-weight:600;">Authors:</span><span style=" font-family:'Noto Sans'; font-size:10pt;"><br />Phillip &quot;Antidote&quot; Stephens<br />Jack &quot;jackoalan&quot; Andersen<br />Luke &quot;encounter&quot; Street</span></p> -<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">The MIT License</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">Copyright (c) 2015-2021 Metaforce Contributors</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">Original Authors: Jack Andersen and Phillip &quot;Antidote&quot; Stephens</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New'; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New'; font-size:10pt;">THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></p></body></html> +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">About Metaforce</span></p> +<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br />The Metaforce frontend UI is designed and built by <a href="https://axiodl.com"><span style=" text-decoration: underline; color:#007af4;">Axiomatic Data Laboratories</span></a> Copyright 2020<br /><br /><span style=" font-weight:600;">Authors:</span><br />Phillip &quot;Antidote&quot; Stephens<br />Jack &quot;jackoalan&quot; Andersen<br />Luke &quot;encounter&quot; Street</p> +<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The MIT License</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Copyright (c) 2015-2021 Metaforce Contributors</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Original Authors: Jack Andersen and Phillip &quot;Antidote&quot; Stephens</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></p></body></html> true @@ -1228,62 +1306,7 @@ p, li { white-space: pre-wrap; } - - - - - - - 0 - 0 - - - - Extract Directory: - - - pathEdit - - - - - - - - 0 - 0 - - - - - 1 - 0 - - - - - - - - - 0 - 0 - - - - - 32 - 16777215 - - - - ... - - - - - - + diff --git a/metaforce-gui/SysReqTableView.cpp b/metaforce-gui/SysReqTableView.cpp index 11f43d85a..68433342f 100644 --- a/metaforce-gui/SysReqTableView.cpp +++ b/metaforce-gui/SysReqTableView.cpp @@ -82,6 +82,15 @@ void SysReqTableModel::updateFreeDiskSpace(const QString& path) { } emit dataChanged(index(1, 0), index(1, 0)); } +void SysReqTableModel::updateBlender() { + hecl::blender::FindBlender(m_blendMajor, m_blendMinor); + if (m_blendMajor != 0) { + m_blendVersionStr = tr("Blender %1.%2").arg(QString::number(m_blendMajor), QString::number(m_blendMinor)); + } else { + m_blendVersionStr = tr("Not Found"); + } + emit dataChanged(index(1, 3), index(1, 3)); +} int SysReqTableModel::rowCount(const QModelIndex& parent) const { return 4; } @@ -128,9 +137,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const { return {}; #endif case 3: + auto [major, minor] = hecl::blender::GetRecommendedVersion(); return QStringLiteral("Blender %1.%2+") - .arg(hecl::blender::MinBlenderMajorSearch) - .arg(hecl::blender::MinBlenderMinorSearch); + .arg(major) + .arg(minor); } } else if (index.column() == 1) { /* Your System */ @@ -178,9 +188,7 @@ QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation, } bool SysReqTableModel::isBlenderVersionOk() const { - return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch && - m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) && - (m_blendMinor >= hecl::blender::MinBlenderMinorSearch && m_blendMinor <= hecl::blender::MaxBlenderMinorSearch); + return hecl::blender::IsVersionSupported(m_blendMajor, m_blendMinor); } void SysReqTableView::paintEvent(QPaintEvent* e) { diff --git a/metaforce-gui/SysReqTableView.hpp b/metaforce-gui/SysReqTableView.hpp index c9c4aface..7cc5dbf5c 100644 --- a/metaforce-gui/SysReqTableView.hpp +++ b/metaforce-gui/SysReqTableView.hpp @@ -30,6 +30,7 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; bool isBlenderVersionOk() const; void updateFreeDiskSpace(const QString& path); + void updateBlender(); }; class SysReqTableView : public QTableView { @@ -43,4 +44,5 @@ public: const SysReqTableModel& getModel() const { return m_model; } bool isBlenderVersionOk() const { return m_model.isBlenderVersionOk(); } void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); } + void updateBlender() { m_model.updateBlender(); } };