mirror of https://github.com/AxioDL/metaforce.git
Add ability to search for blender version dynamically
This commit is contained in:
parent
e0da690d7c
commit
daef7dfe00
|
@ -26,7 +26,7 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
|
|||
set(QUAZIP_INSTALL OFF CACHE BOOL "")
|
||||
add_subdirectory(quazip)
|
||||
|
||||
add_executable(hecl-gui WIN32 MACOSX_BUNDLE
|
||||
add_executable(hecl-gui MACOSX_BUNDLE
|
||||
ArgumentEditor.cpp
|
||||
ArgumentEditor.hpp
|
||||
ArgumentEditor.ui
|
||||
|
|
|
@ -12,6 +12,10 @@ namespace hecl::blender {
|
|||
#define DEFAULT_BLENDER_BIN "blender"
|
||||
#endif
|
||||
|
||||
static const uint32_t MinBlenderMajorSearch = 2;
|
||||
static const uint32_t MaxBlenderMajorSearch = 2;
|
||||
static const uint32_t MinBlenderMinorSearch = 90;
|
||||
static const uint32_t MaxBlenderMinorSearch = 91;
|
||||
static const std::regex regBlenderVersion(R"(Blender (\d+)\.(\d+)(?:\.(\d+))?)",
|
||||
std::regex::ECMAScript | std::regex::optimize);
|
||||
|
||||
|
@ -51,14 +55,25 @@ hecl::SystemString FindBlender(int& major, int& minor) {
|
|||
/* No steam; try default */
|
||||
wchar_t progFiles[256];
|
||||
if (GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256)) {
|
||||
_snwprintf(BLENDER_BIN_BUF, 2048, L"%s\\Blender Foundation\\Blender 2.90\\blender.exe", progFiles);
|
||||
blenderBin = BLENDER_BIN_BUF;
|
||||
if (!RegFileExists(blenderBin))
|
||||
blenderBin = nullptr;
|
||||
} else
|
||||
blenderBin = nullptr;
|
||||
for (size_t major = MinBlenderMajorSearch; major <= MaxBlenderMajorSearch; ++major) {
|
||||
bool found = false;
|
||||
for (size_t minor = MinBlenderMinorSearch; minor <= MaxBlenderMinorSearch; ++minor) {
|
||||
_snwprintf(BLENDER_BIN_BUF, 2048, L"%s\\Blender Foundation\\Blender %i.%i\\blender.exe", progFiles, major,
|
||||
minor);
|
||||
if (RegFileExists(BLENDER_BIN_BUF)) {
|
||||
blenderBin = BLENDER_BIN_BUF;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
if (!RegFileExists(blenderBin)) {
|
||||
/* Try steam */
|
||||
|
|
|
@ -306,7 +306,7 @@ 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.83 must be installed. Please download via Steam or blender.org."));
|
||||
m_ui->downloadErrorLabel->setText(tr("Blender 2.90 or greater must be installed. Please download via Steam or blender.org."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
|
@ -76,7 +76,95 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="5" column="0" rowspan="3">
|
||||
<layout class="QHBoxLayout" name="bottomButtonBox">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>167</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="extractBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Extract</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="packageBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="launchBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="warpBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch && &Warp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>166</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QTabWidget" name="heclTabs">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
|
@ -1120,7 +1208,7 @@
|
|||
<string><!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:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:6pt; 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 HECL Frontend</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 HECL 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>
|
||||
|
@ -1143,93 +1231,12 @@ p, li { white-space: pre-wrap; }
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" rowspan="3">
|
||||
<layout class="QHBoxLayout" name="bottomButtonBox">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>167</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="extractBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Extract</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="packageBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Package</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="launchBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="warpBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch && &Warp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>166</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><center><h1 style="color:red">ALPHA VERSION</h1></center></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
class QSequentialAnimationGroup;
|
||||
|
||||
const uint32_t MinBlenderVersionMajor = 2;
|
||||
const uint32_t MaxBlenderVersionMajor = 2;
|
||||
const uint32_t MinBlenderVersionMinor = 90;
|
||||
const uint32_t MaxBlenderVersionMinor = 91;
|
||||
|
||||
class SysReqTableModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
uint64_t m_cpuSpeed = 0;
|
||||
|
@ -31,7 +36,10 @@ public:
|
|||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
bool isBlenderVersionOk() const { return m_blendMajor == 2 && m_blendMinor == 90; }
|
||||
bool isBlenderVersionOk() const {
|
||||
return (m_blendMajor >= MinBlenderVersionMajor && m_blendMajor <= MaxBlenderVersionMajor) &&
|
||||
(m_blendMinor >= MinBlenderVersionMinor && m_blendMinor <= MaxBlenderVersionMinor);
|
||||
}
|
||||
void updateFreeDiskSpace(const QString& path);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue