mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-21 19:57:44 +00:00
armoury: Suggest a better model name, take off the .mdl extension
This commit is contained in:
parent
c2fa324ec0
commit
17bf05971b
2 changed files with 18 additions and 6 deletions
|
@ -276,6 +276,10 @@ void GearView::updatePart()
|
||||||
gearDirty = true;
|
gearDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto sanitizeMdlPath = [](const QLatin1String mdlPath) -> QString {
|
||||||
|
return QString(mdlPath).section(QLatin1Char('/'), -1).remove(QStringLiteral(".mdl"));
|
||||||
|
};
|
||||||
|
|
||||||
if (gearDirty) {
|
if (gearDirty) {
|
||||||
for (auto &gearAddition : queuedGearAdditions) {
|
for (auto &gearAddition : queuedGearAdditions) {
|
||||||
auto mdlPath = QLatin1String(
|
auto mdlPath = QLatin1String(
|
||||||
|
@ -320,7 +324,7 @@ void GearView::updatePart()
|
||||||
|
|
||||||
maxLod = std::max(mdl.num_lod, maxLod);
|
maxLod = std::max(mdl.num_lod, maxLod);
|
||||||
|
|
||||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
mdlPart->addModel(mdl, sanitizeMdlPath(mdlPath), materials, currentLod);
|
||||||
gearAddition.mdl = mdl;
|
gearAddition.mdl = mdl;
|
||||||
gearAddition.path = mdlPath;
|
gearAddition.path = mdlPath;
|
||||||
loadedGears.push_back(gearAddition);
|
loadedGears.push_back(gearAddition);
|
||||||
|
@ -356,7 +360,7 @@ void GearView::updatePart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
mdlPart->addModel(mdl, sanitizeMdlPath(mdlPath), materials, currentLod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +382,7 @@ void GearView::updatePart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
mdlPart->addModel(mdl, sanitizeMdlPath(mdlPath), materials, currentLod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +404,7 @@ void GearView::updatePart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
mdlPart->addModel(mdl, sanitizeMdlPath(mdlPath), materials, currentLod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +420,7 @@ void GearView::updatePart()
|
||||||
|
|
||||||
if (cache.fileExists(QLatin1String(skinmtrl_path.c_str()))) {
|
if (cache.fileExists(QLatin1String(skinmtrl_path.c_str()))) {
|
||||||
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(skinmtrl_path.c_str())));
|
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(skinmtrl_path.c_str())));
|
||||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), {mat}, currentLod);
|
mdlPart->addModel(mdl, sanitizeMdlPath(mdlPath), {mat}, currentLod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,15 @@ SingleGearView::SingleGearView(GameData* data, FileCache& cache) : data(data) {
|
||||||
exportButton->setIcon(QIcon::fromTheme(QStringLiteral("document-export")));
|
exportButton->setIcon(QIcon::fromTheme(QStringLiteral("document-export")));
|
||||||
connect(exportButton, &QPushButton::clicked, this, [this](bool) {
|
connect(exportButton, &QPushButton::clicked, this, [this](bool) {
|
||||||
if (currentGear.has_value()) {
|
if (currentGear.has_value()) {
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Model"), QStringLiteral("model.glb"), tr("glTF Binary File (*.glb)"));
|
// TODO: deduplicate
|
||||||
|
const auto sanitizeMdlPath = [](const QString &mdlPath) -> QString {
|
||||||
|
return QString(mdlPath).section(QLatin1Char('/'), -1).remove(QStringLiteral(".mdl"));
|
||||||
|
};
|
||||||
|
|
||||||
|
const QString fileName = QFileDialog::getSaveFileName(this,
|
||||||
|
tr("Save Model"),
|
||||||
|
QStringLiteral("%1.glb").arg(sanitizeMdlPath(gearView->getLoadedGearPath())),
|
||||||
|
tr("glTF Binary File (*.glb)"));
|
||||||
|
|
||||||
gearView->exportModel(fileName);
|
gearView->exportModel(fileName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue