mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-24 13:07: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 "magic_enum.hpp"
|
||||
#include <KLocalizedString>
|
||||
#include <QCheckBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QFormLayout>
|
||||
|
@ -95,9 +96,22 @@ FullModelViewer::FullModelViewer(GameData *data, FileCache &cache, QWidget *pare
|
|||
|
||||
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();
|
||||
tabWidget->addTab(m_boneEditor, i18nc("@title:tab", "Bone Editor"));
|
||||
tabWidget->addTab(characterEditorWidget, i18nc("@title:tab", "Character Editor"));
|
||||
tabWidget->addTab(debugWidget, i18nc("@title:tab", "Debug"));
|
||||
viewportLayout->addWidget(tabWidget);
|
||||
|
||||
auto controlLayout = new QHBoxLayout();
|
||||
|
|
|
@ -181,17 +181,20 @@ void MDLPart::reloadBoneData()
|
|||
}
|
||||
|
||||
// get deform matrices
|
||||
auto deform = physis_pbd_get_deform_matrix(pbd, model.from_body_id, model.to_body_id);
|
||||
if (deform.num_bones != 0) {
|
||||
for (int i = 0; i < deform.num_bones; i++) {
|
||||
auto deformBone = deform.bones[i];
|
||||
if (enableRacialDeform) {
|
||||
auto deform = physis_pbd_get_deform_matrix(pbd, model.from_body_id, model.to_body_id);
|
||||
if (deform.num_bones != 0) {
|
||||
for (int i = 0; i < deform.num_bones; i++) {
|
||||
auto deformBone = deform.bones[i];
|
||||
|
||||
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}) {
|
||||
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[8], deformBone.deform[9], deformBone.deform[10], deformBone.deform[11]},
|
||||
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
||||
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}) {
|
||||
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[8], deformBone.deform[9], deformBone.deform[10], deformBone.deform[11]},
|
||||
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
|
||||
physis_PBD pbd{};
|
||||
|
||||
bool enableRacialDeform = true;
|
||||
|
||||
Q_SIGNALS:
|
||||
void modelChanged();
|
||||
void skeletonChanged();
|
||||
|
|
|
@ -112,7 +112,6 @@ void SklbPart::treeItemClicked(QTreeWidgetItem *item, int column)
|
|||
m_matrices.bones[j].deform[10],
|
||||
m_matrices.bones[j].deform[11]},
|
||||
glm::vec4{0.0f, 0.0f, 0.0f, 1.0f});
|
||||
;
|
||||
|
||||
glm::vec3 scale;
|
||||
glm::quat rotation;
|
||||
|
|
Loading…
Add table
Reference in a new issue