mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-24 13:07:44 +00:00
armoury: Export proper model and part names
This commit is contained in:
parent
69ca730039
commit
c2fa324ec0
4 changed files with 23 additions and 17 deletions
|
@ -278,7 +278,7 @@ void GearView::updatePart()
|
|||
|
||||
if (gearDirty) {
|
||||
for (auto &gearAddition : queuedGearAdditions) {
|
||||
QLatin1String mdlPath = QLatin1String(
|
||||
auto mdlPath = QLatin1String(
|
||||
physis_build_equipment_path(gearAddition.info.modelInfo.primaryID, currentRace, currentSubrace, currentGender, gearAddition.info.slot));
|
||||
|
||||
qInfo() << "Looking up" << magic_enum::enum_name(currentRace) << magic_enum::enum_name(currentSubrace) << magic_enum::enum_name(currentGender);
|
||||
|
@ -320,7 +320,7 @@ void GearView::updatePart()
|
|||
|
||||
maxLod = std::max(mdl.num_lod, maxLod);
|
||||
|
||||
mdlPart->addModel(mdl, materials, currentLod);
|
||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
||||
gearAddition.mdl = mdl;
|
||||
gearAddition.path = mdlPath;
|
||||
loadedGears.push_back(gearAddition);
|
||||
|
@ -339,8 +339,8 @@ void GearView::updatePart()
|
|||
}
|
||||
|
||||
if (face) {
|
||||
auto mdl_data =
|
||||
cache.lookupFile(QLatin1String(physis_build_character_path(CharacterCategory::Face, *face, currentRace, currentSubrace, currentGender)));
|
||||
const auto mdlPath = QLatin1String(physis_build_character_path(CharacterCategory::Face, *face, currentRace, currentSubrace, currentGender));
|
||||
auto mdl_data = cache.lookupFile(mdlPath);
|
||||
|
||||
if (mdl_data.size > 0) {
|
||||
auto mdl = physis_mdl_parse(mdl_data.size, mdl_data.data);
|
||||
|
@ -356,13 +356,13 @@ void GearView::updatePart()
|
|||
}
|
||||
}
|
||||
|
||||
mdlPart->addModel(mdl, materials, currentLod);
|
||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
||||
}
|
||||
}
|
||||
|
||||
if (hair) {
|
||||
auto mdl_data =
|
||||
cache.lookupFile(QLatin1String(physis_build_character_path(CharacterCategory::Hair, *hair, currentRace, currentSubrace, currentGender)));
|
||||
const auto mdlPath = QLatin1String(physis_build_character_path(CharacterCategory::Hair, *hair, currentRace, currentSubrace, currentGender));
|
||||
auto mdl_data = cache.lookupFile(mdlPath);
|
||||
|
||||
if (mdl_data.size > 0) {
|
||||
auto mdl = physis_mdl_parse(mdl_data.size, mdl_data.data);
|
||||
|
@ -378,12 +378,13 @@ void GearView::updatePart()
|
|||
}
|
||||
}
|
||||
|
||||
mdlPart->addModel(mdl, materials, currentLod);
|
||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
||||
}
|
||||
}
|
||||
|
||||
if (ear) {
|
||||
auto mdl_data = cache.lookupFile(QLatin1String(physis_build_character_path(CharacterCategory::Hair, *ear, currentRace, currentSubrace, currentGender)));
|
||||
const auto mdlPath = QLatin1String(physis_build_character_path(CharacterCategory::Ear, *ear, currentRace, currentSubrace, currentGender));
|
||||
auto mdl_data = cache.lookupFile(mdlPath);
|
||||
|
||||
if (mdl_data.size > 0) {
|
||||
auto mdl = physis_mdl_parse(mdl_data.size, mdl_data.data);
|
||||
|
@ -399,13 +400,13 @@ void GearView::updatePart()
|
|||
}
|
||||
}
|
||||
|
||||
mdlPart->addModel(mdl, materials, currentLod);
|
||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), materials, currentLod);
|
||||
}
|
||||
}
|
||||
|
||||
if (tail) {
|
||||
auto mdl_data =
|
||||
cache.lookupFile(QLatin1String(physis_build_character_path(CharacterCategory::Tail, *tail, currentRace, currentSubrace, currentGender)));
|
||||
const auto mdlPath = QLatin1String(physis_build_character_path(CharacterCategory::Tail, *tail, currentRace, currentSubrace, currentGender));
|
||||
auto mdl_data = cache.lookupFile(mdlPath);
|
||||
|
||||
if (mdl_data.size > 0) {
|
||||
auto mdl = physis_mdl_parse(mdl_data.size, mdl_data.data);
|
||||
|
@ -415,7 +416,7 @@ void GearView::updatePart()
|
|||
|
||||
if (cache.fileExists(QLatin1String(skinmtrl_path.c_str()))) {
|
||||
auto mat = physis_material_parse(cache.lookupFile(QLatin1String(skinmtrl_path.c_str())));
|
||||
mdlPart->addModel(mdl, {mat}, currentLod);
|
||||
mdlPart->addModel(mdl, QString(mdlPath).section(QLatin1Char('/'), -1), {mat}, currentLod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,13 +270,13 @@ void MDLPart::exportModel(const QString& fileName) {
|
|||
|
||||
for (int i = 0; i < lod.num_parts; i++) {
|
||||
auto& gltfNode = gltfModel.nodes.emplace_back();;
|
||||
gltfNode.name = "placeholder Part 0.1";
|
||||
gltfNode.name = models[0].name.toStdString() + " Part " + std::to_string(i) + ".0";
|
||||
gltfNode.skin = 0;
|
||||
|
||||
gltfNode.mesh = gltfModel.meshes.size();
|
||||
auto& gltfMesh = gltfModel.meshes.emplace_back();
|
||||
|
||||
gltfMesh.name = "what?";
|
||||
gltfMesh.name = gltfNode.name + " Mesh Attribute";
|
||||
|
||||
auto& gltfPrimitive = gltfMesh.primitives.emplace_back();
|
||||
gltfPrimitive.attributes["POSITION"] = gltfModel.accessors.size();
|
||||
|
@ -366,10 +366,12 @@ void MDLPart::clear() {
|
|||
Q_EMIT modelChanged();
|
||||
}
|
||||
|
||||
void MDLPart::addModel(physis_MDL mdl, std::vector<physis_Material> materials, int lod) {
|
||||
void MDLPart::addModel(physis_MDL mdl, const QString &name, std::vector<physis_Material> materials, int lod)
|
||||
{
|
||||
qDebug() << "Adding model to MDLPart";
|
||||
|
||||
auto model = renderer->addModel(mdl, lod);
|
||||
model.name = name;
|
||||
|
||||
std::transform(
|
||||
materials.begin(), materials.end(), std::back_inserter(model.materials), [this](const physis_Material& mat) {
|
||||
|
|
|
@ -58,7 +58,7 @@ public Q_SLOTS:
|
|||
void clear();
|
||||
|
||||
/// Adds a new MDL with a list of materials used.
|
||||
void addModel(physis_MDL mdl, std::vector<physis_Material> materials, int lod);
|
||||
void addModel(physis_MDL mdl, const QString &name, std::vector<physis_Material> materials, int lod);
|
||||
|
||||
void removeModel(const physis_MDL &mdl);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <array>
|
||||
#include <glm/ext/matrix_float4x4.hpp>
|
||||
#include <map>
|
||||
|
@ -42,6 +43,8 @@ struct RenderMaterial {
|
|||
};
|
||||
|
||||
struct RenderModel {
|
||||
QString name;
|
||||
|
||||
physis_MDL model;
|
||||
std::vector<RenderPart> parts;
|
||||
std::array<glm::mat4, 128> boneData;
|
||||
|
|
Loading…
Add table
Reference in a new issue