Minor Blender 3.0 fixes, add ability to override blender in metaforce-gui

This commit is contained in:
Phillip Stephens 2022-01-08 17:56:28 -08:00
parent 2f0febba27
commit 989c267dce
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
10 changed files with 467 additions and 337 deletions

View File

@ -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)

View File

@ -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<std::string> FindBlender(int& major, int& minor);
bool IsVersionSupported(int major, int minor);
std::pair<uint32_t, uint32_t> GetLatestSupportedVersion();
std::pair<uint32_t, uint32_t> GetEarliestSupportedVersion();
std::pair<uint32_t, uint32_t> GetRecommendedVersion();
void SetOverridePath(std::string_view overridePath);
} // namespace hecl::blender

View File

@ -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")

View File

@ -2,9 +2,24 @@
#include "hecl/SteamFinder.hpp"
#include <array>
#include <sstream>
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<std::string> FindBlender(int& major, int& minor) {
major = 0;
minor = 0;
/* User-specified blender path */
auto blenderBin = GetEnv("BLENDER_BIN");
std::optional<std::string> 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<std::string> 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<std::string> 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<uint32_t, uint32_t> GetLatestSupportedVersion() {
return {SupportedVersions.front().Major, SupportedVersions.front().Minor};
}
std::pair<uint32_t, uint32_t> GetEarliestSupportedVersion() {
return {SupportedVersions.back().Major, SupportedVersions.back().Minor};
}
std::pair<uint32_t, uint32_t> GetRecommendedVersion() { return {RecommendedVersion.Major, RecommendedVersion.Minor}; }
void SetOverridePath(std::string_view overridePath) { OverridePath = overridePath; }
} // namespace hecl::blender

View File

@ -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);
}
};

View File

@ -14,6 +14,8 @@
#include "FileDirDialog.hpp"
#include "ExtractZip.hpp"
#include "hecl/Blender/FindBlender.hpp"
#if _WIN32
#include <Windows.h>
#include <shellapi.h>
@ -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<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&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<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&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;

View File

@ -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);
};

View File

@ -21,7 +21,85 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="2">
<widget class="QPushButton" name="browseBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Extract Directory:</string>
</property>
<property name="buddy">
<cstring>pathEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="pathEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="blenderEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Blender Override Path:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="blenderBtn">
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QTabWidget" name="heclTabs">
<property name="currentIndex">
<number>2</number>
@ -251,8 +329,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>592</height>
<width>464</width>
<height>656</height>
</rect>
</property>
<attribute name="label">
@ -402,8 +480,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>161</width>
<height>89</height>
<width>155</width>
<height>80</height>
</rect>
</property>
<attribute name="label">
@ -451,8 +529,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>212</width>
<height>47</height>
<width>209</width>
<height>32</height>
</rect>
</property>
<attribute name="label">
@ -486,8 +564,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>210</width>
<height>366</height>
<width>189</width>
<height>358</height>
</rect>
</property>
<attribute name="label">
@ -629,6 +707,232 @@
<string>&amp;System Check</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1">
<widget class="QLabel" name="continuousTrackWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;Continuous track selected!&lt;br/&gt;Continuous builds are built after every commit &lt;br/&gt;and have &lt;/span&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;no&lt;/span&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt; guarantee of working at all.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="SysReqTableView" name="sysReqTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Downloaded Metaforce version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="currentBinaryLabel">
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Recommended Metaforce version:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="recommendedBinaryLabel">
<property name="text">
<string>fetching...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update track:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="updateTrackComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Stable</string>
</property>
</item>
<item>
<property name="text">
<string>Development</string>
</property>
</item>
<item>
<property name="text">
<string>Continuous</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<widget class="QProgressBar" name="downloadProgressBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="11" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="ErrorLabel" name="downloadErrorLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="96">
<red>164</red>
<green>166</green>
<blue>168</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@ -711,220 +1015,7 @@
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="SysReqTableView" name="sysReqTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>68</red>
<green>68</green>
<blue>68</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Downloaded Metaforce version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="currentBinaryLabel">
<property name="text">
<string>none</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Recommended Metaforce version:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="recommendedBinaryLabel">
<property name="text">
<string>fetching...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update track:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="updateTrackComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Stable</string>
</property>
</item>
<item>
<property name="text">
<string>Development</string>
</property>
</item>
<item>
<property name="text">
<string>Continuous</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<widget class="ErrorLabel" name="downloadErrorLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>47</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="96">
<red>164</red>
<green>166</green>
<blue>168</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="continuousTrackWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;Continuous track selected!&lt;br/&gt;Continuous builds are built after every commit &lt;br/&gt;and have &lt;/span&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;no&lt;/span&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt; guarantee of working at all.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QProgressBar" name="downloadProgressBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="devTrackWarning">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; color:#1a5fb4;&quot;&gt;Development track selected!&lt;br/&gt;Development builds are considered unstable and may cause crashes.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -934,19 +1025,6 @@
</property>
</widget>
</item>
<item row="10" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="aboutTab">
@ -1205,19 +1283,19 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:600;&quot;&gt;About Metaforce&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt;&quot;&gt;&lt;br /&gt;The Metaforce frontend UI is designed and built by &lt;/span&gt;&lt;a href=&quot;https://axiodl.com&quot;&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt; text-decoration: underline; color:#007af4;&quot;&gt;Axiomatic Data Laboratories&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt;&quot;&gt; Copyright 2020&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:600;&quot;&gt;Authors:&lt;/span&gt;&lt;span style=&quot; font-family:'Noto Sans'; font-size:10pt;&quot;&gt;&lt;br /&gt;Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;br /&gt;Jack &amp;quot;jackoalan&amp;quot; Andersen&lt;br /&gt;Luke &amp;quot;encounter&amp;quot; Street&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;The MIT License&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;Copyright (c) 2015-2021 Metaforce Contributors&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;Original Authors: Jack Andersen and Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &amp;quot;Software&amp;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:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New'; font-size:10pt;&quot;&gt;THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;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.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;About Metaforce&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;The Metaforce frontend UI is designed and built by &lt;a href=&quot;https://axiodl.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Axiomatic Data Laboratories&lt;/span&gt;&lt;/a&gt; Copyright 2020&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Authors:&lt;/span&gt;&lt;br /&gt;Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;br /&gt;Jack &amp;quot;jackoalan&amp;quot; Andersen&lt;br /&gt;Luke &amp;quot;encounter&amp;quot; Street&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;The MIT License&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;Copyright (c) 2015-2021 Metaforce Contributors&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;Original Authors: Jack Andersen and Phillip &amp;quot;Antidote&amp;quot; Stephens&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &amp;quot;Software&amp;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:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Courier New';&quot;&gt;THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;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.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
@ -1228,62 +1306,7 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Extract Directory:</string>
</property>
<property name="buddy">
<cstring>pathEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pathEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="browseBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" rowspan="3">
<item row="5" column="0" rowspan="3">
<layout class="QHBoxLayout" name="bottomButtonBox">
<item>
<spacer name="horizontalSpacer_2">

View File

@ -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) {

View File

@ -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(); }
};