mirror of https://github.com/AxioDL/metaforce.git
Blender detection fixes
This commit is contained in:
parent
c8e6447b7c
commit
36f7e69aa8
|
@ -86,7 +86,8 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
|
||||||
auto progFiles = nowide::narrow(wProgFiles);
|
auto progFiles = nowide::narrow(wProgFiles);
|
||||||
for (const auto& version : SupportedVersions) {
|
for (const auto& version : SupportedVersions) {
|
||||||
std::string blenderBinBuf =
|
std::string blenderBinBuf =
|
||||||
fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"), progFiles, major, minor);
|
fmt::format(FMT_STRING("{}\\Blender Foundation\\Blender {}.{}\\blender.exe"),
|
||||||
|
progFiles, version.Major, version.Minor);
|
||||||
if (RegFileExists(blenderBinBuf.c_str())) {
|
if (RegFileExists(blenderBinBuf.c_str())) {
|
||||||
blenderBin = std::move(blenderBinBuf);
|
blenderBin = std::move(blenderBinBuf);
|
||||||
break;
|
break;
|
||||||
|
@ -146,7 +147,7 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
|
||||||
std::string command = std::string("\"") + blenderBin.value() + "\" --version";
|
std::string command = std::string("\"") + blenderBin.value() + "\" --version";
|
||||||
FILE* fp = popen(command.c_str(), "r");
|
FILE* fp = popen(command.c_str(), "r");
|
||||||
char versionBuf[256];
|
char versionBuf[256];
|
||||||
size_t rdSize = fread(versionBuf, 1, 255, fp);
|
size_t rdSize = fread(&versionBuf[0], 1, 255, fp);
|
||||||
versionBuf[rdSize] = '\0';
|
versionBuf[rdSize] = '\0';
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
|
|
||||||
|
|
|
@ -540,7 +540,7 @@ void MainWindow::initSlots() {
|
||||||
if (res == QFileDialog::Rejected)
|
if (res == QFileDialog::Rejected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dialog.selectedFiles().size() <= 0)
|
if (dialog.selectedFiles().empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setPath(dialog.selectedFiles().at(0));
|
setPath(dialog.selectedFiles().at(0));
|
||||||
|
@ -549,7 +549,13 @@ void MainWindow::initSlots() {
|
||||||
connect(m_ui->blenderEdit, &QLineEdit::editingFinished, [this]() { setBlenderOverride(m_ui->blenderEdit->text()); });
|
connect(m_ui->blenderEdit, &QLineEdit::editingFinished, [this]() { setBlenderOverride(m_ui->blenderEdit->text()); });
|
||||||
connect(m_ui->blenderBtn, &QPushButton::clicked, [this]() {
|
connect(m_ui->blenderBtn, &QPushButton::clicked, [this]() {
|
||||||
FileDirDialog dialog(this, QFileDialog::ExistingFiles);
|
FileDirDialog dialog(this, QFileDialog::ExistingFiles);
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
dialog.setNameFilter(QStringLiteral("blender.exe"));
|
||||||
|
#else
|
||||||
dialog.setNameFilter(QStringLiteral("blender"));
|
dialog.setNameFilter(QStringLiteral("blender"));
|
||||||
|
#endif
|
||||||
|
|
||||||
dialog.setDirectory(m_path);
|
dialog.setDirectory(m_path);
|
||||||
dialog.setWindowTitle(tr("Select Blender binary"));
|
dialog.setWindowTitle(tr("Select Blender binary"));
|
||||||
int res = dialog.exec();
|
int res = dialog.exec();
|
||||||
|
|
Loading…
Reference in New Issue