mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-25 05:17:44 +00:00
Add a way to quickly disable racial deforms in the full model viewer
This commit is contained in:
parent
0c9cb2b0cf
commit
9e4d99a0db
4 changed files with 29 additions and 11 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include "boneeditor.h"
|
#include "boneeditor.h"
|
||||||
#include "magic_enum.hpp"
|
#include "magic_enum.hpp"
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
|
@ -95,9 +96,22 @@ FullModelViewer::FullModelViewer(GameData *data, FileCache &cache, QWidget *pare
|
||||||
|
|
||||||
m_boneEditor = new BoneEditor(gearView);
|
m_boneEditor = new BoneEditor(gearView);
|
||||||
|
|
||||||
|
auto debugWidget = new QWidget();
|
||||||
|
auto debugLayout = new QFormLayout();
|
||||||
|
debugWidget->setLayout(debugLayout);
|
||||||
|
|
||||||
|
auto racialTransformsBox = new QCheckBox();
|
||||||
|
racialTransformsBox->setChecked(true);
|
||||||
|
connect(racialTransformsBox, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
|
gearView->part().enableRacialDeform = checked;
|
||||||
|
gearView->part().reloadRenderer();
|
||||||
|
});
|
||||||
|
debugLayout->addRow(i18n("Enable Racial Deforms"), racialTransformsBox);
|
||||||
|
|
||||||
auto tabWidget = new QTabWidget();
|
auto tabWidget = new QTabWidget();
|
||||||
tabWidget->addTab(m_boneEditor, i18nc("@title:tab", "Bone Editor"));
|
tabWidget->addTab(m_boneEditor, i18nc("@title:tab", "Bone Editor"));
|
||||||
tabWidget->addTab(characterEditorWidget, i18nc("@title:tab", "Character Editor"));
|
tabWidget->addTab(characterEditorWidget, i18nc("@title:tab", "Character Editor"));
|
||||||
|
tabWidget->addTab(debugWidget, i18nc("@title:tab", "Debug"));
|
||||||
viewportLayout->addWidget(tabWidget);
|
viewportLayout->addWidget(tabWidget);
|
||||||
|
|
||||||
auto controlLayout = new QHBoxLayout();
|
auto controlLayout = new QHBoxLayout();
|
||||||
|
|
|
@ -181,6 +181,7 @@ void MDLPart::reloadBoneData()
|
||||||
}
|
}
|
||||||
|
|
||||||
// get deform matrices
|
// get deform matrices
|
||||||
|
if (enableRacialDeform) {
|
||||||
auto deform = physis_pbd_get_deform_matrix(pbd, model.from_body_id, model.to_body_id);
|
auto deform = physis_pbd_get_deform_matrix(pbd, model.from_body_id, model.to_body_id);
|
||||||
if (deform.num_bones != 0) {
|
if (deform.num_bones != 0) {
|
||||||
for (int i = 0; i < deform.num_bones; i++) {
|
for (int i = 0; i < deform.num_bones; i++) {
|
||||||
|
@ -188,7 +189,8 @@ void MDLPart::reloadBoneData()
|
||||||
|
|
||||||
for (uint32_t k = 0; k < model.model.num_affected_bones; k++) {
|
for (uint32_t k = 0; k < model.model.num_affected_bones; k++) {
|
||||||
if (std::string_view{model.model.affected_bone_names[k]} == std::string_view{deformBone.name}) {
|
if (std::string_view{model.model.affected_bone_names[k]} == std::string_view{deformBone.name}) {
|
||||||
deformBones[k] = glm::rowMajor4(glm::vec4{deformBone.deform[0], deformBone.deform[1], deformBone.deform[2], deformBone.deform[3]},
|
deformBones[k] =
|
||||||
|
glm::rowMajor4(glm::vec4{deformBone.deform[0], deformBone.deform[1], deformBone.deform[2], deformBone.deform[3]},
|
||||||
glm::vec4{deformBone.deform[4], deformBone.deform[5], deformBone.deform[6], deformBone.deform[7]},
|
glm::vec4{deformBone.deform[4], deformBone.deform[5], deformBone.deform[6], deformBone.deform[7]},
|
||||||
glm::vec4{deformBone.deform[8], deformBone.deform[9], deformBone.deform[10], deformBone.deform[11]},
|
glm::vec4{deformBone.deform[8], deformBone.deform[9], deformBone.deform[10], deformBone.deform[11]},
|
||||||
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
||||||
|
@ -196,6 +198,7 @@ void MDLPart::reloadBoneData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < model.model.num_affected_bones; i++) {
|
for (uint32_t i = 0; i < model.model.num_affected_bones; i++) {
|
||||||
const int originalBoneId = boneMapping[i];
|
const int originalBoneId = boneMapping[i];
|
||||||
|
|
|
@ -51,6 +51,8 @@ public:
|
||||||
|
|
||||||
physis_PBD pbd{};
|
physis_PBD pbd{};
|
||||||
|
|
||||||
|
bool enableRacialDeform = true;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void modelChanged();
|
void modelChanged();
|
||||||
void skeletonChanged();
|
void skeletonChanged();
|
||||||
|
|
|
@ -112,7 +112,6 @@ void SklbPart::treeItemClicked(QTreeWidgetItem *item, int column)
|
||||||
m_matrices.bones[j].deform[10],
|
m_matrices.bones[j].deform[10],
|
||||||
m_matrices.bones[j].deform[11]},
|
m_matrices.bones[j].deform[11]},
|
||||||
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
||||||
;
|
|
||||||
|
|
||||||
glm::vec3 scale;
|
glm::vec3 scale;
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
|
|
Loading…
Add table
Reference in a new issue