Cleanup
Many source file name and data type are prefixed by "skeleton" before, now all are refactored. The class MeshResultContext represents the outcome of mesh generation before, now we have material, pose and animation, so we just rename it as Outcome.master
parent
dbc82fa8f1
commit
208d2a0166
39
dust3d.pro
39
dust3d.pro
|
@ -48,20 +48,20 @@ HEADERS += src/modelmeshbinder.h
|
|||
SOURCES += src/modelwidget.cpp
|
||||
HEADERS += src/modelwidget.h
|
||||
|
||||
SOURCES += src/skeletondocument.cpp
|
||||
HEADERS += src/skeletondocument.h
|
||||
SOURCES += src/document.cpp
|
||||
HEADERS += src/document.h
|
||||
|
||||
SOURCES += src/skeletondocumentwindow.cpp
|
||||
HEADERS += src/skeletondocumentwindow.h
|
||||
SOURCES += src/documentwindow.cpp
|
||||
HEADERS += src/documentwindow.h
|
||||
|
||||
SOURCES += src/skeletongraphicswidget.cpp
|
||||
HEADERS += src/skeletongraphicswidget.h
|
||||
|
||||
SOURCES += src/skeletonparttreewidget.cpp
|
||||
HEADERS += src/skeletonparttreewidget.h
|
||||
SOURCES += src/parttreewidget.cpp
|
||||
HEADERS += src/parttreewidget.h
|
||||
|
||||
SOURCES += src/skeletonpartwidget.cpp
|
||||
HEADERS += src/skeletonpartwidget.h
|
||||
SOURCES += src/partwidget.cpp
|
||||
HEADERS += src/partwidget.h
|
||||
|
||||
SOURCES += src/aboutwidget.cpp
|
||||
HEADERS += src/aboutwidget.h
|
||||
|
@ -69,17 +69,17 @@ HEADERS += src/aboutwidget.h
|
|||
SOURCES += src/meshgenerator.cpp
|
||||
HEADERS += src/meshgenerator.h
|
||||
|
||||
SOURCES += src/dust3dutil.cpp
|
||||
HEADERS += src/dust3dutil.h
|
||||
SOURCES += src/util.cpp
|
||||
HEADERS += src/util.h
|
||||
|
||||
SOURCES += src/turnaroundloader.cpp
|
||||
HEADERS += src/turnaroundloader.h
|
||||
|
||||
SOURCES += src/skeletonsnapshot.cpp
|
||||
HEADERS += src/skeletonsnapshot.h
|
||||
SOURCES += src/snapshot.cpp
|
||||
HEADERS += src/snapshot.h
|
||||
|
||||
SOURCES += src/skeletonxml.cpp
|
||||
HEADERS += src/skeletonxml.h
|
||||
SOURCES += src/snapshotxml.cpp
|
||||
HEADERS += src/snapshotxml.h
|
||||
|
||||
SOURCES += src/ds3file.cpp
|
||||
HEADERS += src/ds3file.h
|
||||
|
@ -99,8 +99,8 @@ HEADERS += src/meshutil.h
|
|||
SOURCES += src/texturegenerator.cpp
|
||||
HEADERS += src/texturegenerator.h
|
||||
|
||||
SOURCES += src/meshresultcontext.cpp
|
||||
HEADERS += src/meshresultcontext.h
|
||||
SOURCES += src/outcome.cpp
|
||||
HEADERS += src/outcome.h
|
||||
|
||||
SOURCES += src/meshresultpostprocessor.cpp
|
||||
HEADERS += src/meshresultpostprocessor.h
|
||||
|
@ -146,8 +146,11 @@ HEADERS += src/rigwidget.h
|
|||
SOURCES += src/markiconcreator.cpp
|
||||
HEADERS += src/markiconcreator.h
|
||||
|
||||
SOURCES += src/skeletonbonemark.cpp
|
||||
HEADERS += src/skeletonbonemark.h
|
||||
SOURCES += src/bonemark.cpp
|
||||
HEADERS += src/bonemark.h
|
||||
|
||||
SOURCES += src/skeletonside.cpp
|
||||
HEADERS += src/skeletonside.h
|
||||
|
||||
SOURCES += src/meshsplitter.cpp
|
||||
HEADERS += src/meshsplitter.h
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <QOpenGLFunctions>
|
||||
#include "aboutwidget.h"
|
||||
#include "version.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
AboutWidget::AboutWidget()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef ABOUT_WIDGET_H
|
||||
#define ABOUT_WIDGET_H
|
||||
#ifndef DUST3D_ABOUT_WIDGET_H
|
||||
#define DUST3D_ABOUT_WIDGET_H
|
||||
#include <QDialog>
|
||||
|
||||
class AboutWidget : public QDialog
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <QFormLayout>
|
||||
#include <QCheckBox>
|
||||
#include "advancesettingwidget.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
AdvanceSettingWidget::AdvanceSettingWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
AdvanceSettingWidget::AdvanceSettingWidget(const Document *document, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -18,5 +18,5 @@ AdvanceSettingWidget::AdvanceSettingWidget(const SkeletonDocument *document, QWi
|
|||
|
||||
setLayout(formLayout);
|
||||
|
||||
connect(this, &AdvanceSettingWidget::enableWeld, document, &SkeletonDocument::enableWeld);
|
||||
connect(this, &AdvanceSettingWidget::enableWeld, document, &Document::enableWeld);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ADVANCE_SETTING_WIDGET_H
|
||||
#define ADVANCE_SETTING_WIDGET_H
|
||||
#ifndef DUST3D_ADVANCE_SETTING_WIDGET_H
|
||||
#define DUST3D_ADVANCE_SETTING_WIDGET_H
|
||||
#include <QDialog>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class AdvanceSettingWidget : public QDialog
|
||||
{
|
||||
|
@ -9,9 +9,9 @@ class AdvanceSettingWidget : public QDialog
|
|||
signals:
|
||||
void enableWeld(bool enabled);
|
||||
public:
|
||||
AdvanceSettingWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
AdvanceSettingWidget(const Document *document, QWidget *parent=nullptr);
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -106,9 +106,9 @@ AmbientOcclusionBaker::~AmbientOcclusionBaker()
|
|||
delete m_resultMesh;
|
||||
}
|
||||
|
||||
void AmbientOcclusionBaker::setInputMesh(const MeshResultContext &meshResultContext)
|
||||
void AmbientOcclusionBaker::setInputMesh(const Outcome &outcome)
|
||||
{
|
||||
m_meshResultContext = meshResultContext;
|
||||
m_outcome = outcome;
|
||||
}
|
||||
|
||||
void AmbientOcclusionBaker::setBakeSize(int width, int height)
|
||||
|
@ -141,7 +141,7 @@ void AmbientOcclusionBaker::process()
|
|||
mergeGuidePainter.drawImage(0, 0, *m_borderImage);
|
||||
mergeGuidePainter.end();
|
||||
|
||||
m_resultMesh = new MeshLoader(m_meshResultContext);
|
||||
m_resultMesh = new MeshLoader(m_outcome);
|
||||
m_resultMesh->setTextureImage(new QImage(*m_textureImage));
|
||||
//m_resultMesh->setNormalMapImage(new QImage(*m_textureImage));
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void AmbientOcclusionBaker::process()
|
|||
void AmbientOcclusionBaker::bake()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
if (m_meshResultContext.parts().empty())
|
||||
if (m_outcome.parts().empty())
|
||||
return;
|
||||
|
||||
m_context->makeCurrent(this);
|
||||
|
@ -170,7 +170,7 @@ void AmbientOcclusionBaker::bake()
|
|||
std::vector<vertex_t> vertices;
|
||||
std::vector<int> indicies;
|
||||
std::vector<QVector3D> normals;
|
||||
for (const auto &part: m_meshResultContext.parts()) {
|
||||
for (const auto &part: m_outcome.parts()) {
|
||||
int i = 0;
|
||||
int startIndex = vertices.size();
|
||||
for (const auto &it: part.second.vertices) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef AMBIENT_OCCLUSION_BAKER_H
|
||||
#define AMBIENT_OCCLUSION_BAKER_H
|
||||
#ifndef DUST3D_AMBIENT_OCCLUSION_BAKER_H
|
||||
#define DUST3D_AMBIENT_OCCLUSION_BAKER_H
|
||||
#include <QOffscreenSurface>
|
||||
#include <QScreen>
|
||||
#include <QOpenGLFunctions>
|
||||
|
@ -7,7 +7,7 @@
|
|||
#include <QImage>
|
||||
#include <QThread>
|
||||
#include "qtlightmapper.h"
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
#include "meshloader.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
|
@ -24,7 +24,7 @@ public slots:
|
|||
public:
|
||||
AmbientOcclusionBaker(QScreen *targetScreen = Q_NULLPTR);
|
||||
~AmbientOcclusionBaker();
|
||||
void setInputMesh(const MeshResultContext &meshResultContext);
|
||||
void setInputMesh(const Outcome &outcome);
|
||||
void setBakeSize(int width, int height);
|
||||
void setColorImage(const QImage &colorImage);
|
||||
void setBorderImage(const QImage &borderImage);
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
void setRenderThread(QThread *thread);
|
||||
private:
|
||||
QOpenGLContext *m_context;
|
||||
MeshResultContext m_meshResultContext;
|
||||
Outcome m_outcome;
|
||||
int m_bakeWidth;
|
||||
int m_bakeHeight;
|
||||
QImage *m_ambientOcclusionImage;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <cmath>
|
||||
#include <map>
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
#include "anglesmooth.h"
|
||||
|
||||
void angleSmooth(const std::vector<QVector3D> &vertices,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef ANGLE_SMOOTH_H
|
||||
#define ANGLE_SMOOTH_H
|
||||
#ifndef DUST3D_ANGLE_SMOOTH_H
|
||||
#define DUST3D_ANGLE_SMOOTH_H
|
||||
#include <QVector3D>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef ANIMATION_PLAYER_H
|
||||
#define ANIMATION_PLAYER_H
|
||||
#ifndef DUST3D_ANIMATION_PLAYER_H
|
||||
#define DUST3D_ANIMATION_PLAYER_H
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <QDebug>
|
||||
#include <cmath>
|
||||
#include "theme.h"
|
||||
#include "skeletonbonemark.h"
|
||||
#include "bonemark.h"
|
||||
#include "skeletonside.h"
|
||||
#include "autorigger.h"
|
||||
|
||||
AutoRigger::AutoRigger(const std::vector<QVector3D> &verticesPositions,
|
||||
|
@ -11,11 +12,11 @@ AutoRigger::AutoRigger(const std::vector<QVector3D> &verticesPositions,
|
|||
{
|
||||
}
|
||||
|
||||
bool AutoRigger::isCutOffSplitter(SkeletonBoneMark boneMark)
|
||||
bool AutoRigger::isCutOffSplitter(BoneMark boneMark)
|
||||
{
|
||||
return boneMark == SkeletonBoneMark::Neck ||
|
||||
boneMark == SkeletonBoneMark::Shoulder ||
|
||||
boneMark == SkeletonBoneMark::Hip;
|
||||
return boneMark == BoneMark::Neck ||
|
||||
boneMark == BoneMark::Shoulder ||
|
||||
boneMark == BoneMark::Hip;
|
||||
}
|
||||
|
||||
bool AutoRigger::calculateBodyTriangles(std::set<MeshSplitterTriangle> &bodyTriangles)
|
||||
|
@ -41,7 +42,7 @@ bool AutoRigger::calculateBodyTriangles(std::set<MeshSplitterTriangle> &bodyTria
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AutoRigger::addMarkGroup(SkeletonBoneMark boneMark, SkeletonSide boneSide, QVector3D bonePosition,
|
||||
bool AutoRigger::addMarkGroup(BoneMark boneMark, SkeletonSide boneSide, QVector3D bonePosition,
|
||||
const std::set<MeshSplitterTriangle> &markTriangles)
|
||||
{
|
||||
m_marks.push_back(AutoRiggerMark());
|
||||
|
@ -55,9 +56,9 @@ bool AutoRigger::addMarkGroup(SkeletonBoneMark boneMark, SkeletonSide boneSide,
|
|||
if (isCutOffSplitter(mark.boneMark)) {
|
||||
if (!mark.split(m_inputTriangles)) {
|
||||
m_marksMap[std::make_pair(mark.boneMark, mark.boneSide)].push_back(m_marks.size() - 1);
|
||||
m_errorMarkNames.push_back(SkeletonSideToDispName(mark.boneSide) + " " + SkeletonBoneMarkToDispName(mark.boneMark));
|
||||
m_errorMarkNames.push_back(SkeletonSideToDispName(mark.boneSide) + " " + BoneMarkToDispName(mark.boneMark));
|
||||
m_messages.push_back(std::make_pair(QtCriticalMsg,
|
||||
tr("Mark \"%1 %2\" couldn't cut off the mesh").arg(SkeletonSideToDispName(mark.boneSide)).arg(SkeletonBoneMarkToString(mark.boneMark))));
|
||||
tr("Mark \"%1 %2\" couldn't cut off the mesh").arg(SkeletonSideToDispName(mark.boneSide)).arg(BoneMarkToString(mark.boneMark))));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -85,26 +86,26 @@ bool AutoRigger::validate()
|
|||
{
|
||||
bool foundError = false;
|
||||
|
||||
std::vector<std::pair<SkeletonBoneMark, SkeletonSide>> mustPresentedMarks;
|
||||
std::vector<std::pair<BoneMark, SkeletonSide>> mustPresentedMarks;
|
||||
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Neck, SkeletonSide::None));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Shoulder, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Elbow, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Wrist, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Shoulder, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Elbow, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Wrist, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Hip, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Knee, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Ankle, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Hip, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Knee, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(SkeletonBoneMark::Ankle, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Neck, SkeletonSide::None));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Shoulder, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Elbow, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Wrist, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Shoulder, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Elbow, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Wrist, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Hip, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Knee, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Ankle, SkeletonSide::Left));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Hip, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Knee, SkeletonSide::Right));
|
||||
mustPresentedMarks.push_back(std::make_pair(BoneMark::Ankle, SkeletonSide::Right));
|
||||
|
||||
for (const auto &pair: mustPresentedMarks) {
|
||||
if (m_marksMap.find(pair) == m_marksMap.end()) {
|
||||
foundError = true;
|
||||
QString markDispName = SkeletonSideToDispName(pair.second) + " " + SkeletonBoneMarkToDispName(pair.first);
|
||||
QString markDispName = SkeletonSideToDispName(pair.second) + " " + BoneMarkToDispName(pair.first);
|
||||
m_missingMarkNames.push_back(markDispName);
|
||||
m_messages.push_back(std::make_pair(QtCriticalMsg,
|
||||
tr("Couldn't find valid \"%1\" mark").arg(markDispName)));
|
||||
|
@ -264,19 +265,19 @@ bool AutoRigger::rig()
|
|||
if (!calculateBodyTriangles(bodyTriangles))
|
||||
return false;
|
||||
|
||||
auto neckIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Neck, SkeletonSide::None));
|
||||
auto leftShoulderIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Shoulder, SkeletonSide::Left));
|
||||
auto leftElbowIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Elbow, SkeletonSide::Left));
|
||||
auto leftWristIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Wrist, SkeletonSide::Left));
|
||||
auto rightShoulderIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Shoulder, SkeletonSide::Right));
|
||||
auto rightElbowIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Elbow, SkeletonSide::Right));
|
||||
auto rightWristIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Wrist, SkeletonSide::Right));
|
||||
auto leftHipIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Hip, SkeletonSide::Left));
|
||||
auto leftKneeIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Knee, SkeletonSide::Left));
|
||||
auto leftAnkleIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Ankle, SkeletonSide::Left));
|
||||
auto rightHipIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Hip, SkeletonSide::Right));
|
||||
auto rightKneeIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Knee, SkeletonSide::Right));
|
||||
auto rightAnkleIndicies = m_marksMap.find(std::make_pair(SkeletonBoneMark::Ankle, SkeletonSide::Right));
|
||||
auto neckIndicies = m_marksMap.find(std::make_pair(BoneMark::Neck, SkeletonSide::None));
|
||||
auto leftShoulderIndicies = m_marksMap.find(std::make_pair(BoneMark::Shoulder, SkeletonSide::Left));
|
||||
auto leftElbowIndicies = m_marksMap.find(std::make_pair(BoneMark::Elbow, SkeletonSide::Left));
|
||||
auto leftWristIndicies = m_marksMap.find(std::make_pair(BoneMark::Wrist, SkeletonSide::Left));
|
||||
auto rightShoulderIndicies = m_marksMap.find(std::make_pair(BoneMark::Shoulder, SkeletonSide::Right));
|
||||
auto rightElbowIndicies = m_marksMap.find(std::make_pair(BoneMark::Elbow, SkeletonSide::Right));
|
||||
auto rightWristIndicies = m_marksMap.find(std::make_pair(BoneMark::Wrist, SkeletonSide::Right));
|
||||
auto leftHipIndicies = m_marksMap.find(std::make_pair(BoneMark::Hip, SkeletonSide::Left));
|
||||
auto leftKneeIndicies = m_marksMap.find(std::make_pair(BoneMark::Knee, SkeletonSide::Left));
|
||||
auto leftAnkleIndicies = m_marksMap.find(std::make_pair(BoneMark::Ankle, SkeletonSide::Left));
|
||||
auto rightHipIndicies = m_marksMap.find(std::make_pair(BoneMark::Hip, SkeletonSide::Right));
|
||||
auto rightKneeIndicies = m_marksMap.find(std::make_pair(BoneMark::Knee, SkeletonSide::Right));
|
||||
auto rightAnkleIndicies = m_marksMap.find(std::make_pair(BoneMark::Ankle, SkeletonSide::Right));
|
||||
|
||||
// 1. Prepare all bones start and stop positions:
|
||||
|
||||
|
@ -625,7 +626,7 @@ bool AutoRigger::rig()
|
|||
leftUpperLegBone.name = "LeftUpperLeg";
|
||||
leftUpperLegBone.headPosition = m_resultBones[boneIndexMap["LeftHip"]].tailPosition;
|
||||
leftUpperLegBone.tailPosition = leftLowerLegBoneStartPosition;
|
||||
leftUpperLegBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Hip);
|
||||
leftUpperLegBone.color = BoneMarkToColor(BoneMark::Hip);
|
||||
boneIndexMap[leftUpperLegBone.name] = leftUpperLegBone.index;
|
||||
m_resultBones[boneIndexMap["LeftHip"]].children.push_back(leftUpperLegBone.index);
|
||||
|
||||
|
@ -635,7 +636,7 @@ bool AutoRigger::rig()
|
|||
leftLowerLegBone.name = "LeftLowerLeg";
|
||||
leftLowerLegBone.headPosition = m_resultBones[boneIndexMap["LeftUpperLeg"]].tailPosition;
|
||||
leftLowerLegBone.tailPosition = leftFootBoneStartPosition;
|
||||
leftLowerLegBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Knee);
|
||||
leftLowerLegBone.color = BoneMarkToColor(BoneMark::Knee);
|
||||
boneIndexMap[leftLowerLegBone.name] = leftLowerLegBone.index;
|
||||
m_resultBones[boneIndexMap["LeftUpperLeg"]].children.push_back(leftLowerLegBone.index);
|
||||
|
||||
|
@ -645,7 +646,7 @@ bool AutoRigger::rig()
|
|||
leftFootBone.name = "LeftFoot";
|
||||
leftFootBone.headPosition = m_resultBones[boneIndexMap["LeftLowerLeg"]].tailPosition;
|
||||
leftFootBone.tailPosition = leftFootBoneStopPosition;
|
||||
leftFootBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Ankle);
|
||||
leftFootBone.color = BoneMarkToColor(BoneMark::Ankle);
|
||||
boneIndexMap[leftFootBone.name] = leftFootBone.index;
|
||||
m_resultBones[boneIndexMap["LeftLowerLeg"]].children.push_back(leftFootBone.index);
|
||||
|
||||
|
@ -664,7 +665,7 @@ bool AutoRigger::rig()
|
|||
rightUpperLegBone.name = "RightUpperLeg";
|
||||
rightUpperLegBone.headPosition = m_resultBones[boneIndexMap["RightHip"]].tailPosition;
|
||||
rightUpperLegBone.tailPosition = rightLowerLegBoneStartPosition;
|
||||
rightUpperLegBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Hip);
|
||||
rightUpperLegBone.color = BoneMarkToColor(BoneMark::Hip);
|
||||
boneIndexMap[rightUpperLegBone.name] = rightUpperLegBone.index;
|
||||
m_resultBones[boneIndexMap["RightHip"]].children.push_back(rightUpperLegBone.index);
|
||||
|
||||
|
@ -674,7 +675,7 @@ bool AutoRigger::rig()
|
|||
rightLowerLegBone.name = "RightLowerLeg";
|
||||
rightLowerLegBone.headPosition = m_resultBones[boneIndexMap["RightUpperLeg"]].tailPosition;
|
||||
rightLowerLegBone.tailPosition = rightFootBoneStartPosition;
|
||||
rightLowerLegBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Knee);
|
||||
rightLowerLegBone.color = BoneMarkToColor(BoneMark::Knee);
|
||||
boneIndexMap[rightLowerLegBone.name] = rightLowerLegBone.index;
|
||||
m_resultBones[boneIndexMap["RightUpperLeg"]].children.push_back(rightLowerLegBone.index);
|
||||
|
||||
|
@ -684,7 +685,7 @@ bool AutoRigger::rig()
|
|||
rightFootBone.name = "RightFoot";
|
||||
rightFootBone.headPosition = m_resultBones[boneIndexMap["RightLowerLeg"]].tailPosition;
|
||||
rightFootBone.tailPosition = rightFootBoneStopPosition;
|
||||
rightFootBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Ankle);
|
||||
rightFootBone.color = BoneMarkToColor(BoneMark::Ankle);
|
||||
boneIndexMap[rightFootBone.name] = rightFootBone.index;
|
||||
m_resultBones[boneIndexMap["RightLowerLeg"]].children.push_back(rightFootBone.index);
|
||||
|
||||
|
@ -723,7 +724,7 @@ bool AutoRigger::rig()
|
|||
leftUpperArmBone.name = "LeftUpperArm";
|
||||
leftUpperArmBone.headPosition = m_resultBones[boneIndexMap["LeftShoulder"]].tailPosition;
|
||||
leftUpperArmBone.tailPosition = leftLowerArmBoneStartPosition;
|
||||
leftUpperArmBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Shoulder);
|
||||
leftUpperArmBone.color = BoneMarkToColor(BoneMark::Shoulder);
|
||||
boneIndexMap[leftUpperArmBone.name] = leftUpperArmBone.index;
|
||||
m_resultBones[boneIndexMap["LeftShoulder"]].children.push_back(leftUpperArmBone.index);
|
||||
|
||||
|
@ -733,7 +734,7 @@ bool AutoRigger::rig()
|
|||
leftLowerArmBone.name = "LeftLowerArm";
|
||||
leftLowerArmBone.headPosition = m_resultBones[boneIndexMap["LeftUpperArm"]].tailPosition;
|
||||
leftLowerArmBone.tailPosition = leftHandBoneStartPosition;
|
||||
leftLowerArmBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Elbow);
|
||||
leftLowerArmBone.color = BoneMarkToColor(BoneMark::Elbow);
|
||||
boneIndexMap[leftLowerArmBone.name] = leftLowerArmBone.index;
|
||||
m_resultBones[boneIndexMap["LeftUpperArm"]].children.push_back(leftLowerArmBone.index);
|
||||
|
||||
|
@ -743,7 +744,7 @@ bool AutoRigger::rig()
|
|||
leftHandBone.name = "LeftHand";
|
||||
leftHandBone.headPosition = m_resultBones[boneIndexMap["LeftLowerArm"]].tailPosition;
|
||||
leftHandBone.tailPosition = leftHandBoneStopPosition;
|
||||
leftHandBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Wrist);
|
||||
leftHandBone.color = BoneMarkToColor(BoneMark::Wrist);
|
||||
boneIndexMap[leftHandBone.name] = leftHandBone.index;
|
||||
m_resultBones[boneIndexMap["LeftLowerArm"]].children.push_back(leftHandBone.index);
|
||||
|
||||
|
@ -762,7 +763,7 @@ bool AutoRigger::rig()
|
|||
rightUpperArmBone.name = "RightUpperArm";
|
||||
rightUpperArmBone.headPosition = m_resultBones[boneIndexMap["RightShoulder"]].tailPosition;
|
||||
rightUpperArmBone.tailPosition = rightLowerArmBoneStartPosition;
|
||||
rightUpperArmBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Shoulder);
|
||||
rightUpperArmBone.color = BoneMarkToColor(BoneMark::Shoulder);
|
||||
boneIndexMap[rightUpperArmBone.name] = rightUpperArmBone.index;
|
||||
m_resultBones[boneIndexMap["RightShoulder"]].children.push_back(rightUpperArmBone.index);
|
||||
|
||||
|
@ -772,7 +773,7 @@ bool AutoRigger::rig()
|
|||
rightLowerArmBone.name = "RightLowerArm";
|
||||
rightLowerArmBone.headPosition = m_resultBones[boneIndexMap["RightUpperArm"]].tailPosition;
|
||||
rightLowerArmBone.tailPosition = rightHandBoneStartPosition;
|
||||
rightLowerArmBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Elbow);
|
||||
rightLowerArmBone.color = BoneMarkToColor(BoneMark::Elbow);
|
||||
boneIndexMap[rightLowerArmBone.name] = rightLowerArmBone.index;
|
||||
m_resultBones[boneIndexMap["RightUpperArm"]].children.push_back(rightLowerArmBone.index);
|
||||
|
||||
|
@ -782,7 +783,7 @@ bool AutoRigger::rig()
|
|||
rightHandBone.name = "RightHand";
|
||||
rightHandBone.headPosition = m_resultBones[boneIndexMap["RightLowerArm"]].tailPosition;
|
||||
rightHandBone.tailPosition = rightHandBoneStopPosition;
|
||||
rightHandBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Wrist);
|
||||
rightHandBone.color = BoneMarkToColor(BoneMark::Wrist);
|
||||
boneIndexMap[rightHandBone.name] = rightHandBone.index;
|
||||
m_resultBones[boneIndexMap["RightLowerArm"]].children.push_back(rightHandBone.index);
|
||||
|
||||
|
@ -792,7 +793,7 @@ bool AutoRigger::rig()
|
|||
neckBone.name = "Neck";
|
||||
neckBone.headPosition = m_resultBones[boneIndexMap["Chest"]].tailPosition;
|
||||
neckBone.tailPosition = headBoneStartPosition;
|
||||
neckBone.color = SkeletonBoneMarkToColor(SkeletonBoneMark::Neck);
|
||||
neckBone.color = BoneMarkToColor(BoneMark::Neck);
|
||||
boneIndexMap[neckBone.name] = neckBone.index;
|
||||
m_resultBones[boneIndexMap["Chest"]].children.push_back(neckBone.index);
|
||||
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
#ifndef AUTO_RIGGER_H
|
||||
#define AUTO_RIGGER_H
|
||||
#ifndef DUST3D_AUTO_RIGGER_H
|
||||
#define DUST3D_AUTO_RIGGER_H
|
||||
#include <QtGlobal>
|
||||
#include <QVector3D>
|
||||
#include <QObject>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include "meshsplitter.h"
|
||||
#include "skeletonbonemark.h"
|
||||
#include "bonemark.h"
|
||||
#include "rigtype.h"
|
||||
#include "skeletonside.h"
|
||||
|
||||
class AutoRiggerMark
|
||||
{
|
||||
public:
|
||||
SkeletonBoneMark boneMark;
|
||||
BoneMark boneMark;
|
||||
SkeletonSide boneSide;
|
||||
QVector3D bonePosition;
|
||||
std::set<MeshSplitterTriangle> markTriangles;
|
||||
|
@ -89,7 +90,7 @@ class AutoRigger : public QObject
|
|||
public:
|
||||
AutoRigger(const std::vector<QVector3D> &verticesPositions,
|
||||
const std::set<MeshSplitterTriangle> &inputTriangles);
|
||||
bool addMarkGroup(SkeletonBoneMark boneMark, SkeletonSide boneSide, QVector3D bonePosition,
|
||||
bool addMarkGroup(BoneMark boneMark, SkeletonSide boneSide, QVector3D bonePosition,
|
||||
const std::set<MeshSplitterTriangle> &markTriangles);
|
||||
const std::vector<std::pair<QtMsgType, QString>> &messages();
|
||||
bool rig();
|
||||
|
@ -101,7 +102,7 @@ private:
|
|||
bool validate();
|
||||
void addTrianglesToVertices(const std::set<MeshSplitterTriangle> &triangles, std::set<int> &vertices);
|
||||
bool calculateBodyTriangles(std::set<MeshSplitterTriangle> &bodyTriangles);
|
||||
bool isCutOffSplitter(SkeletonBoneMark boneMark);
|
||||
bool isCutOffSplitter(BoneMark boneMark);
|
||||
void resolveBoundingBox(const std::set<int> &vertices, QVector3D &xMin, QVector3D &xMax, QVector3D &yMin, QVector3D &yMax, QVector3D &zMin, QVector3D &zMax);
|
||||
QVector3D findMinX(const std::set<int> &vertices);
|
||||
QVector3D findMaxX(const std::set<int> &vertices);
|
||||
|
@ -117,7 +118,7 @@ private:
|
|||
std::vector<QVector3D> m_verticesPositions;
|
||||
std::set<MeshSplitterTriangle> m_inputTriangles;
|
||||
std::vector<AutoRiggerMark> m_marks;
|
||||
std::map<std::pair<SkeletonBoneMark, SkeletonSide>, std::vector<int>> m_marksMap;
|
||||
std::map<std::pair<BoneMark, SkeletonSide>, std::vector<int>> m_marksMap;
|
||||
std::vector<AutoRiggerBone> m_resultBones;
|
||||
std::map<int, AutoRiggerVertexWeights> m_resultWeights;
|
||||
std::vector<QString> m_missingMarkNames;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include <QObject>
|
||||
#include "bonemark.h"
|
||||
|
||||
IMPL_BoneMarkToColor
|
||||
IMPL_BoneMarkToString
|
||||
IMPL_BoneMarkFromString
|
||||
IMPL_BoneMarkToDispName
|
|
@ -0,0 +1,117 @@
|
|||
#ifndef DUST3D_BONE_MARK_H
|
||||
#define DUST3D_BONE_MARK_H
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
|
||||
enum class BoneMark
|
||||
{
|
||||
None = 0,
|
||||
Neck,
|
||||
Shoulder,
|
||||
Elbow,
|
||||
Wrist,
|
||||
Hip,
|
||||
Knee,
|
||||
Ankle,
|
||||
Count
|
||||
};
|
||||
#define BoneMarkHasSide(mark) ((mark) != BoneMark::Neck)
|
||||
QColor BoneMarkToColor(BoneMark mark);
|
||||
#define IMPL_BoneMarkToColor \
|
||||
QColor BoneMarkToColor(BoneMark mark) \
|
||||
{ \
|
||||
switch (mark) { \
|
||||
case BoneMark::Neck: \
|
||||
return QColor(0xfc, 0x0d, 0x1b); \
|
||||
case BoneMark::Shoulder: \
|
||||
return QColor(0xfd, 0x80, 0x23); \
|
||||
case BoneMark::Elbow: \
|
||||
return QColor(0x29, 0xfd, 0x2f); \
|
||||
case BoneMark::Wrist: \
|
||||
return QColor(0xff, 0xfd, 0x38); \
|
||||
case BoneMark::Hip: \
|
||||
return QColor(0x2c, 0xff, 0xfe); \
|
||||
case BoneMark::Knee: \
|
||||
return QColor(0x0b, 0x24, 0xfb); \
|
||||
case BoneMark::Ankle: \
|
||||
return QColor(0xfc, 0x28, 0xfc); \
|
||||
case BoneMark::None: \
|
||||
return Qt::transparent; \
|
||||
default: \
|
||||
return Qt::transparent; \
|
||||
} \
|
||||
}
|
||||
const char *BoneMarkToString(BoneMark mark);
|
||||
#define IMPL_BoneMarkToString \
|
||||
const char *BoneMarkToString(BoneMark mark) \
|
||||
{ \
|
||||
switch (mark) { \
|
||||
case BoneMark::Neck: \
|
||||
return "Neck"; \
|
||||
case BoneMark::Shoulder: \
|
||||
return "Shoulder"; \
|
||||
case BoneMark::Elbow: \
|
||||
return "Elbow"; \
|
||||
case BoneMark::Wrist: \
|
||||
return "Wrist"; \
|
||||
case BoneMark::Hip: \
|
||||
return "Hip"; \
|
||||
case BoneMark::Knee: \
|
||||
return "Knee"; \
|
||||
case BoneMark::Ankle: \
|
||||
return "Ankle"; \
|
||||
case BoneMark::None: \
|
||||
return "None"; \
|
||||
default: \
|
||||
return "None"; \
|
||||
} \
|
||||
}
|
||||
BoneMark BoneMarkFromString(const char *markString);
|
||||
#define IMPL_BoneMarkFromString \
|
||||
BoneMark BoneMarkFromString(const char *markString) \
|
||||
{ \
|
||||
QString mark = markString; \
|
||||
if (mark == "Neck") \
|
||||
return BoneMark::Neck; \
|
||||
if (mark == "Shoulder") \
|
||||
return BoneMark::Shoulder; \
|
||||
if (mark == "Elbow") \
|
||||
return BoneMark::Elbow; \
|
||||
if (mark == "Wrist") \
|
||||
return BoneMark::Wrist; \
|
||||
if (mark == "Hip") \
|
||||
return BoneMark::Hip; \
|
||||
if (mark == "Knee") \
|
||||
return BoneMark::Knee; \
|
||||
if (mark == "Ankle") \
|
||||
return BoneMark::Ankle; \
|
||||
return BoneMark::None; \
|
||||
}
|
||||
QString BoneMarkToDispName(BoneMark mark);
|
||||
#define IMPL_BoneMarkToDispName \
|
||||
QString BoneMarkToDispName(BoneMark mark) \
|
||||
{ \
|
||||
switch (mark) { \
|
||||
case BoneMark::Neck: \
|
||||
return QObject::tr("Neck"); \
|
||||
case BoneMark::Shoulder: \
|
||||
return QObject::tr("Shoulder (Arm Start)"); \
|
||||
case BoneMark::Elbow: \
|
||||
return QObject::tr("Elbow"); \
|
||||
case BoneMark::Wrist: \
|
||||
return QObject::tr("Wrist"); \
|
||||
case BoneMark::Hip: \
|
||||
return QObject::tr("Hip (Leg Start)"); \
|
||||
case BoneMark::Knee: \
|
||||
return QObject::tr("Knee"); \
|
||||
case BoneMark::Ankle: \
|
||||
return QObject::tr("Ankle"); \
|
||||
case BoneMark::None: \
|
||||
return QObject::tr("None"); \
|
||||
default: \
|
||||
return ""; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#include <QDebug>
|
||||
#include <cmath>
|
||||
#include "ccdikresolver.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
CCDIKSolver::CCDIKSolver() :
|
||||
m_maxRound(4),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef CCD_IK_SOLVER_H
|
||||
#define CCD_IK_SOLVER_H
|
||||
#ifndef DUST3D_CCD_IK_SOLVER_H
|
||||
#define DUST3D_CCD_IK_SOLVER_H
|
||||
#include <vector>
|
||||
#include <QVector3D>
|
||||
#include <QQuaternion>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
#ifndef SKELETON_DOCUMENT_H
|
||||
#define SKELETON_DOCUMENT_H
|
||||
#ifndef DUST3D_DOCUMENT_H
|
||||
#define DUST3D_DOCUMENT_H
|
||||
#include <QObject>
|
||||
#include <QUuid>
|
||||
#include <vector>
|
||||
|
@ -10,14 +10,14 @@
|
|||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <QOpenGLWidget>
|
||||
#include "skeletonsnapshot.h"
|
||||
#include "snapshot.h"
|
||||
#include "meshloader.h"
|
||||
#include "meshgenerator.h"
|
||||
#include "theme.h"
|
||||
#include "texturegenerator.h"
|
||||
#include "meshresultpostprocessor.h"
|
||||
#include "ambientocclusionbaker.h"
|
||||
#include "skeletonbonemark.h"
|
||||
#include "bonemark.h"
|
||||
#include "riggenerator.h"
|
||||
#include "rigtype.h"
|
||||
#include "posepreviewsgenerator.h"
|
||||
|
@ -28,15 +28,15 @@
|
|||
class MaterialPreviewsGenerator;
|
||||
class MotionsGenerator;
|
||||
|
||||
class SkeletonNode
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
SkeletonNode(const QUuid &withId=QUuid()) :
|
||||
Node(const QUuid &withId=QUuid()) :
|
||||
x(0),
|
||||
y(0),
|
||||
z(0),
|
||||
radius(0),
|
||||
boneMark(SkeletonBoneMark::None)
|
||||
boneMark(BoneMark::None)
|
||||
{
|
||||
id = withId.isNull() ? QUuid::createUuid() : withId;
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ public:
|
|||
float y;
|
||||
float z;
|
||||
float radius;
|
||||
SkeletonBoneMark boneMark;
|
||||
BoneMark boneMark;
|
||||
std::vector<QUuid> edgeIds;
|
||||
};
|
||||
|
||||
class SkeletonEdge
|
||||
class Edge
|
||||
{
|
||||
public:
|
||||
SkeletonEdge(const QUuid &withId=QUuid())
|
||||
Edge(const QUuid &withId=QUuid())
|
||||
{
|
||||
id = withId.isNull() ? QUuid::createUuid() : withId;
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class SkeletonPart
|
||||
class Part
|
||||
{
|
||||
public:
|
||||
~SkeletonPart()
|
||||
~Part()
|
||||
{
|
||||
delete m_previewMesh;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
bool dirty;
|
||||
bool wrapped;
|
||||
QUuid materialId;
|
||||
SkeletonPart(const QUuid &withId=QUuid()) :
|
||||
Part(const QUuid &withId=QUuid()) :
|
||||
visible(true),
|
||||
locked(false),
|
||||
subdived(false),
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
{
|
||||
return visible && !disabled;
|
||||
}
|
||||
void copyAttributes(const SkeletonPart &other)
|
||||
void copyAttributes(const Part &other)
|
||||
{
|
||||
visible = other.visible;
|
||||
locked = other.locked;
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
return new MeshLoader(*m_previewMesh);
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(SkeletonPart);
|
||||
Q_DISABLE_COPY(Part);
|
||||
MeshLoader *m_previewMesh = nullptr;
|
||||
};
|
||||
|
||||
|
@ -197,13 +197,13 @@ enum class SkeletonProfile
|
|||
Side
|
||||
};
|
||||
|
||||
class SkeletonHistoryItem
|
||||
class HistoryItem
|
||||
{
|
||||
public:
|
||||
SkeletonSnapshot snapshot;
|
||||
Snapshot snapshot;
|
||||
};
|
||||
|
||||
enum class SkeletonDocumentEditMode
|
||||
enum class DocumentEditMode
|
||||
{
|
||||
Add = 0,
|
||||
Select,
|
||||
|
@ -212,13 +212,13 @@ enum class SkeletonDocumentEditMode
|
|||
ZoomOut
|
||||
};
|
||||
|
||||
class SkeletonComponent
|
||||
class Component
|
||||
{
|
||||
public:
|
||||
SkeletonComponent()
|
||||
Component()
|
||||
{
|
||||
}
|
||||
SkeletonComponent(const QUuid &withId, const QString &linkData=QString(), const QString &linkDataType=QString())
|
||||
Component(const QUuid &withId, const QString &linkData=QString(), const QString &linkDataType=QString())
|
||||
{
|
||||
id = withId.isNull() ? QUuid::createUuid() : withId;
|
||||
if (!linkData.isEmpty()) {
|
||||
|
@ -359,13 +359,13 @@ private:
|
|||
std::set<QUuid> m_childrenIdSet;
|
||||
};
|
||||
|
||||
class SkeletonPose
|
||||
class Pose
|
||||
{
|
||||
public:
|
||||
SkeletonPose()
|
||||
Pose()
|
||||
{
|
||||
}
|
||||
~SkeletonPose()
|
||||
~Pose()
|
||||
{
|
||||
delete m_previewMesh;
|
||||
}
|
||||
|
@ -385,76 +385,76 @@ public:
|
|||
return new MeshLoader(*m_previewMesh);
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(SkeletonPose);
|
||||
Q_DISABLE_COPY(Pose);
|
||||
MeshLoader *m_previewMesh = nullptr;
|
||||
};
|
||||
|
||||
enum class SkeletonMotionClipType
|
||||
enum class MotionClipType
|
||||
{
|
||||
Pose,
|
||||
Interpolation,
|
||||
Motion
|
||||
};
|
||||
|
||||
class SkeletonMotionClip
|
||||
class MotionClip
|
||||
{
|
||||
public:
|
||||
SkeletonMotionClip()
|
||||
MotionClip()
|
||||
{
|
||||
}
|
||||
SkeletonMotionClip(const QString &linkData, const QString &linkDataType)
|
||||
MotionClip(const QString &linkData, const QString &linkDataType)
|
||||
{
|
||||
if ("poseId" == linkDataType) {
|
||||
clipType = SkeletonMotionClipType::Pose;
|
||||
clipType = MotionClipType::Pose;
|
||||
linkToId = QUuid(linkData);
|
||||
} else if ("InterpolationType" == linkDataType) {
|
||||
clipType = SkeletonMotionClipType::Interpolation;
|
||||
clipType = MotionClipType::Interpolation;
|
||||
interpolationType = InterpolationTypeFromString(linkData.toUtf8().constData());
|
||||
} else if ("motionId" == linkDataType) {
|
||||
clipType = SkeletonMotionClipType::Motion;
|
||||
clipType = MotionClipType::Motion;
|
||||
linkToId = QUuid(linkData);
|
||||
}
|
||||
}
|
||||
QString linkDataType() const
|
||||
{
|
||||
if (SkeletonMotionClipType::Pose == clipType)
|
||||
if (MotionClipType::Pose == clipType)
|
||||
return "poseId";
|
||||
if (SkeletonMotionClipType::Interpolation == clipType)
|
||||
if (MotionClipType::Interpolation == clipType)
|
||||
return "InterpolationType";
|
||||
if (SkeletonMotionClipType::Motion == clipType)
|
||||
if (MotionClipType::Motion == clipType)
|
||||
return "motionId";
|
||||
return "poseId";
|
||||
}
|
||||
QString linkData() const
|
||||
{
|
||||
if (SkeletonMotionClipType::Pose == clipType)
|
||||
if (MotionClipType::Pose == clipType)
|
||||
return linkToId.toString();
|
||||
if (SkeletonMotionClipType::Interpolation == clipType)
|
||||
if (MotionClipType::Interpolation == clipType)
|
||||
return InterpolationTypeToString(interpolationType);
|
||||
if (SkeletonMotionClipType::Motion == clipType)
|
||||
if (MotionClipType::Motion == clipType)
|
||||
return linkToId.toString();
|
||||
return linkToId.toString();
|
||||
}
|
||||
float duration = 0.0;
|
||||
SkeletonMotionClipType clipType = SkeletonMotionClipType::Pose;
|
||||
MotionClipType clipType = MotionClipType::Pose;
|
||||
QUuid linkToId;
|
||||
InterpolationType interpolationType;
|
||||
};
|
||||
|
||||
class SkeletonMotion
|
||||
class Motion
|
||||
{
|
||||
public:
|
||||
SkeletonMotion()
|
||||
Motion()
|
||||
{
|
||||
}
|
||||
~SkeletonMotion()
|
||||
~Motion()
|
||||
{
|
||||
releasePreviewMeshs();
|
||||
}
|
||||
QUuid id;
|
||||
QString name;
|
||||
bool dirty = true;
|
||||
std::vector<SkeletonMotionClip> clips;
|
||||
std::vector<MotionClip> clips;
|
||||
std::vector<std::pair<float, JointNodeTree>> jointNodeTrees;
|
||||
void updatePreviewMeshs(std::vector<std::pair<float, MeshLoader *>> &previewMeshs)
|
||||
{
|
||||
|
@ -469,7 +469,7 @@ public:
|
|||
return new MeshLoader(*m_previewMeshs[0].second);
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(SkeletonMotion);
|
||||
Q_DISABLE_COPY(Motion);
|
||||
void releasePreviewMeshs()
|
||||
{
|
||||
for (const auto &item: m_previewMeshs) {
|
||||
|
@ -480,33 +480,33 @@ private:
|
|||
std::vector<std::pair<float, MeshLoader *>> m_previewMeshs;
|
||||
};
|
||||
|
||||
class SkeletonMaterialMap
|
||||
class MaterialMap
|
||||
{
|
||||
public:
|
||||
TextureType forWhat;
|
||||
QUuid imageId;
|
||||
};
|
||||
|
||||
class SkeletonMaterialLayer
|
||||
class MaterialLayer
|
||||
{
|
||||
public:
|
||||
std::vector<SkeletonMaterialMap> maps;
|
||||
std::vector<MaterialMap> maps;
|
||||
};
|
||||
|
||||
class SkeletonMaterial
|
||||
class Material
|
||||
{
|
||||
public:
|
||||
SkeletonMaterial()
|
||||
Material()
|
||||
{
|
||||
}
|
||||
~SkeletonMaterial()
|
||||
~Material()
|
||||
{
|
||||
delete m_previewMesh;
|
||||
}
|
||||
QUuid id;
|
||||
QString name;
|
||||
bool dirty = true;
|
||||
std::vector<SkeletonMaterialLayer> layers;
|
||||
std::vector<MaterialLayer> layers;
|
||||
void updatePreviewMesh(MeshLoader *previewMesh)
|
||||
{
|
||||
delete m_previewMesh;
|
||||
|
@ -519,11 +519,11 @@ public:
|
|||
return new MeshLoader(*m_previewMesh);
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(SkeletonMaterial);
|
||||
Q_DISABLE_COPY(Material);
|
||||
MeshLoader *m_previewMesh = nullptr;
|
||||
};
|
||||
|
||||
enum class SkeletonDocumentToSnapshotFor
|
||||
enum class DocumentToSnapshotFor
|
||||
{
|
||||
Document = 0,
|
||||
Nodes,
|
||||
|
@ -532,7 +532,7 @@ enum class SkeletonDocumentToSnapshotFor
|
|||
Motions
|
||||
};
|
||||
|
||||
class SkeletonDocument : public QObject
|
||||
class Document : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
|
@ -623,7 +623,7 @@ public: // need initialize
|
|||
float originX;
|
||||
float originY;
|
||||
float originZ;
|
||||
SkeletonDocumentEditMode editMode;
|
||||
DocumentEditMode editMode;
|
||||
bool xlocked;
|
||||
bool ylocked;
|
||||
bool zlocked;
|
||||
|
@ -636,38 +636,38 @@ public: // need initialize
|
|||
RigType rigType;
|
||||
bool weldEnabled;
|
||||
public:
|
||||
SkeletonDocument();
|
||||
~SkeletonDocument();
|
||||
std::map<QUuid, SkeletonPart> partMap;
|
||||
std::map<QUuid, SkeletonNode> nodeMap;
|
||||
std::map<QUuid, SkeletonEdge> edgeMap;
|
||||
std::map<QUuid, SkeletonComponent> componentMap;
|
||||
std::map<QUuid, SkeletonMaterial> materialMap;
|
||||
Document();
|
||||
~Document();
|
||||
std::map<QUuid, Part> partMap;
|
||||
std::map<QUuid, Node> nodeMap;
|
||||
std::map<QUuid, Edge> edgeMap;
|
||||
std::map<QUuid, Component> componentMap;
|
||||
std::map<QUuid, Material> materialMap;
|
||||
std::vector<QUuid> materialIdList;
|
||||
std::map<QUuid, SkeletonPose> poseMap;
|
||||
std::map<QUuid, Pose> poseMap;
|
||||
std::vector<QUuid> poseIdList;
|
||||
std::map<QUuid, SkeletonMotion> motionMap;
|
||||
std::map<QUuid, Motion> motionMap;
|
||||
std::vector<QUuid> motionIdList;
|
||||
SkeletonComponent rootComponent;
|
||||
Component rootComponent;
|
||||
QImage turnaround;
|
||||
QImage preview;
|
||||
void toSnapshot(SkeletonSnapshot *snapshot, const std::set<QUuid> &limitNodeIds=std::set<QUuid>(),
|
||||
SkeletonDocumentToSnapshotFor forWhat=SkeletonDocumentToSnapshotFor::Document,
|
||||
void toSnapshot(Snapshot *snapshot, const std::set<QUuid> &limitNodeIds=std::set<QUuid>(),
|
||||
DocumentToSnapshotFor forWhat=DocumentToSnapshotFor::Document,
|
||||
const std::set<QUuid> &limitPoseIds=std::set<QUuid>(),
|
||||
const std::set<QUuid> &limitMotionIds=std::set<QUuid>(),
|
||||
const std::set<QUuid> &limitMaterialIds=std::set<QUuid>()) const;
|
||||
void fromSnapshot(const SkeletonSnapshot &snapshot);
|
||||
void addFromSnapshot(const SkeletonSnapshot &snapshot, bool fromPaste=true);
|
||||
const SkeletonNode *findNode(QUuid nodeId) const;
|
||||
const SkeletonEdge *findEdge(QUuid edgeId) const;
|
||||
const SkeletonPart *findPart(QUuid partId) const;
|
||||
const SkeletonEdge *findEdgeByNodes(QUuid firstNodeId, QUuid secondNodeId) const;
|
||||
const SkeletonComponent *findComponent(QUuid componentId) const;
|
||||
const SkeletonComponent *findComponentParent(QUuid componentId) const;
|
||||
void fromSnapshot(const Snapshot &snapshot);
|
||||
void addFromSnapshot(const Snapshot &snapshot, bool fromPaste=true);
|
||||
const Node *findNode(QUuid nodeId) const;
|
||||
const Edge *findEdge(QUuid edgeId) const;
|
||||
const Part *findPart(QUuid partId) const;
|
||||
const Edge *findEdgeByNodes(QUuid firstNodeId, QUuid secondNodeId) const;
|
||||
const Component *findComponent(QUuid componentId) const;
|
||||
const Component *findComponentParent(QUuid componentId) const;
|
||||
QUuid findComponentParentId(QUuid componentId) const;
|
||||
const SkeletonMaterial *findMaterial(QUuid materialId) const;
|
||||
const SkeletonPose *findPose(QUuid poseId) const;
|
||||
const SkeletonMotion *findMotion(QUuid motionId) const;
|
||||
const Material *findMaterial(QUuid materialId) const;
|
||||
const Pose *findPose(QUuid poseId) const;
|
||||
const Motion *findMotion(QUuid motionId) const;
|
||||
MeshLoader *takeResultMesh();
|
||||
MeshLoader *takeResultTextureMesh();
|
||||
MeshLoader *takeResultRigWeightMesh();
|
||||
|
@ -684,7 +684,7 @@ public:
|
|||
bool isNodeEditable(QUuid nodeId) const;
|
||||
bool isEdgeEditable(QUuid edgeId) const;
|
||||
bool originSettled() const;
|
||||
const MeshResultContext ¤tPostProcessedResultContext() const;
|
||||
const Outcome ¤tPostProcessedResultContext() const;
|
||||
bool isExportReady() const;
|
||||
bool isPostProcessResultObsolete() const;
|
||||
void findAllNeighbors(QUuid nodeId, std::set<QUuid> &neighbors) const;
|
||||
|
@ -692,7 +692,7 @@ public:
|
|||
void collectComponentDescendantComponents(QUuid componentId, std::vector<QUuid> &componentIds) const;
|
||||
const std::vector<QString> &resultRigMissingMarkNames() const;
|
||||
const std::vector<QString> &resultRigErrorMarkNames() const;
|
||||
const MeshResultContext ¤tRiggedResultContext() const;
|
||||
const Outcome ¤tRiggedResultContext() const;
|
||||
bool currentRigSucceed() const;
|
||||
bool isMeshGenerating() const;
|
||||
public slots:
|
||||
|
@ -704,11 +704,11 @@ public slots:
|
|||
void moveNodeBy(QUuid nodeId, float x, float y, float z);
|
||||
void setNodeOrigin(QUuid nodeId, float x, float y, float z);
|
||||
void setNodeRadius(QUuid nodeId, float radius);
|
||||
void setNodeBoneMark(QUuid nodeId, SkeletonBoneMark mark);
|
||||
void setNodeBoneMark(QUuid nodeId, BoneMark mark);
|
||||
void switchNodeXZ(QUuid nodeId);
|
||||
void moveOriginBy(float x, float y, float z);
|
||||
void addEdge(QUuid fromNodeId, QUuid toNodeId);
|
||||
void setEditMode(SkeletonDocumentEditMode mode);
|
||||
void setEditMode(DocumentEditMode mode);
|
||||
void uiReady();
|
||||
void generateMesh();
|
||||
void regenerateMesh();
|
||||
|
@ -787,13 +787,13 @@ public slots:
|
|||
void removePose(QUuid poseId);
|
||||
void setPoseParameters(QUuid poseId, std::map<QString, std::map<QString, QString>> parameters);
|
||||
void renamePose(QUuid poseId, QString name);
|
||||
void addMotion(QString name, std::vector<SkeletonMotionClip> clips);
|
||||
void addMotion(QString name, std::vector<MotionClip> clips);
|
||||
void removeMotion(QUuid motionId);
|
||||
void setMotionClips(QUuid motionId, std::vector<SkeletonMotionClip> clips);
|
||||
void setMotionClips(QUuid motionId, std::vector<MotionClip> clips);
|
||||
void renameMotion(QUuid motionId, QString name);
|
||||
void addMaterial(QString name, std::vector<SkeletonMaterialLayer>);
|
||||
void addMaterial(QString name, std::vector<MaterialLayer>);
|
||||
void removeMaterial(QUuid materialId);
|
||||
void setMaterialLayers(QUuid materialId, std::vector<SkeletonMaterialLayer> layers);
|
||||
void setMaterialLayers(QUuid materialId, std::vector<MaterialLayer> layers);
|
||||
void renameMaterial(QUuid materialId, QString name);
|
||||
private:
|
||||
void splitPartByNode(std::vector<std::vector<QUuid>> *groups, QUuid nodeId);
|
||||
|
@ -815,12 +815,12 @@ private: // need initialize
|
|||
MeshGenerator *m_meshGenerator;
|
||||
MeshLoader *m_resultMesh;
|
||||
int m_batchChangeRefCount;
|
||||
MeshResultContext *m_currentMeshResultContext;
|
||||
Outcome *m_currentMeshResultContext;
|
||||
bool m_isTextureObsolete;
|
||||
TextureGenerator *m_textureGenerator;
|
||||
bool m_isPostProcessResultObsolete;
|
||||
MeshResultPostProcessor *m_postProcessor;
|
||||
MeshResultContext *m_postProcessedResultContext;
|
||||
Outcome *m_postProcessedResultContext;
|
||||
MeshLoader *m_resultTextureMesh;
|
||||
unsigned long long m_textureImageUpdateVersion;
|
||||
AmbientOcclusionBaker *m_ambientOcclusionBaker;
|
||||
|
@ -834,15 +834,15 @@ private: // need initialize
|
|||
std::vector<AutoRiggerBone> *m_resultRigBones;
|
||||
std::map<int, AutoRiggerVertexWeights> *m_resultRigWeights;
|
||||
bool m_isRigObsolete;
|
||||
MeshResultContext *m_riggedResultContext;
|
||||
Outcome *m_riggedResultContext;
|
||||
PosePreviewsGenerator *m_posePreviewsGenerator;
|
||||
bool m_currentRigSucceed;
|
||||
MaterialPreviewsGenerator *m_materialPreviewsGenerator;
|
||||
MotionsGenerator *m_motionsGenerator;
|
||||
private:
|
||||
static unsigned long m_maxSnapshot;
|
||||
std::deque<SkeletonHistoryItem> m_undoItems;
|
||||
std::deque<SkeletonHistoryItem> m_redoItems;
|
||||
std::deque<HistoryItem> m_undoItems;
|
||||
std::deque<HistoryItem> m_redoItems;
|
||||
GeneratedCacheContext m_generatedCacheContext;
|
||||
std::vector<QString> m_resultRigMissingMarkNames;
|
||||
std::vector<QString> m_resultRigErrorMarkNames;
|
|
@ -15,19 +15,19 @@
|
|||
#include <set>
|
||||
#include <QDesktopServices>
|
||||
#include <QDockWidget>
|
||||
#include "skeletondocumentwindow.h"
|
||||
#include "documentwindow.h"
|
||||
#include "skeletongraphicswidget.h"
|
||||
#include "theme.h"
|
||||
#include "ds3file.h"
|
||||
#include "skeletonsnapshot.h"
|
||||
#include "skeletonxml.h"
|
||||
#include "snapshot.h"
|
||||
#include "snapshotxml.h"
|
||||
#include "logbrowser.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
#include "aboutwidget.h"
|
||||
#include "version.h"
|
||||
#include "gltffile.h"
|
||||
#include "graphicscontainerwidget.h"
|
||||
#include "skeletonparttreewidget.h"
|
||||
#include "parttreewidget.h"
|
||||
#include "rigwidget.h"
|
||||
#include "markiconcreator.h"
|
||||
#include "motionmanagewidget.h"
|
||||
|
@ -113,7 +113,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
|
||||
g_documentWindows.insert(this);
|
||||
|
||||
m_document = new SkeletonDocument;
|
||||
m_document = new Document;
|
||||
|
||||
QVBoxLayout *toolButtonLayout = new QVBoxLayout;
|
||||
toolButtonLayout->setSpacing(0);
|
||||
|
@ -158,19 +158,19 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
|
||||
SpinnableAwesomeButton *regenerateButton = new SpinnableAwesomeButton();
|
||||
regenerateButton->setAwesomeIcon(QChar(fa::recycle));
|
||||
connect(m_document, &SkeletonDocument::meshGenerating, this, [=]() {
|
||||
connect(m_document, &Document::meshGenerating, this, [=]() {
|
||||
regenerateButton->showSpinner(true);
|
||||
});
|
||||
connect(m_document, &SkeletonDocument::postProcessing, this, [=]() {
|
||||
connect(m_document, &Document::postProcessing, this, [=]() {
|
||||
regenerateButton->showSpinner(true);
|
||||
});
|
||||
connect(m_document, &SkeletonDocument::textureGenerating, this, [=]() {
|
||||
connect(m_document, &Document::textureGenerating, this, [=]() {
|
||||
regenerateButton->showSpinner(true);
|
||||
});
|
||||
connect(m_document, &SkeletonDocument::resultTextureChanged, this, [=]() {
|
||||
connect(m_document, &Document::resultTextureChanged, this, [=]() {
|
||||
regenerateButton->showSpinner(false);
|
||||
});
|
||||
connect(regenerateButton->button(), &QPushButton::clicked, m_document, &SkeletonDocument::regenerateMesh);
|
||||
connect(regenerateButton->button(), &QPushButton::clicked, m_document, &Document::regenerateMesh);
|
||||
|
||||
toolButtonLayout->addWidget(addButton);
|
||||
toolButtonLayout->addWidget(selectButton);
|
||||
|
@ -231,7 +231,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
|
||||
QDockWidget *partTreeDocker = new QDockWidget(tr("Parts"), this);
|
||||
partTreeDocker->setAllowedAreas(Qt::RightDockWidgetArea);
|
||||
SkeletonPartTreeWidget *partTreeWidget = new SkeletonPartTreeWidget(m_document, partTreeDocker);
|
||||
PartTreeWidget *partTreeWidget = new PartTreeWidget(m_document, partTreeDocker);
|
||||
partTreeDocker->setWidget(partTreeWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, partTreeDocker);
|
||||
connect(partTreeDocker, &QDockWidget::topLevelChanged, [=](bool topLevel) {
|
||||
|
@ -369,16 +369,16 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
|
||||
m_addAction = new QAction(tr("Add..."), this);
|
||||
connect(m_addAction, &QAction::triggered, [=]() {
|
||||
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
||||
m_document->setEditMode(DocumentEditMode::Add);
|
||||
});
|
||||
m_editMenu->addAction(m_addAction);
|
||||
|
||||
m_undoAction = new QAction(tr("Undo"), this);
|
||||
connect(m_undoAction, &QAction::triggered, m_document, &SkeletonDocument::undo);
|
||||
connect(m_undoAction, &QAction::triggered, m_document, &Document::undo);
|
||||
m_editMenu->addAction(m_undoAction);
|
||||
|
||||
m_redoAction = new QAction(tr("Redo"), this);
|
||||
connect(m_redoAction, &QAction::triggered, m_document, &SkeletonDocument::redo);
|
||||
connect(m_redoAction, &QAction::triggered, m_document, &Document::redo);
|
||||
m_editMenu->addAction(m_redoAction);
|
||||
|
||||
m_deleteAction = new QAction(tr("Delete"), this);
|
||||
|
@ -402,7 +402,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
m_editMenu->addAction(m_copyAction);
|
||||
|
||||
m_pasteAction = new QAction(tr("Paste"), this);
|
||||
connect(m_pasteAction, &QAction::triggered, m_document, &SkeletonDocument::paste);
|
||||
connect(m_pasteAction, &QAction::triggered, m_document, &Document::paste);
|
||||
m_editMenu->addAction(m_pasteAction);
|
||||
|
||||
m_flipHorizontallyAction = new QAction(tr("H Flip"), this);
|
||||
|
@ -463,15 +463,15 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
|
||||
m_markAsNoneAction = new QAction(tr("None"), this);
|
||||
connect(m_markAsNoneAction, &QAction::triggered, [=]() {
|
||||
m_graphicsWidget->setSelectedNodesBoneMark(SkeletonBoneMark::None);
|
||||
m_graphicsWidget->setSelectedNodesBoneMark(BoneMark::None);
|
||||
});
|
||||
m_markAsMenu->addAction(m_markAsNoneAction);
|
||||
|
||||
m_markAsMenu->addSeparator();
|
||||
|
||||
for (int i = 0; i < (int)SkeletonBoneMark::Count - 1; i++) {
|
||||
SkeletonBoneMark boneMark = (SkeletonBoneMark)(i + 1);
|
||||
m_markAsActions[i] = new QAction(MarkIconCreator::createIcon(boneMark), SkeletonBoneMarkToDispName(boneMark), this);
|
||||
for (int i = 0; i < (int)BoneMark::Count - 1; i++) {
|
||||
BoneMark boneMark = (BoneMark)(i + 1);
|
||||
m_markAsActions[i] = new QAction(MarkIconCreator::createIcon(boneMark), BoneMarkToDispName(boneMark), this);
|
||||
connect(m_markAsActions[i], &QAction::triggered, [=]() {
|
||||
m_graphicsWidget->setSelectedNodesBoneMark(boneMark);
|
||||
});
|
||||
|
@ -648,30 +648,30 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
connect(containerWidget, &GraphicsContainerWidget::containerSizeChanged,
|
||||
graphicsWidget, &SkeletonGraphicsWidget::canvasResized);
|
||||
|
||||
connect(m_document, &SkeletonDocument::turnaroundChanged,
|
||||
connect(m_document, &Document::turnaroundChanged,
|
||||
graphicsWidget, &SkeletonGraphicsWidget::turnaroundChanged);
|
||||
|
||||
connect(rotateCounterclockwiseButton, &QPushButton::clicked, graphicsWidget, &SkeletonGraphicsWidget::rotateAllMainProfileCounterclockwise90DegreeAlongOrigin);
|
||||
connect(rotateClockwiseButton, &QPushButton::clicked, graphicsWidget, &SkeletonGraphicsWidget::rotateAllMainProfileClockwise90DegreeAlongOrigin);
|
||||
|
||||
connect(addButton, &QPushButton::clicked, [=]() {
|
||||
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
||||
m_document->setEditMode(DocumentEditMode::Add);
|
||||
});
|
||||
|
||||
connect(selectButton, &QPushButton::clicked, [=]() {
|
||||
m_document->setEditMode(SkeletonDocumentEditMode::Select);
|
||||
m_document->setEditMode(DocumentEditMode::Select);
|
||||
});
|
||||
|
||||
connect(dragButton, &QPushButton::clicked, [=]() {
|
||||
m_document->setEditMode(SkeletonDocumentEditMode::Drag);
|
||||
m_document->setEditMode(DocumentEditMode::Drag);
|
||||
});
|
||||
|
||||
connect(zoomInButton, &QPushButton::clicked, [=]() {
|
||||
m_document->setEditMode(SkeletonDocumentEditMode::ZoomIn);
|
||||
m_document->setEditMode(DocumentEditMode::ZoomIn);
|
||||
});
|
||||
|
||||
connect(zoomOutButton, &QPushButton::clicked, [=]() {
|
||||
m_document->setEditMode(SkeletonDocumentEditMode::ZoomOut);
|
||||
m_document->setEditMode(DocumentEditMode::ZoomOut);
|
||||
});
|
||||
|
||||
connect(m_xlockButton, &QPushButton::clicked, [=]() {
|
||||
|
@ -687,7 +687,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
m_document->setRadiusLockState(!m_document->radiusLocked);
|
||||
});
|
||||
|
||||
m_partListDockerVisibleSwitchConnection = connect(m_document, &SkeletonDocument::skeletonChanged, [=]() {
|
||||
m_partListDockerVisibleSwitchConnection = connect(m_document, &Document::skeletonChanged, [=]() {
|
||||
if (m_graphicsWidget->hasItems()) {
|
||||
if (partTreeDocker->isHidden())
|
||||
partTreeDocker->show();
|
||||
|
@ -695,123 +695,123 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
}
|
||||
});
|
||||
|
||||
connect(m_document, &SkeletonDocument::editModeChanged, graphicsWidget, &SkeletonGraphicsWidget::editModeChanged);
|
||||
connect(m_document, &Document::editModeChanged, graphicsWidget, &SkeletonGraphicsWidget::editModeChanged);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::zoomRenderedModelBy, m_modelRenderWidget, &ModelWidget::zoom);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::addNode, m_document, &SkeletonDocument::addNode);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::scaleNodeByAddRadius, m_document, &SkeletonDocument::scaleNodeByAddRadius);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::moveNodeBy, m_document, &SkeletonDocument::moveNodeBy);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setNodeOrigin, m_document, &SkeletonDocument::setNodeOrigin);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setNodeBoneMark, m_document, &SkeletonDocument::setNodeBoneMark);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::removeNode, m_document, &SkeletonDocument::removeNode);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setEditMode, m_document, &SkeletonDocument::setEditMode);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::removeEdge, m_document, &SkeletonDocument::removeEdge);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::addEdge, m_document, &SkeletonDocument::addEdge);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::groupOperationAdded, m_document, &SkeletonDocument::saveSnapshot);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::undo, m_document, &SkeletonDocument::undo);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::redo, m_document, &SkeletonDocument::redo);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::paste, m_document, &SkeletonDocument::paste);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::batchChangeBegin, m_document, &SkeletonDocument::batchChangeBegin);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::batchChangeEnd, m_document, &SkeletonDocument::batchChangeEnd);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::breakEdge, m_document, &SkeletonDocument::breakEdge);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::moveOriginBy, m_document, &SkeletonDocument::moveOriginBy);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::partChecked, m_document, &SkeletonDocument::partChecked);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::partUnchecked, m_document, &SkeletonDocument::partUnchecked);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::switchNodeXZ, m_document, &SkeletonDocument::switchNodeXZ);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::addNode, m_document, &Document::addNode);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::scaleNodeByAddRadius, m_document, &Document::scaleNodeByAddRadius);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::moveNodeBy, m_document, &Document::moveNodeBy);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setNodeOrigin, m_document, &Document::setNodeOrigin);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setNodeBoneMark, m_document, &Document::setNodeBoneMark);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::removeNode, m_document, &Document::removeNode);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setEditMode, m_document, &Document::setEditMode);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::removeEdge, m_document, &Document::removeEdge);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::addEdge, m_document, &Document::addEdge);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::groupOperationAdded, m_document, &Document::saveSnapshot);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::undo, m_document, &Document::undo);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::redo, m_document, &Document::redo);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::paste, m_document, &Document::paste);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::batchChangeBegin, m_document, &Document::batchChangeBegin);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::batchChangeEnd, m_document, &Document::batchChangeEnd);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::breakEdge, m_document, &Document::breakEdge);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::moveOriginBy, m_document, &Document::moveOriginBy);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::partChecked, m_document, &Document::partChecked);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::partUnchecked, m_document, &Document::partUnchecked);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::switchNodeXZ, m_document, &Document::switchNodeXZ);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartLockState, m_document, &SkeletonDocument::setPartLockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartVisibleState, m_document, &SkeletonDocument::setPartVisibleState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartSubdivState, m_document, &SkeletonDocument::setPartSubdivState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartDisableState, m_document, &SkeletonDocument::setPartDisableState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartXmirrorState, m_document, &SkeletonDocument::setPartXmirrorState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartRoundState, m_document, &SkeletonDocument::setPartRoundState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartWrapState, m_document, &SkeletonDocument::setPartWrapState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartLockState, m_document, &Document::setPartLockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartVisibleState, m_document, &Document::setPartVisibleState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartSubdivState, m_document, &Document::setPartSubdivState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartDisableState, m_document, &Document::setPartDisableState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartXmirrorState, m_document, &Document::setPartXmirrorState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartRoundState, m_document, &Document::setPartRoundState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartWrapState, m_document, &Document::setPartWrapState);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setXlockState, m_document, &SkeletonDocument::setXlockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setYlockState, m_document, &SkeletonDocument::setYlockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setZlockState, m_document, &SkeletonDocument::setZlockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setXlockState, m_document, &Document::setXlockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setYlockState, m_document, &Document::setYlockState);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setZlockState, m_document, &Document::setZlockState);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::enableAllPositionRelatedLocks, m_document, &SkeletonDocument::enableAllPositionRelatedLocks);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::disableAllPositionRelatedLocks, m_document, &SkeletonDocument::disableAllPositionRelatedLocks);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::enableAllPositionRelatedLocks, m_document, &Document::enableAllPositionRelatedLocks);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::disableAllPositionRelatedLocks, m_document, &Document::disableAllPositionRelatedLocks);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::changeTurnaround, this, &SkeletonDocumentWindow::changeTurnaround);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::save, this, &SkeletonDocumentWindow::save);
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::open, this, &SkeletonDocumentWindow::open);
|
||||
|
||||
connect(m_document, &SkeletonDocument::nodeAdded, graphicsWidget, &SkeletonGraphicsWidget::nodeAdded);
|
||||
connect(m_document, &SkeletonDocument::nodeRemoved, graphicsWidget, &SkeletonGraphicsWidget::nodeRemoved);
|
||||
connect(m_document, &SkeletonDocument::edgeAdded, graphicsWidget, &SkeletonGraphicsWidget::edgeAdded);
|
||||
connect(m_document, &SkeletonDocument::edgeRemoved, graphicsWidget, &SkeletonGraphicsWidget::edgeRemoved);
|
||||
connect(m_document, &SkeletonDocument::nodeRadiusChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeRadiusChanged);
|
||||
connect(m_document, &SkeletonDocument::nodeBoneMarkChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeBoneMarkChanged);
|
||||
connect(m_document, &SkeletonDocument::nodeOriginChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeOriginChanged);
|
||||
connect(m_document, &SkeletonDocument::partVisibleStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partDisableStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged);
|
||||
connect(m_document, &SkeletonDocument::cleanup, graphicsWidget, &SkeletonGraphicsWidget::removeAllContent);
|
||||
connect(m_document, &SkeletonDocument::originChanged, graphicsWidget, &SkeletonGraphicsWidget::originChanged);
|
||||
connect(m_document, &SkeletonDocument::checkPart, graphicsWidget, &SkeletonGraphicsWidget::selectPartAllById);
|
||||
connect(m_document, &SkeletonDocument::enableBackgroundBlur, graphicsWidget, &SkeletonGraphicsWidget::enableBackgroundBlur);
|
||||
connect(m_document, &SkeletonDocument::disableBackgroundBlur, graphicsWidget, &SkeletonGraphicsWidget::disableBackgroundBlur);
|
||||
connect(m_document, &SkeletonDocument::uncheckAll, graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
|
||||
connect(m_document, &SkeletonDocument::checkNode, graphicsWidget, &SkeletonGraphicsWidget::addSelectNode);
|
||||
connect(m_document, &SkeletonDocument::checkEdge, graphicsWidget, &SkeletonGraphicsWidget::addSelectEdge);
|
||||
connect(m_document, &Document::nodeAdded, graphicsWidget, &SkeletonGraphicsWidget::nodeAdded);
|
||||
connect(m_document, &Document::nodeRemoved, graphicsWidget, &SkeletonGraphicsWidget::nodeRemoved);
|
||||
connect(m_document, &Document::edgeAdded, graphicsWidget, &SkeletonGraphicsWidget::edgeAdded);
|
||||
connect(m_document, &Document::edgeRemoved, graphicsWidget, &SkeletonGraphicsWidget::edgeRemoved);
|
||||
connect(m_document, &Document::nodeRadiusChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeRadiusChanged);
|
||||
connect(m_document, &Document::nodeBoneMarkChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeBoneMarkChanged);
|
||||
connect(m_document, &Document::nodeOriginChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeOriginChanged);
|
||||
connect(m_document, &Document::partVisibleStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged);
|
||||
connect(m_document, &Document::partDisableStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged);
|
||||
connect(m_document, &Document::cleanup, graphicsWidget, &SkeletonGraphicsWidget::removeAllContent);
|
||||
connect(m_document, &Document::originChanged, graphicsWidget, &SkeletonGraphicsWidget::originChanged);
|
||||
connect(m_document, &Document::checkPart, graphicsWidget, &SkeletonGraphicsWidget::selectPartAllById);
|
||||
connect(m_document, &Document::enableBackgroundBlur, graphicsWidget, &SkeletonGraphicsWidget::enableBackgroundBlur);
|
||||
connect(m_document, &Document::disableBackgroundBlur, graphicsWidget, &SkeletonGraphicsWidget::disableBackgroundBlur);
|
||||
connect(m_document, &Document::uncheckAll, graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
|
||||
connect(m_document, &Document::checkNode, graphicsWidget, &SkeletonGraphicsWidget::addSelectNode);
|
||||
connect(m_document, &Document::checkEdge, graphicsWidget, &SkeletonGraphicsWidget::addSelectEdge);
|
||||
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::currentComponentChanged, m_document, &SkeletonDocument::setCurrentCanvasComponentId);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::moveComponentUp, m_document, &SkeletonDocument::moveComponentUp);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::moveComponentDown, m_document, &SkeletonDocument::moveComponentDown);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::moveComponentToTop, m_document, &SkeletonDocument::moveComponentToTop);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::moveComponentToBottom, m_document, &SkeletonDocument::moveComponentToBottom);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::checkPart, m_document, &SkeletonDocument::checkPart);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::createNewComponentAndMoveThisIn, m_document, &SkeletonDocument::createNewComponentAndMoveThisIn);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::createNewChildComponent, m_document, &SkeletonDocument::createNewChildComponent);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::renameComponent, m_document, &SkeletonDocument::renameComponent);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::setComponentExpandState, m_document, &SkeletonDocument::setComponentExpandState);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::setComponentSmoothAll, m_document, &SkeletonDocument::setComponentSmoothAll);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::setComponentSmoothSeam, m_document, &SkeletonDocument::setComponentSmoothSeam);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::moveComponent, m_document, &SkeletonDocument::moveComponent);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::removeComponent, m_document, &SkeletonDocument::removeComponent);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::hideOtherComponents, m_document, &SkeletonDocument::hideOtherComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::lockOtherComponents, m_document, &SkeletonDocument::lockOtherComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::hideAllComponents, m_document, &SkeletonDocument::hideAllComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::showAllComponents, m_document, &SkeletonDocument::showAllComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::collapseAllComponents, m_document, &SkeletonDocument::collapseAllComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::expandAllComponents, m_document, &SkeletonDocument::expandAllComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::lockAllComponents, m_document, &SkeletonDocument::lockAllComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::unlockAllComponents, m_document, &SkeletonDocument::unlockAllComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::setPartLockState, m_document, &SkeletonDocument::setPartLockState);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::setPartVisibleState, m_document, &SkeletonDocument::setPartVisibleState);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::setComponentInverseState, m_document, &SkeletonDocument::setComponentInverseState);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::hideDescendantComponents, m_document, &SkeletonDocument::hideDescendantComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::showDescendantComponents, m_document, &SkeletonDocument::showDescendantComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::lockDescendantComponents, m_document, &SkeletonDocument::lockDescendantComponents);
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::unlockDescendantComponents, m_document, &SkeletonDocument::unlockDescendantComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::currentComponentChanged, m_document, &Document::setCurrentCanvasComponentId);
|
||||
connect(partTreeWidget, &PartTreeWidget::moveComponentUp, m_document, &Document::moveComponentUp);
|
||||
connect(partTreeWidget, &PartTreeWidget::moveComponentDown, m_document, &Document::moveComponentDown);
|
||||
connect(partTreeWidget, &PartTreeWidget::moveComponentToTop, m_document, &Document::moveComponentToTop);
|
||||
connect(partTreeWidget, &PartTreeWidget::moveComponentToBottom, m_document, &Document::moveComponentToBottom);
|
||||
connect(partTreeWidget, &PartTreeWidget::checkPart, m_document, &Document::checkPart);
|
||||
connect(partTreeWidget, &PartTreeWidget::createNewComponentAndMoveThisIn, m_document, &Document::createNewComponentAndMoveThisIn);
|
||||
connect(partTreeWidget, &PartTreeWidget::createNewChildComponent, m_document, &Document::createNewChildComponent);
|
||||
connect(partTreeWidget, &PartTreeWidget::renameComponent, m_document, &Document::renameComponent);
|
||||
connect(partTreeWidget, &PartTreeWidget::setComponentExpandState, m_document, &Document::setComponentExpandState);
|
||||
connect(partTreeWidget, &PartTreeWidget::setComponentSmoothAll, m_document, &Document::setComponentSmoothAll);
|
||||
connect(partTreeWidget, &PartTreeWidget::setComponentSmoothSeam, m_document, &Document::setComponentSmoothSeam);
|
||||
connect(partTreeWidget, &PartTreeWidget::moveComponent, m_document, &Document::moveComponent);
|
||||
connect(partTreeWidget, &PartTreeWidget::removeComponent, m_document, &Document::removeComponent);
|
||||
connect(partTreeWidget, &PartTreeWidget::hideOtherComponents, m_document, &Document::hideOtherComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::lockOtherComponents, m_document, &Document::lockOtherComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::hideAllComponents, m_document, &Document::hideAllComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::showAllComponents, m_document, &Document::showAllComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::collapseAllComponents, m_document, &Document::collapseAllComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::expandAllComponents, m_document, &Document::expandAllComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::lockAllComponents, m_document, &Document::lockAllComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::unlockAllComponents, m_document, &Document::unlockAllComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::setPartLockState, m_document, &Document::setPartLockState);
|
||||
connect(partTreeWidget, &PartTreeWidget::setPartVisibleState, m_document, &Document::setPartVisibleState);
|
||||
connect(partTreeWidget, &PartTreeWidget::setComponentInverseState, m_document, &Document::setComponentInverseState);
|
||||
connect(partTreeWidget, &PartTreeWidget::hideDescendantComponents, m_document, &Document::hideDescendantComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::showDescendantComponents, m_document, &Document::showDescendantComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::lockDescendantComponents, m_document, &Document::lockDescendantComponents);
|
||||
connect(partTreeWidget, &PartTreeWidget::unlockDescendantComponents, m_document, &Document::unlockDescendantComponents);
|
||||
|
||||
connect(partTreeWidget, &SkeletonPartTreeWidget::addPartToSelection, graphicsWidget, &SkeletonGraphicsWidget::addPartToSelection);
|
||||
connect(partTreeWidget, &PartTreeWidget::addPartToSelection, graphicsWidget, &SkeletonGraphicsWidget::addPartToSelection);
|
||||
|
||||
connect(m_document, &SkeletonDocument::componentNameChanged, partTreeWidget, &SkeletonPartTreeWidget::componentNameChanged);
|
||||
connect(m_document, &SkeletonDocument::componentChildrenChanged, partTreeWidget, &SkeletonPartTreeWidget::componentChildrenChanged);
|
||||
connect(m_document, &SkeletonDocument::componentRemoved, partTreeWidget, &SkeletonPartTreeWidget::componentRemoved);
|
||||
connect(m_document, &SkeletonDocument::componentAdded, partTreeWidget, &SkeletonPartTreeWidget::componentAdded);
|
||||
connect(m_document, &SkeletonDocument::componentExpandStateChanged, partTreeWidget, &SkeletonPartTreeWidget::componentExpandStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partPreviewChanged, partTreeWidget, &SkeletonPartTreeWidget::partPreviewChanged);
|
||||
connect(m_document, &SkeletonDocument::partLockStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partLockStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partVisibleStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partVisibleStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partSubdivStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partSubdivStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partDisableStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partDisableStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partXmirrorStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partXmirrorStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partDeformThicknessChanged, partTreeWidget, &SkeletonPartTreeWidget::partDeformChanged);
|
||||
connect(m_document, &SkeletonDocument::partDeformWidthChanged, partTreeWidget, &SkeletonPartTreeWidget::partDeformChanged);
|
||||
connect(m_document, &SkeletonDocument::partRoundStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partRoundStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partWrapStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partWrapStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partColorStateChanged, partTreeWidget, &SkeletonPartTreeWidget::partColorStateChanged);
|
||||
connect(m_document, &SkeletonDocument::partMaterialIdChanged, partTreeWidget, &SkeletonPartTreeWidget::partMaterialIdChanged);
|
||||
connect(m_document, &SkeletonDocument::partRemoved, partTreeWidget, &SkeletonPartTreeWidget::partRemoved);
|
||||
connect(m_document, &SkeletonDocument::cleanup, partTreeWidget, &SkeletonPartTreeWidget::removeAllContent);
|
||||
connect(m_document, &SkeletonDocument::partChecked, partTreeWidget, &SkeletonPartTreeWidget::partChecked);
|
||||
connect(m_document, &SkeletonDocument::partUnchecked, partTreeWidget, &SkeletonPartTreeWidget::partUnchecked);
|
||||
connect(m_document, &Document::componentNameChanged, partTreeWidget, &PartTreeWidget::componentNameChanged);
|
||||
connect(m_document, &Document::componentChildrenChanged, partTreeWidget, &PartTreeWidget::componentChildrenChanged);
|
||||
connect(m_document, &Document::componentRemoved, partTreeWidget, &PartTreeWidget::componentRemoved);
|
||||
connect(m_document, &Document::componentAdded, partTreeWidget, &PartTreeWidget::componentAdded);
|
||||
connect(m_document, &Document::componentExpandStateChanged, partTreeWidget, &PartTreeWidget::componentExpandStateChanged);
|
||||
connect(m_document, &Document::partPreviewChanged, partTreeWidget, &PartTreeWidget::partPreviewChanged);
|
||||
connect(m_document, &Document::partLockStateChanged, partTreeWidget, &PartTreeWidget::partLockStateChanged);
|
||||
connect(m_document, &Document::partVisibleStateChanged, partTreeWidget, &PartTreeWidget::partVisibleStateChanged);
|
||||
connect(m_document, &Document::partSubdivStateChanged, partTreeWidget, &PartTreeWidget::partSubdivStateChanged);
|
||||
connect(m_document, &Document::partDisableStateChanged, partTreeWidget, &PartTreeWidget::partDisableStateChanged);
|
||||
connect(m_document, &Document::partXmirrorStateChanged, partTreeWidget, &PartTreeWidget::partXmirrorStateChanged);
|
||||
connect(m_document, &Document::partDeformThicknessChanged, partTreeWidget, &PartTreeWidget::partDeformChanged);
|
||||
connect(m_document, &Document::partDeformWidthChanged, partTreeWidget, &PartTreeWidget::partDeformChanged);
|
||||
connect(m_document, &Document::partRoundStateChanged, partTreeWidget, &PartTreeWidget::partRoundStateChanged);
|
||||
connect(m_document, &Document::partWrapStateChanged, partTreeWidget, &PartTreeWidget::partWrapStateChanged);
|
||||
connect(m_document, &Document::partColorStateChanged, partTreeWidget, &PartTreeWidget::partColorStateChanged);
|
||||
connect(m_document, &Document::partMaterialIdChanged, partTreeWidget, &PartTreeWidget::partMaterialIdChanged);
|
||||
connect(m_document, &Document::partRemoved, partTreeWidget, &PartTreeWidget::partRemoved);
|
||||
connect(m_document, &Document::cleanup, partTreeWidget, &PartTreeWidget::removeAllContent);
|
||||
connect(m_document, &Document::partChecked, partTreeWidget, &PartTreeWidget::partChecked);
|
||||
connect(m_document, &Document::partUnchecked, partTreeWidget, &PartTreeWidget::partUnchecked);
|
||||
|
||||
connect(m_document, &SkeletonDocument::skeletonChanged, m_document, &SkeletonDocument::generateMesh);
|
||||
connect(m_document, &Document::skeletonChanged, m_document, &Document::generateMesh);
|
||||
//connect(m_document, &SkeletonDocument::resultMeshChanged, [=]() {
|
||||
// if ((m_exportPreviewWidget && m_exportPreviewWidget->isVisible())) {
|
||||
// m_document->postProcess();
|
||||
|
@ -822,76 +822,76 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
// m_document->generateTexture();
|
||||
// }
|
||||
//});
|
||||
connect(m_document, &SkeletonDocument::textureChanged, m_document, &SkeletonDocument::generateTexture);
|
||||
connect(m_document, &SkeletonDocument::resultMeshChanged, m_document, &SkeletonDocument::postProcess);
|
||||
connect(m_document, &SkeletonDocument::resultMeshChanged, m_document, &SkeletonDocument::generateRig);
|
||||
connect(m_document, &SkeletonDocument::rigChanged, m_document, &SkeletonDocument::generateRig);
|
||||
connect(m_document, &SkeletonDocument::postProcessedResultChanged, m_document, &SkeletonDocument::generateTexture);
|
||||
connect(m_document, &Document::textureChanged, m_document, &Document::generateTexture);
|
||||
connect(m_document, &Document::resultMeshChanged, m_document, &Document::postProcess);
|
||||
connect(m_document, &Document::resultMeshChanged, m_document, &Document::generateRig);
|
||||
connect(m_document, &Document::rigChanged, m_document, &Document::generateRig);
|
||||
connect(m_document, &Document::postProcessedResultChanged, m_document, &Document::generateTexture);
|
||||
//connect(m_document, &SkeletonDocument::resultTextureChanged, m_document, &SkeletonDocument::bakeAmbientOcclusionTexture);
|
||||
connect(m_document, &SkeletonDocument::resultTextureChanged, [=]() {
|
||||
connect(m_document, &Document::resultTextureChanged, [=]() {
|
||||
if (m_document->isMeshGenerating())
|
||||
return;
|
||||
m_modelRenderWidget->updateMesh(m_document->takeResultTextureMesh());
|
||||
});
|
||||
|
||||
connect(m_document, &SkeletonDocument::resultMeshChanged, [=]() {
|
||||
connect(m_document, &Document::resultMeshChanged, [=]() {
|
||||
m_modelRenderWidget->updateMesh(m_document->takeResultMesh());
|
||||
});
|
||||
|
||||
connect(m_document, &SkeletonDocument::posesChanged, m_document, &SkeletonDocument::generateMotions);
|
||||
connect(m_document, &SkeletonDocument::motionsChanged, m_document, &SkeletonDocument::generateMotions);
|
||||
connect(m_document, &Document::posesChanged, m_document, &Document::generateMotions);
|
||||
connect(m_document, &Document::motionsChanged, m_document, &Document::generateMotions);
|
||||
|
||||
connect(graphicsWidget, &SkeletonGraphicsWidget::cursorChanged, [=]() {
|
||||
m_modelRenderWidget->setCursor(graphicsWidget->cursor());
|
||||
//m_skeletonRenderWidget->setCursor(graphicsWidget->cursor());
|
||||
});
|
||||
|
||||
connect(m_document, &SkeletonDocument::skeletonChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &SkeletonDocument::turnaroundChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &SkeletonDocument::optionsChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &SkeletonDocument::rigChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &Document::skeletonChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &Document::turnaroundChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &Document::optionsChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
connect(m_document, &Document::rigChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||
|
||||
connect(m_modelRenderWidget, &ModelWidget::customContextMenuRequested, [=](const QPoint &pos) {
|
||||
graphicsWidget->showContextMenu(graphicsWidget->mapFromGlobal(m_modelRenderWidget->mapToGlobal(pos)));
|
||||
});
|
||||
|
||||
connect(m_document, &SkeletonDocument::xlockStateChanged, this, &SkeletonDocumentWindow::updateXlockButtonState);
|
||||
connect(m_document, &SkeletonDocument::ylockStateChanged, this, &SkeletonDocumentWindow::updateYlockButtonState);
|
||||
connect(m_document, &SkeletonDocument::zlockStateChanged, this, &SkeletonDocumentWindow::updateZlockButtonState);
|
||||
connect(m_document, &SkeletonDocument::radiusLockStateChanged, this, &SkeletonDocumentWindow::updateRadiusLockButtonState);
|
||||
connect(m_document, &Document::xlockStateChanged, this, &SkeletonDocumentWindow::updateXlockButtonState);
|
||||
connect(m_document, &Document::ylockStateChanged, this, &SkeletonDocumentWindow::updateYlockButtonState);
|
||||
connect(m_document, &Document::zlockStateChanged, this, &SkeletonDocumentWindow::updateZlockButtonState);
|
||||
connect(m_document, &Document::radiusLockStateChanged, this, &SkeletonDocumentWindow::updateRadiusLockButtonState);
|
||||
|
||||
connect(m_rigWidget, &RigWidget::setRigType, m_document, &SkeletonDocument::setRigType);
|
||||
connect(m_rigWidget, &RigWidget::setRigType, m_document, &Document::setRigType);
|
||||
|
||||
connect(m_document, &SkeletonDocument::rigTypeChanged, m_rigWidget, &RigWidget::rigTypeChanged);
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, m_rigWidget, &RigWidget::updateResultInfo);
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, this, &SkeletonDocumentWindow::updateRigWeightRenderWidget);
|
||||
connect(m_document, &Document::rigTypeChanged, m_rigWidget, &RigWidget::rigTypeChanged);
|
||||
connect(m_document, &Document::resultRigChanged, m_rigWidget, &RigWidget::updateResultInfo);
|
||||
connect(m_document, &Document::resultRigChanged, this, &SkeletonDocumentWindow::updateRigWeightRenderWidget);
|
||||
|
||||
//connect(m_document, &SkeletonDocument::resultRigChanged, tetrapodPoseEditWidget, &TetrapodPoseEditWidget::updatePreview);
|
||||
|
||||
connect(m_document, &SkeletonDocument::poseAdded, this, [=](QUuid poseId) {
|
||||
connect(m_document, &Document::poseAdded, this, [=](QUuid poseId) {
|
||||
Q_UNUSED(poseId);
|
||||
m_document->generatePosePreviews();
|
||||
});
|
||||
connect(m_document, &SkeletonDocument::poseParametersChanged, this, [=](QUuid poseId) {
|
||||
connect(m_document, &Document::poseParametersChanged, this, [=](QUuid poseId) {
|
||||
Q_UNUSED(poseId);
|
||||
m_document->generatePosePreviews();
|
||||
});
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, m_document, &SkeletonDocument::generatePosePreviews);
|
||||
connect(m_document, &Document::resultRigChanged, m_document, &Document::generatePosePreviews);
|
||||
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, m_document, &SkeletonDocument::generateMotions);
|
||||
connect(m_document, &Document::resultRigChanged, m_document, &Document::generateMotions);
|
||||
|
||||
connect(m_document, &SkeletonDocument::materialAdded, this, [=](QUuid materialId) {
|
||||
connect(m_document, &Document::materialAdded, this, [=](QUuid materialId) {
|
||||
Q_UNUSED(materialId);
|
||||
m_document->generateMaterialPreviews();
|
||||
});
|
||||
connect(m_document, &SkeletonDocument::materialLayersChanged, this, [=](QUuid materialId) {
|
||||
connect(m_document, &Document::materialLayersChanged, this, [=](QUuid materialId) {
|
||||
Q_UNUSED(materialId);
|
||||
m_document->generateMaterialPreviews();
|
||||
});
|
||||
|
||||
initShortCuts(this, m_graphicsWidget);
|
||||
|
||||
connect(this, &SkeletonDocumentWindow::initialized, m_document, &SkeletonDocument::uiReady);
|
||||
connect(this, &SkeletonDocumentWindow::initialized, m_document, &Document::uiReady);
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setInterval(250);
|
||||
|
@ -1092,7 +1092,7 @@ void SkeletonDocumentWindow::saveTo(const QString &saveAsFilename)
|
|||
|
||||
QByteArray modelXml;
|
||||
QXmlStreamWriter stream(&modelXml);
|
||||
SkeletonSnapshot snapshot;
|
||||
Snapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot);
|
||||
saveSkeletonToXmlStream(&snapshot, &stream);
|
||||
if (modelXml.size() > 0)
|
||||
|
@ -1176,7 +1176,7 @@ void SkeletonDocumentWindow::open()
|
|||
QByteArray data;
|
||||
ds3Reader.loadItem(item.name, &data);
|
||||
QXmlStreamReader stream(data);
|
||||
SkeletonSnapshot snapshot;
|
||||
Snapshot snapshot;
|
||||
loadSkeletonFromXmlStream(&snapshot, stream);
|
||||
m_document->fromSnapshot(snapshot);
|
||||
m_document->saveSnapshot();
|
||||
|
@ -1223,13 +1223,13 @@ void SkeletonDocumentWindow::showExportPreview()
|
|||
{
|
||||
if (nullptr == m_exportPreviewWidget) {
|
||||
m_exportPreviewWidget = new ExportPreviewWidget(m_document, this);
|
||||
connect(m_exportPreviewWidget, &ExportPreviewWidget::regenerate, m_document, &SkeletonDocument::regenerateMesh);
|
||||
connect(m_exportPreviewWidget, &ExportPreviewWidget::regenerate, m_document, &Document::regenerateMesh);
|
||||
connect(m_exportPreviewWidget, &ExportPreviewWidget::saveAsGltf, this, &SkeletonDocumentWindow::exportGltfResult);
|
||||
connect(m_exportPreviewWidget, &ExportPreviewWidget::saveAsFbx, this, &SkeletonDocumentWindow::exportFbxResult);
|
||||
connect(m_document, &SkeletonDocument::resultMeshChanged, m_exportPreviewWidget, &ExportPreviewWidget::checkSpinner);
|
||||
connect(m_document, &SkeletonDocument::exportReady, m_exportPreviewWidget, &ExportPreviewWidget::checkSpinner);
|
||||
connect(m_document, &SkeletonDocument::resultTextureChanged, m_exportPreviewWidget, &ExportPreviewWidget::updateTexturePreview);
|
||||
connect(m_document, &SkeletonDocument::resultBakedTextureChanged, m_exportPreviewWidget, &ExportPreviewWidget::updateTexturePreview);
|
||||
connect(m_document, &Document::resultMeshChanged, m_exportPreviewWidget, &ExportPreviewWidget::checkSpinner);
|
||||
connect(m_document, &Document::exportReady, m_exportPreviewWidget, &ExportPreviewWidget::checkSpinner);
|
||||
connect(m_document, &Document::resultTextureChanged, m_exportPreviewWidget, &ExportPreviewWidget::updateTexturePreview);
|
||||
connect(m_document, &Document::resultBakedTextureChanged, m_exportPreviewWidget, &ExportPreviewWidget::updateTexturePreview);
|
||||
registerDialog(m_exportPreviewWidget);
|
||||
}
|
||||
m_exportPreviewWidget->show();
|
||||
|
@ -1248,7 +1248,7 @@ void SkeletonDocumentWindow::exportFbxResult()
|
|||
return;
|
||||
}
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
MeshResultContext skeletonResult = m_document->currentPostProcessedResultContext();
|
||||
Outcome skeletonResult = m_document->currentPostProcessedResultContext();
|
||||
FbxFileWriter fbxFileWriter(skeletonResult, m_document->resultRigBones(), m_document->resultRigWeights(), filename);
|
||||
fbxFileWriter.save();
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
@ -1266,7 +1266,7 @@ void SkeletonDocumentWindow::exportGltfResult()
|
|||
return;
|
||||
}
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
MeshResultContext skeletonResult = m_document->currentPostProcessedResultContext();
|
||||
Outcome skeletonResult = m_document->currentPostProcessedResultContext();
|
||||
GltfFileWriter gltfFileWriter(skeletonResult, m_document->resultRigBones(), m_document->resultRigWeights(), filename);
|
||||
gltfFileWriter.save();
|
||||
if (m_document->textureImage)
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SKELETON_DOCUMENT_WINDOW_H
|
||||
#define SKELETON_DOCUMENT_WINDOW_H
|
||||
#ifndef DUST3D_DOCUMENT_WINDOW_H
|
||||
#define DUST3D_DOCUMENT_WINDOW_H
|
||||
#include <QMainWindow>
|
||||
#include <QShowEvent>
|
||||
#include <QPushButton>
|
||||
|
@ -7,11 +7,11 @@
|
|||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QTextBrowser>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "modelwidget.h"
|
||||
#include "exportpreviewwidget.h"
|
||||
#include "rigwidget.h"
|
||||
#include "skeletonbonemark.h"
|
||||
#include "bonemark.h"
|
||||
#include "posemanagewidget.h"
|
||||
#include "advancesettingwidget.h"
|
||||
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
void setCurrentFilename(const QString &filename);
|
||||
void updateTitle();
|
||||
private:
|
||||
SkeletonDocument *m_document;
|
||||
Document *m_document;
|
||||
bool m_firstShow;
|
||||
bool m_documentSaved;
|
||||
ExportPreviewWidget *m_exportPreviewWidget;
|
||||
|
@ -124,7 +124,7 @@ private:
|
|||
|
||||
QMenu *m_markAsMenu;
|
||||
QAction *m_markAsNoneAction;
|
||||
QAction *m_markAsActions[(int)SkeletonBoneMark::Count - 1];
|
||||
QAction *m_markAsActions[(int)BoneMark::Count - 1];
|
||||
|
||||
QMenu *m_viewMenu;
|
||||
QAction *m_resetModelWidgetPosAction;
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DS3_FILE_H
|
||||
#define DS3_FILE_H
|
||||
#ifndef DUST3D_DS3_FILE_H
|
||||
#define DUST3D_DS3_FILE_H
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#include "aboutwidget.h"
|
||||
#include "version.h"
|
||||
#include "theme.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
ExportPreviewWidget::ExportPreviewWidget(SkeletonDocument *document, QWidget *parent) :
|
||||
ExportPreviewWidget::ExportPreviewWidget(Document *document, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_document(document),
|
||||
m_previewLabel(nullptr),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef EXPORT_PREVIEW_WIDGET_H
|
||||
#define EXPORT_PREVIEW_WIDGET_H
|
||||
#ifndef DUST3D_EXPORT_PREVIEW_WIDGET_H
|
||||
#define DUST3D_EXPORT_PREVIEW_WIDGET_H
|
||||
#include <QDialog>
|
||||
#include <QImage>
|
||||
#include <QLabel>
|
||||
|
@ -7,7 +7,7 @@
|
|||
#include <QShowEvent>
|
||||
#include "modelwidget.h"
|
||||
#include "waitingspinnerwidget.h"
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class ExportPreviewWidget : public QDialog
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ signals:
|
|||
void saveAsGltf();
|
||||
void saveAsFbx();
|
||||
public:
|
||||
ExportPreviewWidget(SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
ExportPreviewWidget(Document *document, QWidget *parent=nullptr);
|
||||
public slots:
|
||||
void checkSpinner();
|
||||
void updateTexturePreview();
|
||||
|
@ -29,7 +29,7 @@ private:
|
|||
void initAwesomeButton(QPushButton *button);
|
||||
void updateTexturePreviewImage(const QImage &image);
|
||||
private:
|
||||
SkeletonDocument *m_document;
|
||||
Document *m_document;
|
||||
QLabel *m_previewLabel;
|
||||
QImage m_previewImage;
|
||||
ModelWidget *m_textureRenderWidget;
|
||||
|
|
|
@ -1470,7 +1470,7 @@ void FbxFileWriter::createDefinitions(size_t deformerCount)
|
|||
m_fbxDocument.nodes.push_back(definitions);
|
||||
}
|
||||
|
||||
FbxFileWriter::FbxFileWriter(MeshResultContext &resultContext,
|
||||
FbxFileWriter::FbxFileWriter(Outcome &outcome,
|
||||
const std::vector<AutoRiggerBone> *resultRigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *resultRigWeights,
|
||||
const QString &filename) :
|
||||
|
@ -1495,13 +1495,13 @@ FbxFileWriter::FbxFileWriter(MeshResultContext &resultContext,
|
|||
geometry.addProperty(std::vector<uint8_t>({'u','n','a','m','e','d','m','e','s','h',0,1,'G','e','o','m','e','t','r','y'}), 'S');
|
||||
geometry.addProperty("Mesh");
|
||||
std::vector<double> positions;
|
||||
for (const auto &vertex: resultContext.vertices) {
|
||||
for (const auto &vertex: outcome.vertices) {
|
||||
positions.push_back((double)vertex.position.x());
|
||||
positions.push_back((double)vertex.position.y());
|
||||
positions.push_back((double)vertex.position.z());
|
||||
}
|
||||
std::vector<int32_t> indicies;
|
||||
for (const auto &triangle: resultContext.triangles) {
|
||||
for (const auto &triangle: outcome.triangles) {
|
||||
indicies.push_back(triangle.indicies[0]);
|
||||
indicies.push_back(triangle.indicies[1]);
|
||||
indicies.push_back(triangle.indicies[2] ^ -1);
|
||||
|
@ -1513,7 +1513,7 @@ FbxFileWriter::FbxFileWriter(MeshResultContext &resultContext,
|
|||
layerElementNormal.addPropertyNode("MappingInformationType", "ByPolygonVertex");
|
||||
layerElementNormal.addPropertyNode("ReferenceInformationType", "Direct");
|
||||
std::vector<double> normals;
|
||||
const auto &triangleVertexNormals = resultContext.interpolatedTriangleVertexNormals();
|
||||
const auto &triangleVertexNormals = outcome.interpolatedTriangleVertexNormals();
|
||||
for (decltype(triangleVertexNormals.size()) i = 0; i < triangleVertexNormals.size(); ++i) {
|
||||
const auto &n = triangleVertexNormals[i];
|
||||
normals.push_back((double)n.x());
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#ifndef FBX_FILE_H
|
||||
#define FBX_FILE_H
|
||||
#ifndef DUST3D_FBX_FILE_H
|
||||
#define DUST3D_FBX_FILE_H
|
||||
#include <fbxdocument.h>
|
||||
#include <map>
|
||||
#include <QString>
|
||||
#include <QMatrix4x4>
|
||||
#include "meshresultcontext.h"
|
||||
#include "skeletondocument.h"
|
||||
#include "outcome.h"
|
||||
#include "document.h"
|
||||
|
||||
class FbxFileWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FbxFileWriter(MeshResultContext &resultContext,
|
||||
FbxFileWriter(Outcome &outcome,
|
||||
const std::vector<AutoRiggerBone> *resultRigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *resultRigWeights,
|
||||
const QString &filename);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef FLOAT_NUMBER_WIDGET_H
|
||||
#define FLOAT_NUMBER_WIDGET_H
|
||||
#ifndef DUST3D_FLOAT_NUMBER_WIDGET_H
|
||||
#define DUST3D_FLOAT_NUMBER_WIDGET_H
|
||||
#include <QToolButton>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef FLOWLAYOUT_H
|
||||
#define FLOWLAYOUT_H
|
||||
#ifndef DUST3D_FLOWLAYOUT_H
|
||||
#define DUST3D_FLOWLAYOUT_H
|
||||
|
||||
#include <QLayout>
|
||||
#include <QRect>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <QDir>
|
||||
#include "gltffile.h"
|
||||
#include "version.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
#include "jointnodetree.h"
|
||||
#include "meshloader.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
bool GltfFileWriter::m_enableComment = true;
|
||||
|
||||
GltfFileWriter::GltfFileWriter(MeshResultContext &resultContext,
|
||||
GltfFileWriter::GltfFileWriter(Outcome &outcome,
|
||||
const std::vector<AutoRiggerBone> *resultRigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *resultRigWeights,
|
||||
const QString &filename) :
|
||||
|
@ -129,12 +129,12 @@ GltfFileWriter::GltfFileWriter(MeshResultContext &resultContext,
|
|||
m_json["samplers"][0]["wrapS"] = 33648;
|
||||
m_json["samplers"][0]["wrapT"] = 33648;
|
||||
|
||||
const std::map<QUuid, ResultPart> *parts = &resultContext.parts();
|
||||
const std::map<QUuid, ResultPart> *parts = &outcome.parts();
|
||||
|
||||
std::map<QUuid, ResultPart> testParts;
|
||||
if (m_testOutputAsWhole) {
|
||||
testParts[0].vertices = resultContext.vertices;
|
||||
testParts[0].triangles = resultContext.triangles;
|
||||
testParts[0].vertices = outcome.vertices;
|
||||
testParts[0].triangles = outcome.triangles;
|
||||
|
||||
m_outputNormal = false;
|
||||
m_outputUv = false;
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#ifndef GLTF_FILE_H
|
||||
#define GLTF_FILE_H
|
||||
#ifndef DUST3D_GLTF_FILE_H
|
||||
#define DUST3D_GLTF_FILE_H
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <QMatrix4x4>
|
||||
#include <vector>
|
||||
#include <QQuaternion>
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
#include "json.hpp"
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class GltfFileWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GltfFileWriter(MeshResultContext &resultContext,
|
||||
GltfFileWriter(Outcome &outcome,
|
||||
const std::vector<AutoRiggerBone> *resultRigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *resultRigWeights,
|
||||
const QString &filename);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef GRAPHICS_CONTAINER_WIDGET_H
|
||||
#define GRAPHICS_CONTAINER_WIDGET_H
|
||||
#ifndef DUST3D_GRAPHICS_CONTAINER_WIDGET_H
|
||||
#define DUST3D_GRAPHICS_CONTAINER_WIDGET_H
|
||||
#include <QWidget>
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef IMAGE_FOREVER_H
|
||||
#define IMAGE_FOREVER_H
|
||||
#ifndef DUST3D_IMAGE_FOREVER_H
|
||||
#define DUST3D_IMAGE_FOREVER_H
|
||||
#include <QImage>
|
||||
#include <QUuid>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef INFO_LABEL_H
|
||||
#define INFO_LABEL_H
|
||||
#ifndef DUST3D_INFO_LABEL_H
|
||||
#define DUST3D_INFO_LABEL_H
|
||||
#include <QLabel>
|
||||
#include <QIcon>
|
||||
#include <QWidget>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef INTERPOLATION_TYPE_H
|
||||
#define INTERPOLATION_TYPE_H
|
||||
#ifndef DUST3D_INTERPOLATION_TYPE_H
|
||||
#define DUST3D_INTERPOLATION_TYPE_H
|
||||
#include <QString>
|
||||
#include <QEasingCurve>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "jointnodetree.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
const std::vector<JointNode> &JointNodeTree::nodes() const
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef JOINT_NODE_TREE_H
|
||||
#define JOINT_NODE_TREE_H
|
||||
#ifndef DUST3D_JOINT_NODE_TREE_H
|
||||
#define DUST3D_JOINT_NODE_TREE_H
|
||||
#include <QMatrix4x4>
|
||||
#include <vector>
|
||||
#include <QQuaternion>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LOG_BROWSER_H
|
||||
#define LOG_BROWSER_H
|
||||
#ifndef DUST3D_LOG_BROWSER_H
|
||||
#define DUST3D_LOG_BROWSER_H
|
||||
// Modified from https://wiki.qt.io/Browser_for_QDebug_output
|
||||
#include <QObject>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <QCloseEvent>
|
||||
#include <QKeyEvent>
|
||||
#include "version.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
LogBrowserDialog::LogBrowserDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef LOG_BROWSER_DIALOG_H
|
||||
#define LOG_BROWSER_DIALOG_H
|
||||
#ifndef DUST3D_LOG_BROWSER_DIALOG_H
|
||||
#define DUST3D_LOG_BROWSER_DIALOG_H
|
||||
// Modified from https://wiki.qt.io/Browser_for_QDebug_output
|
||||
#include <QDialog>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <QDebug>
|
||||
#include <QtGlobal>
|
||||
#include <QSurfaceFormat>
|
||||
#include "skeletondocumentwindow.h"
|
||||
#include "documentwindow.h"
|
||||
#include "theme.h"
|
||||
#include "version.h"
|
||||
//#include "fbxdocument.h"
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
#include "markiconcreator.h"
|
||||
#include "theme.h"
|
||||
|
||||
std::map<SkeletonBoneMark, QIcon> MarkIconCreator::m_iconMap;
|
||||
std::map<BoneMark, QIcon> MarkIconCreator::m_iconMap;
|
||||
int MarkIconCreator::m_iconSize = 40;
|
||||
|
||||
QIcon MarkIconCreator::createIcon(SkeletonBoneMark boneMark)
|
||||
QIcon MarkIconCreator::createIcon(BoneMark boneMark)
|
||||
{
|
||||
if (m_iconMap.find(boneMark) == m_iconMap.end()) {
|
||||
QPixmap pixmap(MarkIconCreator::m_iconSize, MarkIconCreator::m_iconSize);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QColor color = SkeletonBoneMarkToColor(boneMark);
|
||||
QColor color = BoneMarkToColor(boneMark);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setBrush(QBrush(color));
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#ifndef MARK_ICON_CREATOR_H
|
||||
#define MARK_ICON_CREATOR_H
|
||||
#ifndef DUST3D_MARK_ICON_CREATOR_H
|
||||
#define DUST3D_MARK_ICON_CREATOR_H
|
||||
#include <map>
|
||||
#include <QIcon>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class MarkIconCreator
|
||||
{
|
||||
public:
|
||||
static QIcon createIcon(SkeletonBoneMark boneMark);
|
||||
static QIcon createIcon(BoneMark boneMark);
|
||||
private:
|
||||
static std::map<SkeletonBoneMark, QIcon> m_iconMap;
|
||||
static std::map<BoneMark, QIcon> m_iconMap;
|
||||
static int m_iconSize;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "material.h"
|
||||
#include "imageforever.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
void initializeMaterialTexturesFromSnapshot(const SkeletonSnapshot &snapshot, const QUuid &materialId, MaterialTextures &materialTextures)
|
||||
void initializeMaterialTexturesFromSnapshot(const Snapshot &snapshot, const QUuid &materialId, MaterialTextures &materialTextures)
|
||||
{
|
||||
QString materialIdString = materialId.toString();
|
||||
for (const auto &materialItem: snapshot.materials) {
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
#ifndef MATERIAL_H
|
||||
#define MATERIAL_H
|
||||
#ifndef DUST3D_MATERIAL_H
|
||||
#define DUST3D_MATERIAL_H
|
||||
#include <QImage>
|
||||
#include <QUuid>
|
||||
#include "texturetype.h"
|
||||
#include "skeletonsnapshot.h"
|
||||
|
||||
struct Material
|
||||
{
|
||||
QColor color;
|
||||
QUuid materialId;
|
||||
};
|
||||
#include "snapshot.h"
|
||||
|
||||
struct MaterialTextures
|
||||
{
|
||||
const QImage *textureImages[(int)TextureType::Count - 1] = {nullptr};
|
||||
};
|
||||
|
||||
void initializeMaterialTexturesFromSnapshot(const SkeletonSnapshot &snapshot, const QUuid &materialId, MaterialTextures &materialTextures);
|
||||
void initializeMaterialTexturesFromSnapshot(const Snapshot &snapshot, const QUuid &materialId, MaterialTextures &materialTextures);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "floatnumberwidget.h"
|
||||
#include "version.h"
|
||||
#include "imageforever.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
QPushButton *MaterialEditWidget::createMapButton()
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ QImage *MaterialEditWidget::pickImage()
|
|||
return image;
|
||||
}
|
||||
|
||||
MaterialEditWidget::MaterialEditWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MaterialEditWidget::MaterialEditWidget(const Document *document, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ MaterialEditWidget::MaterialEditWidget(const SkeletonDocument *document, QWidget
|
|||
for (int i = 1; i < (int)TextureType::Count; i++) {
|
||||
QVBoxLayout *textureManageLayout = new QVBoxLayout;
|
||||
|
||||
SkeletonMaterialMap item;
|
||||
MaterialMap item;
|
||||
item.forWhat = (TextureType)i;
|
||||
m_layers[0].maps.push_back(item);
|
||||
|
||||
|
@ -141,9 +141,9 @@ MaterialEditWidget::MaterialEditWidget(const SkeletonDocument *document, QWidget
|
|||
m_unsaved = true;
|
||||
updateTitle();
|
||||
});
|
||||
connect(this, &MaterialEditWidget::addMaterial, document, &SkeletonDocument::addMaterial);
|
||||
connect(this, &MaterialEditWidget::renameMaterial, document, &SkeletonDocument::renameMaterial);
|
||||
connect(this, &MaterialEditWidget::setMaterialLayers, document, &SkeletonDocument::setMaterialLayers);
|
||||
connect(this, &MaterialEditWidget::addMaterial, document, &Document::addMaterial);
|
||||
connect(this, &MaterialEditWidget::renameMaterial, document, &Document::renameMaterial);
|
||||
connect(this, &MaterialEditWidget::setMaterialLayers, document, &Document::setMaterialLayers);
|
||||
|
||||
updatePreview();
|
||||
updateTitle();
|
||||
|
@ -253,7 +253,7 @@ void MaterialEditWidget::updateTitle()
|
|||
setWindowTitle(unifiedWindowTitle(tr("New") + (m_unsaved ? "*" : "")));
|
||||
return;
|
||||
}
|
||||
const SkeletonMaterial *material = m_document->findMaterial(m_materialId);
|
||||
const Material *material = m_document->findMaterial(m_materialId);
|
||||
if (nullptr == material) {
|
||||
qDebug() << "Find material failed:" << m_materialId;
|
||||
return;
|
||||
|
@ -267,7 +267,7 @@ void MaterialEditWidget::setEditMaterialName(QString name)
|
|||
updateTitle();
|
||||
}
|
||||
|
||||
void MaterialEditWidget::setEditMaterialLayers(std::vector<SkeletonMaterialLayer> layers)
|
||||
void MaterialEditWidget::setEditMaterialLayers(std::vector<MaterialLayer> layers)
|
||||
{
|
||||
for (int i = 1; i < (int)TextureType::Count; i++) {
|
||||
m_layers[0].maps[i - 1].imageId = QUuid();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef MATERIAL_EDIT_WIDGET_H
|
||||
#define MATERIAL_EDIT_WIDGET_H
|
||||
#ifndef DUST3D_MATERIAL_EDIT_WIDGET_H
|
||||
#define DUST3D_MATERIAL_EDIT_WIDGET_H
|
||||
#include <QDialog>
|
||||
#include <map>
|
||||
#include <QCloseEvent>
|
||||
#include <QLineEdit>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "modelwidget.h"
|
||||
#include "materialpreviewsgenerator.h"
|
||||
|
||||
|
@ -18,19 +18,19 @@ class MaterialEditWidget : public QDialog
|
|||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void addMaterial(QString name, std::vector<SkeletonMaterialLayer> layers);
|
||||
void addMaterial(QString name, std::vector<MaterialLayer> layers);
|
||||
void removeMaterial(QUuid materialId);
|
||||
void setMaterialLayers(QUuid materialId, std::vector<SkeletonMaterialLayer> layers);
|
||||
void setMaterialLayers(QUuid materialId, std::vector<MaterialLayer> layers);
|
||||
void renameMaterial(QUuid materialId, QString name);
|
||||
void layersAdjusted();
|
||||
public:
|
||||
MaterialEditWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MaterialEditWidget(const Document *document, QWidget *parent=nullptr);
|
||||
~MaterialEditWidget();
|
||||
public slots:
|
||||
void updatePreview();
|
||||
void setEditMaterialId(QUuid materialId);
|
||||
void setEditMaterialName(QString name);
|
||||
void setEditMaterialLayers(std::vector<SkeletonMaterialLayer> layers);
|
||||
void setEditMaterialLayers(std::vector<MaterialLayer> layers);
|
||||
void updateTitle();
|
||||
void save();
|
||||
void clearUnsaveState();
|
||||
|
@ -43,7 +43,7 @@ private:
|
|||
void updateMapButtonBackground(QPushButton *button, const QImage *image);
|
||||
QPushButton *createMapButton();
|
||||
QImage *pickImage();
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
MaterialPreviewsGenerator *m_materialPreviewsGenerator = nullptr;
|
||||
ModelWidget *m_previewWidget = nullptr;
|
||||
bool m_isPreviewDirty = false;
|
||||
|
@ -51,7 +51,7 @@ private:
|
|||
QUuid m_materialId;
|
||||
bool m_unsaved = false;
|
||||
QLineEdit *m_nameEdit = nullptr;
|
||||
std::vector<SkeletonMaterialLayer> m_layers;
|
||||
std::vector<MaterialLayer> m_layers;
|
||||
QPushButton *m_textureMapButtons[(int)TextureType::Count - 1] = {nullptr};
|
||||
};
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include <QXmlStreamWriter>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include "skeletonxml.h"
|
||||
#include "snapshotxml.h"
|
||||
#include "materiallistwidget.h"
|
||||
|
||||
MaterialListWidget::MaterialListWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MaterialListWidget::MaterialListWidget(const Document *document, QWidget *parent) :
|
||||
QTreeWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ MaterialListWidget::MaterialListWidget(const SkeletonDocument *document, QWidget
|
|||
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
connect(document, &SkeletonDocument::materialListChanged, this, &MaterialListWidget::reload);
|
||||
connect(document, &SkeletonDocument::cleanup, this, &MaterialListWidget::removeAllContent);
|
||||
connect(document, &Document::materialListChanged, this, &MaterialListWidget::reload);
|
||||
connect(document, &Document::cleanup, this, &MaterialListWidget::removeAllContent);
|
||||
|
||||
connect(this, &MaterialListWidget::removeMaterial, document, &SkeletonDocument::removeMaterial);
|
||||
connect(this, &MaterialListWidget::removeMaterial, document, &Document::removeMaterial);
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &QTreeWidget::customContextMenuRequested, this, &MaterialListWidget::showContextMenu);
|
||||
|
@ -200,7 +200,7 @@ void MaterialListWidget::showContextMenu(const QPoint &pos)
|
|||
|
||||
QAction pasteAction(tr("Paste"), this);
|
||||
if (m_document->hasPastableMaterialsInClipboard()) {
|
||||
connect(&pasteAction, &QAction::triggered, m_document, &SkeletonDocument::paste);
|
||||
connect(&pasteAction, &QAction::triggered, m_document, &Document::paste);
|
||||
contextMenu.addAction(&pasteAction);
|
||||
}
|
||||
|
||||
|
@ -297,8 +297,8 @@ void MaterialListWidget::copy()
|
|||
|
||||
std::set<QUuid> emptySet;
|
||||
|
||||
SkeletonSnapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot, emptySet, SkeletonDocumentToSnapshotFor::Materials,
|
||||
Snapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot, emptySet, DocumentToSnapshotFor::Materials,
|
||||
emptySet, emptySet, limitMaterialIds);
|
||||
QString snapshotXml;
|
||||
QXmlStreamWriter xmlStreamWriter(&snapshotXml);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MATERIAL_LIST_WIDGET_H
|
||||
#define MATERIAL_LIST_WIDGET_H
|
||||
#ifndef DUST3D_MATERIAL_LIST_WIDGET_H
|
||||
#define DUST3D_MATERIAL_LIST_WIDGET_H
|
||||
#include <QTreeWidget>
|
||||
#include <map>
|
||||
#include <QMouseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "materialwidget.h"
|
||||
|
||||
class MaterialListWidget : public QTreeWidget
|
||||
|
@ -15,7 +15,7 @@ signals:
|
|||
void cornerButtonClicked(QUuid materialId);
|
||||
void currentSelectedMaterialChanged(QUuid materialId);
|
||||
public:
|
||||
MaterialListWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MaterialListWidget(const Document *document, QWidget *parent=nullptr);
|
||||
bool isMaterialSelected(QUuid materialId);
|
||||
void enableMultipleSelection(bool enabled);
|
||||
public slots:
|
||||
|
@ -33,7 +33,7 @@ protected:
|
|||
private:
|
||||
int calculateColumnCount();
|
||||
void updateMaterialSelectState(QUuid materialId, bool selected);
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
std::map<QUuid, std::pair<QTreeWidgetItem *, int>> m_itemMap;
|
||||
std::set<QUuid> m_selectedMaterialIds;
|
||||
QUuid m_currentSelectedMaterialId;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "materialeditwidget.h"
|
||||
#include "infolabel.h"
|
||||
|
||||
MaterialManageWidget::MaterialManageWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MaterialManageWidget::MaterialManageWidget(const Document *document, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ void MaterialManageWidget::showMaterialDialog(QUuid materialId)
|
|||
MaterialEditWidget *materialEditWidget = new MaterialEditWidget(m_document);
|
||||
materialEditWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
if (!materialId.isNull()) {
|
||||
const SkeletonMaterial *material = m_document->findMaterial(materialId);
|
||||
const Material *material = m_document->findMaterial(materialId);
|
||||
if (nullptr != material) {
|
||||
materialEditWidget->setEditMaterialId(materialId);
|
||||
materialEditWidget->setEditMaterialName(material->name);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MATERIAL_MANAGE_WIDGET_H
|
||||
#define MATERIAL_MANAGE_WIDGET_H
|
||||
#ifndef DUST3D_MATERIAL_MANAGE_WIDGET_H
|
||||
#define DUST3D_MATERIAL_MANAGE_WIDGET_H
|
||||
#include <QWidget>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "materiallistwidget.h"
|
||||
|
||||
class MaterialManageWidget : public QWidget
|
||||
|
@ -11,7 +11,7 @@ signals:
|
|||
void registerDialog(QWidget *widget);
|
||||
void unregisterDialog(QWidget *widget);
|
||||
public:
|
||||
MaterialManageWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MaterialManageWidget(const Document *document, QWidget *parent=nullptr);
|
||||
MaterialListWidget *materialListWidget();
|
||||
protected:
|
||||
virtual QSize sizeHint() const;
|
||||
|
@ -19,7 +19,7 @@ public slots:
|
|||
void showAddMaterialDialog();
|
||||
void showMaterialDialog(QUuid materialId);
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
MaterialListWidget *m_materialListWidget = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <QElapsedTimer>
|
||||
#include "materialpreviewsgenerator.h"
|
||||
#include "meshgenerator.h"
|
||||
#include "skeletonxml.h"
|
||||
#include "snapshotxml.h"
|
||||
#include "ds3file.h"
|
||||
#include "texturegenerator.h"
|
||||
#include "imageforever.h"
|
||||
|
@ -18,7 +18,7 @@ MaterialPreviewsGenerator::~MaterialPreviewsGenerator()
|
|||
}
|
||||
}
|
||||
|
||||
void MaterialPreviewsGenerator::addMaterial(QUuid materialId, const std::vector<SkeletonMaterialLayer> &layers)
|
||||
void MaterialPreviewsGenerator::addMaterial(QUuid materialId, const std::vector<MaterialLayer> &layers)
|
||||
{
|
||||
m_materials.push_back({materialId, layers});
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ MeshLoader *MaterialPreviewsGenerator::takePreview(QUuid materialId)
|
|||
|
||||
void MaterialPreviewsGenerator::generate()
|
||||
{
|
||||
SkeletonSnapshot *snapshot = new SkeletonSnapshot;
|
||||
Snapshot *snapshot = new Snapshot;
|
||||
|
||||
std::vector<QUuid> partIds;
|
||||
Ds3FileReader ds3Reader(":/resources/material-demo-model.ds3");
|
||||
|
@ -65,12 +65,12 @@ void MaterialPreviewsGenerator::generate()
|
|||
partIds.push_back(QUuid(mirror.first));
|
||||
}
|
||||
|
||||
MeshResultContext *meshResultContext = meshGenerator->takeMeshResultContext();
|
||||
Outcome *outcome = meshGenerator->takeMeshResultContext();
|
||||
|
||||
MeshLoader *resultMesh = meshGenerator->takeResultMesh();
|
||||
|
||||
for (const auto &material: m_materials) {
|
||||
TextureGenerator *textureGenerator = new TextureGenerator(*meshResultContext);
|
||||
TextureGenerator *textureGenerator = new TextureGenerator(*outcome);
|
||||
for (const auto &layer: material.second) {
|
||||
for (const auto &mapItem: layer.maps) {
|
||||
const QImage *image = ImageForever::get(mapItem.imageId);
|
||||
|
@ -102,7 +102,7 @@ void MaterialPreviewsGenerator::generate()
|
|||
|
||||
delete resultMesh;
|
||||
|
||||
delete meshResultContext;
|
||||
delete outcome;
|
||||
|
||||
delete meshGenerator;
|
||||
delete cacheContext;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef MATERIAL_PREVIEWS_GENERATOR_H
|
||||
#define MATERIAL_PREVIEWS_GENERATOR_H
|
||||
#ifndef DUST3D_MATERIAL_PREVIEWS_GENERATOR_H
|
||||
#define DUST3D_MATERIAL_PREVIEWS_GENERATOR_H
|
||||
#include <QObject>
|
||||
#include <map>
|
||||
#include <QUuid>
|
||||
#include <vector>
|
||||
#include "meshloader.h"
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class MaterialPreviewsGenerator : public QObject
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ class MaterialPreviewsGenerator : public QObject
|
|||
public:
|
||||
MaterialPreviewsGenerator();
|
||||
~MaterialPreviewsGenerator();
|
||||
void addMaterial(QUuid materialId, const std::vector<SkeletonMaterialLayer> &layers);
|
||||
void addMaterial(QUuid materialId, const std::vector<MaterialLayer> &layers);
|
||||
const std::set<QUuid> &generatedPreviewMaterialIds();
|
||||
MeshLoader *takePreview(QUuid materialId);
|
||||
void generate();
|
||||
|
@ -22,7 +22,7 @@ signals:
|
|||
public slots:
|
||||
void process();
|
||||
private:
|
||||
std::vector<std::pair<QUuid, std::vector<SkeletonMaterialLayer>>> m_materials;
|
||||
std::vector<std::pair<QUuid, std::vector<MaterialLayer>>> m_materials;
|
||||
std::map<QUuid, MeshLoader *> m_previews;
|
||||
std::set<QUuid> m_generatedMaterialIds;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include "materialwidget.h"
|
||||
|
||||
MaterialWidget::MaterialWidget(const SkeletonDocument *document, QUuid materialId) :
|
||||
MaterialWidget::MaterialWidget(const Document *document, QUuid materialId) :
|
||||
m_materialId(materialId),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -31,8 +31,8 @@ MaterialWidget::MaterialWidget(const SkeletonDocument *document, QUuid materialI
|
|||
|
||||
setFixedSize(Theme::materialPreviewImageSize, MaterialWidget::preferredHeight());
|
||||
|
||||
connect(document, &SkeletonDocument::materialNameChanged, this, &MaterialWidget::updateName);
|
||||
connect(document, &SkeletonDocument::materialPreviewChanged, this, &MaterialWidget::updatePreview);
|
||||
connect(document, &Document::materialNameChanged, this, &MaterialWidget::updateName);
|
||||
connect(document, &Document::materialPreviewChanged, this, &MaterialWidget::updatePreview);
|
||||
}
|
||||
|
||||
void MaterialWidget::setCornerButtonVisible(bool visible)
|
||||
|
@ -68,7 +68,7 @@ void MaterialWidget::reload()
|
|||
|
||||
void MaterialWidget::updatePreview()
|
||||
{
|
||||
const SkeletonMaterial *material = m_document->findMaterial(m_materialId);
|
||||
const Material *material = m_document->findMaterial(m_materialId);
|
||||
if (!material) {
|
||||
qDebug() << "Material not found:" << m_materialId;
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ void MaterialWidget::updatePreview()
|
|||
|
||||
void MaterialWidget::updateName()
|
||||
{
|
||||
const SkeletonMaterial *material = m_document->findMaterial(m_materialId);
|
||||
const Material *material = m_document->findMaterial(m_materialId);
|
||||
if (!material) {
|
||||
qDebug() << "Material not found:" << m_materialId;
|
||||
return;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MATERIAL_WIDGET_H
|
||||
#define MATERIAL_WIDGET_H
|
||||
#ifndef DUST3D_MATERIAL_WIDGET_H
|
||||
#define DUST3D_MATERIAL_WIDGET_H
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QIcon>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "modelwidget.h"
|
||||
|
||||
class MaterialWidget : public QFrame
|
||||
|
@ -13,7 +13,7 @@ signals:
|
|||
void modifyMaterial(QUuid materialId);
|
||||
void cornerButtonClicked(QUuid materialId);
|
||||
public:
|
||||
MaterialWidget(const SkeletonDocument *document, QUuid materialId);
|
||||
MaterialWidget(const Document *document, QUuid materialId);
|
||||
static int preferredHeight();
|
||||
ModelWidget *previewWidget();
|
||||
protected:
|
||||
|
@ -27,7 +27,7 @@ public slots:
|
|||
void setCornerButtonVisible(bool visible);
|
||||
private:
|
||||
QUuid m_materialId;
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
ModelWidget *m_previewWidget = nullptr;
|
||||
QLabel *m_nameLabel = nullptr;
|
||||
QPushButton *m_cornerButton = nullptr;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <QElapsedTimer>
|
||||
#include <unordered_set>
|
||||
#include "meshgenerator.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "skeletondocument.h"
|
||||
#include "util.h"
|
||||
#include "document.h"
|
||||
#include "meshlite.h"
|
||||
#include "meshutil.h"
|
||||
#include "theme.h"
|
||||
|
@ -32,10 +32,10 @@ void GeneratedCacheContext::updateComponentCombinableMesh(QString componentId, v
|
|||
cache = cloneCombinableMesh(mesh);
|
||||
}
|
||||
|
||||
MeshGenerator::MeshGenerator(SkeletonSnapshot *snapshot) :
|
||||
MeshGenerator::MeshGenerator(Snapshot *snapshot) :
|
||||
m_snapshot(snapshot),
|
||||
m_mesh(nullptr),
|
||||
m_meshResultContext(nullptr),
|
||||
m_outcome(nullptr),
|
||||
m_sharedContextWidget(nullptr),
|
||||
m_cacheContext(nullptr),
|
||||
m_smoothNormal(true),
|
||||
|
@ -50,7 +50,7 @@ MeshGenerator::~MeshGenerator()
|
|||
for (const auto &partPreviewMeshIt: m_partPreviewMeshMap) {
|
||||
delete partPreviewMeshIt.second;
|
||||
}
|
||||
delete m_meshResultContext;
|
||||
delete m_outcome;
|
||||
}
|
||||
|
||||
void MeshGenerator::setSmoothNormal(bool smoothNormal)
|
||||
|
@ -103,14 +103,14 @@ const std::set<QUuid> &MeshGenerator::generatedPreviewPartIds()
|
|||
return m_generatedPreviewPartIds;
|
||||
}
|
||||
|
||||
MeshResultContext *MeshGenerator::takeMeshResultContext()
|
||||
Outcome *MeshGenerator::takeMeshResultContext()
|
||||
{
|
||||
MeshResultContext *meshResultContext = m_meshResultContext;
|
||||
m_meshResultContext = nullptr;
|
||||
return meshResultContext;
|
||||
Outcome *outcome = m_outcome;
|
||||
m_outcome = nullptr;
|
||||
return outcome;
|
||||
}
|
||||
|
||||
void MeshGenerator::loadVertexSources(void *meshliteContext, int meshId, QUuid partId, const std::map<int, QUuid> &bmeshToNodeIdMap, std::vector<BmeshVertex> &bmeshVertices,
|
||||
void MeshGenerator::loadVertexSources(void *meshliteContext, int meshId, QUuid partId, const std::map<int, QUuid> &bmeshToNodeIdMap, std::vector<OutcomeNodeVertex> &bmeshVertices,
|
||||
std::vector<std::tuple<PositionMapKey, PositionMapKey, PositionMapKey, PositionMapKey>> &bmeshQuads)
|
||||
{
|
||||
int vertexCount = meshlite_get_vertex_count(meshliteContext, meshId);
|
||||
|
@ -122,7 +122,7 @@ void MeshGenerator::loadVertexSources(void *meshliteContext, int meshId, QUuid p
|
|||
Q_ASSERT(positionCount == sourceCount);
|
||||
std::vector<QVector3D> verticesPositions;
|
||||
for (int i = 0, positionIndex = 0; i < positionCount; i++, positionIndex+=3) {
|
||||
BmeshVertex vertex;
|
||||
OutcomeNodeVertex vertex;
|
||||
vertex.partId = partId;
|
||||
auto findNodeId = bmeshToNodeIdMap.find(sourceBuffer[i]);
|
||||
if (findNodeId != bmeshToNodeIdMap.end())
|
||||
|
@ -168,10 +168,10 @@ void MeshGenerator::loadGeneratedPositionsToMeshResultContext(void *meshliteCont
|
|||
int positionCount = meshlite_get_vertex_position_array(meshliteContext, triangulatedMeshId, positionBuffer, positionBufferLen) / 3;
|
||||
std::map<int, int> verticesMap;
|
||||
for (int i = 0, positionIndex = 0; i < positionCount; i++, positionIndex+=3) {
|
||||
ResultVertex vertex;
|
||||
OutcomeVertex vertex;
|
||||
vertex.position = QVector3D(positionBuffer[positionIndex + 0], positionBuffer[positionIndex + 1], positionBuffer[positionIndex + 2]);
|
||||
verticesMap[i] = m_meshResultContext->vertices.size();
|
||||
m_meshResultContext->vertices.push_back(vertex);
|
||||
verticesMap[i] = m_outcome->vertices.size();
|
||||
m_outcome->vertices.push_back(vertex);
|
||||
}
|
||||
int faceCount = meshlite_get_face_count(meshliteContext, triangulatedMeshId);
|
||||
int triangleIndexBufferLen = faceCount * 3;
|
||||
|
@ -182,12 +182,12 @@ void MeshGenerator::loadGeneratedPositionsToMeshResultContext(void *meshliteCont
|
|||
int normalCount = meshlite_get_triangle_normal_array(meshliteContext, triangulatedMeshId, normalBuffer, triangleNormalBufferLen) / 3;
|
||||
Q_ASSERT(triangleCount == normalCount);
|
||||
for (int i = 0, triangleVertIndex = 0, normalIndex=0; i < triangleCount; i++, triangleVertIndex+=3, normalIndex += 3) {
|
||||
ResultTriangle triangle;
|
||||
OutcomeTriangle triangle;
|
||||
triangle.indicies[0] = verticesMap[triangleIndexBuffer[triangleVertIndex + 0]];
|
||||
triangle.indicies[1] = verticesMap[triangleIndexBuffer[triangleVertIndex + 1]];
|
||||
triangle.indicies[2] = verticesMap[triangleIndexBuffer[triangleVertIndex + 2]];
|
||||
triangle.normal = QVector3D(normalBuffer[normalIndex + 0], normalBuffer[normalIndex + 1], normalBuffer[normalIndex + 2]);
|
||||
m_meshResultContext->triangles.push_back(triangle);
|
||||
m_outcome->triangles.push_back(triangle);
|
||||
}
|
||||
delete[] positionBuffer;
|
||||
delete[] triangleIndexBuffer;
|
||||
|
@ -257,7 +257,7 @@ void *MeshGenerator::combinePartMesh(QString partId)
|
|||
if (!materialIdString.isEmpty())
|
||||
materialId = QUuid(materialIdString);
|
||||
|
||||
Material partMaterial;
|
||||
OutcomeMaterial partMaterial;
|
||||
partMaterial.color = partColor;
|
||||
partMaterial.materialId = materialId;
|
||||
|
||||
|
@ -291,12 +291,12 @@ void *MeshGenerator::combinePartMesh(QString partId)
|
|||
float z = (m_sideProfileMiddleX - valueOfKeyInMapOrEmpty(node, "z").toFloat());
|
||||
int bmeshNodeId = meshlite_bmesh_add_node(m_meshliteContext, bmeshId, x, y, z, radius);
|
||||
|
||||
SkeletonBoneMark boneMark = SkeletonBoneMarkFromString(valueOfKeyInMapOrEmpty(node, "boneMark").toUtf8().constData());
|
||||
BoneMark boneMark = BoneMarkFromString(valueOfKeyInMapOrEmpty(node, "boneMark").toUtf8().constData());
|
||||
|
||||
nodeToBmeshIdMap[nodeId] = bmeshNodeId;
|
||||
bmeshToNodeIdMap[bmeshNodeId] = nodeId;
|
||||
|
||||
BmeshNode bmeshNode;
|
||||
OutcomeNode bmeshNode;
|
||||
bmeshNode.partId = QUuid(partId);
|
||||
bmeshNode.origin = QVector3D(x, y, z);
|
||||
bmeshNode.radius = radius;
|
||||
|
@ -305,7 +305,7 @@ void *MeshGenerator::combinePartMesh(QString partId)
|
|||
bmeshNode.material.color = partColor;
|
||||
bmeshNode.boneMark = boneMark;
|
||||
//if (SkeletonBoneMark::None != boneMark)
|
||||
// bmeshNode.color = SkeletonBoneMarkToColor(boneMark);
|
||||
// bmeshNode.color = BoneMarkToColor(boneMark);
|
||||
cacheBmeshNodes.push_back(bmeshNode);
|
||||
if (xMirrored) {
|
||||
bmeshNode.partId = mirroredPartId;
|
||||
|
@ -560,7 +560,7 @@ void *MeshGenerator::combineComponentMesh(QString componentId, bool *inverse)
|
|||
for (size_t vertexIndex = 0; vertexIndex < positionsBeforeSmooth.size(); vertexIndex++) {
|
||||
const auto &oldPosition = positionsBeforeSmooth[vertexIndex];
|
||||
const auto &smoothedPosition = positionsAfterSmooth[vertexIndex];
|
||||
BmeshVertex source;
|
||||
OutcomeNodeVertex source;
|
||||
if (verticesSources.findPosition(oldPosition.x(), oldPosition.y(), oldPosition.z(), &source)) {
|
||||
verticesSources.removePosition(oldPosition.x(), oldPosition.y(), oldPosition.z());
|
||||
source.position = smoothedPosition;
|
||||
|
@ -591,7 +591,7 @@ void MeshGenerator::generate()
|
|||
m_meshliteContext = meshlite_create_context();
|
||||
|
||||
initMeshUtils();
|
||||
m_meshResultContext = new MeshResultContext;
|
||||
m_outcome = new Outcome;
|
||||
|
||||
bool needDeleteCacheContext = false;
|
||||
if (nullptr == m_cacheContext) {
|
||||
|
@ -670,11 +670,11 @@ void MeshGenerator::generate()
|
|||
}
|
||||
|
||||
for (const auto &verticesSourcesIt: m_cacheContext->componentVerticesSources[QUuid().toString()].map()) {
|
||||
m_meshResultContext->bmeshVertices.push_back(verticesSourcesIt.second);
|
||||
m_outcome->bmeshVertices.push_back(verticesSourcesIt.second);
|
||||
}
|
||||
|
||||
for (const auto &bmeshNodes: m_cacheContext->partBmeshNodes) {
|
||||
m_meshResultContext->bmeshNodes.insert(m_meshResultContext->bmeshNodes.end(),
|
||||
m_outcome->bmeshNodes.insert(m_outcome->bmeshNodes.end(),
|
||||
bmeshNodes.second.begin(), bmeshNodes.second.end());
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ void MeshGenerator::generate()
|
|||
|
||||
if (resultMeshId > 0) {
|
||||
loadGeneratedPositionsToMeshResultContext(m_meshliteContext, triangulatedFinalMeshId);
|
||||
m_mesh = new MeshLoader(m_meshliteContext, resultMeshId, triangulatedFinalMeshId, Theme::white, &m_meshResultContext->triangleMaterials(), m_smoothNormal);
|
||||
m_mesh = new MeshLoader(m_meshliteContext, resultMeshId, triangulatedFinalMeshId, Theme::white, &m_outcome->triangleMaterials(), m_smoothNormal);
|
||||
}
|
||||
|
||||
if (needDeleteCacheContext) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MESH_GENERATOR_H
|
||||
#define MESH_GENERATOR_H
|
||||
#ifndef DUST3D_MESH_GENERATOR_H
|
||||
#define DUST3D_MESH_GENERATOR_H
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
|
@ -7,21 +7,21 @@
|
|||
#include <set>
|
||||
#include <QThread>
|
||||
#include <QOpenGLWidget>
|
||||
#include "skeletonsnapshot.h"
|
||||
#include "snapshot.h"
|
||||
#include "meshloader.h"
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
#include "positionmap.h"
|
||||
|
||||
class GeneratedCacheContext
|
||||
{
|
||||
public:
|
||||
~GeneratedCacheContext();
|
||||
std::map<QString, std::vector<BmeshVertex>> partBmeshVertices;
|
||||
std::map<QString, std::vector<BmeshNode>> partBmeshNodes;
|
||||
std::map<QString, std::vector<OutcomeNodeVertex>> partBmeshVertices;
|
||||
std::map<QString, std::vector<OutcomeNode>> partBmeshNodes;
|
||||
std::map<QString, std::vector<std::tuple<PositionMapKey, PositionMapKey, PositionMapKey, PositionMapKey>>> partBmeshQuads;
|
||||
std::map<QString, void *> componentCombinableMeshs;
|
||||
std::map<QString, std::vector<QVector3D>> componentPositions;
|
||||
std::map<QString, PositionMap<BmeshVertex>> componentVerticesSources;
|
||||
std::map<QString, PositionMap<OutcomeNodeVertex>> componentVerticesSources;
|
||||
std::map<QString, QString> partMirrorIdMap;
|
||||
void updateComponentCombinableMesh(QString componentId, void *mesh);
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ class MeshGenerator : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MeshGenerator(SkeletonSnapshot *snapshot);
|
||||
MeshGenerator(Snapshot *snapshot);
|
||||
~MeshGenerator();
|
||||
void setSharedContextWidget(QOpenGLWidget *widget);
|
||||
void addPartPreviewRequirement(const QUuid &partId);
|
||||
|
@ -41,20 +41,20 @@ public:
|
|||
MeshLoader *takePartPreviewMesh(const QUuid &partId);
|
||||
const std::set<QUuid> &requirePreviewPartIds();
|
||||
const std::set<QUuid> &generatedPreviewPartIds();
|
||||
MeshResultContext *takeMeshResultContext();
|
||||
Outcome *takeMeshResultContext();
|
||||
void generate();
|
||||
signals:
|
||||
void finished();
|
||||
public slots:
|
||||
void process();
|
||||
private:
|
||||
SkeletonSnapshot *m_snapshot;
|
||||
Snapshot *m_snapshot;
|
||||
MeshLoader *m_mesh;
|
||||
std::map<QUuid, MeshLoader *> m_partPreviewMeshMap;
|
||||
std::set<QUuid> m_requirePreviewPartIds;
|
||||
std::set<QUuid> m_generatedPreviewPartIds;
|
||||
QThread *m_thread;
|
||||
MeshResultContext *m_meshResultContext;
|
||||
Outcome *m_outcome;
|
||||
QOpenGLWidget *m_sharedContextWidget;
|
||||
void *m_meshliteContext;
|
||||
GeneratedCacheContext *m_cacheContext;
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
static bool m_enableDebug;
|
||||
static PositionMap<int> *m_forMakePositionKey;
|
||||
private:
|
||||
void loadVertexSources(void *meshliteContext, int meshId, QUuid partId, const std::map<int, QUuid> &bmeshToNodeIdMap, std::vector<BmeshVertex> &bmeshVertices,
|
||||
void loadVertexSources(void *meshliteContext, int meshId, QUuid partId, const std::map<int, QUuid> &bmeshToNodeIdMap, std::vector<OutcomeNodeVertex> &bmeshVertices,
|
||||
std::vector<std::tuple<PositionMapKey, PositionMapKey, PositionMapKey, PositionMapKey>> &bmeshQuads);
|
||||
void loadGeneratedPositionsToMeshResultContext(void *meshliteContext, int triangulatedMeshId);
|
||||
void collectParts();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
float MeshLoader::m_defaultMetalness = 0.0;
|
||||
float MeshLoader::m_defaultRoughness = 1.0;
|
||||
|
||||
MeshLoader::MeshLoader(void *meshlite, int meshId, int triangulatedMeshId, QColor defaultColor, const std::vector<Material> *triangleMaterials, bool smoothNormal) :
|
||||
MeshLoader::MeshLoader(void *meshlite, int meshId, int triangulatedMeshId, QColor defaultColor, const std::vector<OutcomeMaterial> *triangleMaterials, bool smoothNormal) :
|
||||
m_triangleVertices(nullptr),
|
||||
m_triangleVertexCount(0),
|
||||
m_edgeVertices(nullptr),
|
||||
|
@ -233,26 +233,26 @@ MeshLoader::MeshLoader(Vertex *triangleVertices, int vertexNum) :
|
|||
{
|
||||
}
|
||||
|
||||
MeshLoader::MeshLoader(MeshResultContext &resultContext) :
|
||||
MeshLoader::MeshLoader(Outcome &outcome) :
|
||||
m_triangleVertices(nullptr),
|
||||
m_triangleVertexCount(0),
|
||||
m_edgeVertices(nullptr),
|
||||
m_edgeVertexCount(0),
|
||||
m_textureImage(nullptr)
|
||||
{
|
||||
for (const auto &part: resultContext.parts()) {
|
||||
for (const auto &part: outcome.parts()) {
|
||||
m_triangleVertexCount += part.second.triangles.size() * 3;
|
||||
}
|
||||
m_triangleVertices = new Vertex[m_triangleVertexCount];
|
||||
int destIndex = 0;
|
||||
for (const auto &part: resultContext.parts()) {
|
||||
for (const auto &part: outcome.parts()) {
|
||||
for (int x = 0; x < (int)part.second.triangles.size(); x++) {
|
||||
const auto &it = part.second.triangles[x];
|
||||
for (auto i = 0; i < 3; i++) {
|
||||
int vertexIndex = it.indicies[i];
|
||||
const ResultVertex *srcVert = &part.second.vertices[vertexIndex];
|
||||
const OutcomeVertex *srcVert = &part.second.vertices[vertexIndex];
|
||||
const QVector3D *srcNormal = &part.second.interpolatedTriangleVertexNormals[x * 3 + i];
|
||||
const ResultVertexUv *srcUv = &part.second.vertexUvs[vertexIndex];
|
||||
const OutcomeVertexUv *srcUv = &part.second.vertexUvs[vertexIndex];
|
||||
//const Material *srcMaterial = &part.second.material;
|
||||
const QVector3D *srcTangent = &part.second.triangleTangents[x];
|
||||
Vertex *dest = &m_triangleVertices[destIndex];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MESH_LOADER_H
|
||||
#define MESH_LOADER_H
|
||||
#ifndef DUST3D_MESH_LOADER_H
|
||||
#define DUST3D_MESH_LOADER_H
|
||||
#include <QObject>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <vector>
|
||||
|
@ -9,7 +9,7 @@
|
|||
#include "positionmap.h"
|
||||
#include "theme.h"
|
||||
#include "qtlightmapper.h"
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
@ -43,8 +43,8 @@ struct TriangulatedFace
|
|||
class MeshLoader
|
||||
{
|
||||
public:
|
||||
MeshLoader(void *meshlite, int meshId, int triangulatedMeshId=-1, QColor defaultColor=Theme::white, const std::vector<Material> *triangleMaterials=nullptr, bool smoothNormal=true);
|
||||
MeshLoader(MeshResultContext &resultContext);
|
||||
MeshLoader(void *meshlite, int meshId, int triangulatedMeshId=-1, QColor defaultColor=Theme::white, const std::vector<OutcomeMaterial> *triangleMaterials=nullptr, bool smoothNormal=true);
|
||||
MeshLoader(Outcome &outcome);
|
||||
MeshLoader(Vertex *triangleVertices, int vertexNum);
|
||||
MeshLoader(const MeshLoader &mesh);
|
||||
MeshLoader();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MESH_QUADIFY_H
|
||||
#define MESH_QUADIFY_H
|
||||
#ifndef DUST3D_MESH_QUADIFY_H
|
||||
#define DUST3D_MESH_QUADIFY_H
|
||||
#include <set>
|
||||
#include "meshutil.h"
|
||||
#include "positionmap.h"
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
#include <QGuiApplication>
|
||||
#include "meshresultpostprocessor.h"
|
||||
|
||||
MeshResultPostProcessor::MeshResultPostProcessor(const MeshResultContext &meshResultContext)
|
||||
MeshResultPostProcessor::MeshResultPostProcessor(const Outcome &outcome)
|
||||
{
|
||||
m_meshResultContext = new MeshResultContext;
|
||||
*m_meshResultContext = meshResultContext;
|
||||
m_outcome = new Outcome;
|
||||
*m_outcome = outcome;
|
||||
}
|
||||
|
||||
MeshResultPostProcessor::~MeshResultPostProcessor()
|
||||
{
|
||||
delete m_meshResultContext;
|
||||
delete m_outcome;
|
||||
}
|
||||
|
||||
MeshResultContext *MeshResultPostProcessor::takePostProcessedResultContext()
|
||||
Outcome *MeshResultPostProcessor::takePostProcessedResultContext()
|
||||
{
|
||||
MeshResultContext *resultContext = m_meshResultContext;
|
||||
m_meshResultContext = nullptr;
|
||||
return resultContext;
|
||||
Outcome *outcome = m_outcome;
|
||||
m_outcome = nullptr;
|
||||
return outcome;
|
||||
}
|
||||
|
||||
void MeshResultPostProcessor::process()
|
||||
{
|
||||
if (!m_meshResultContext->bmeshNodes.empty()) {
|
||||
(void)m_meshResultContext->triangleTangents();
|
||||
(void)m_meshResultContext->parts();
|
||||
if (!m_outcome->bmeshNodes.empty()) {
|
||||
(void)m_outcome->triangleTangents();
|
||||
(void)m_outcome->parts();
|
||||
}
|
||||
|
||||
this->moveToThread(QGuiApplication::instance()->thread());
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#ifndef MESH_RESULT_POST_PROCESSOR_H
|
||||
#define MESH_RESULT_POST_PROCESSOR_H
|
||||
#ifndef DUST3D_MESH_RESULT_POST_PROCESSOR_H
|
||||
#define DUST3D_MESH_RESULT_POST_PROCESSOR_H
|
||||
#include <QObject>
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
|
||||
class MeshResultPostProcessor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MeshResultPostProcessor(const MeshResultContext &meshResultContext);
|
||||
MeshResultPostProcessor(const Outcome &outcome);
|
||||
~MeshResultPostProcessor();
|
||||
MeshResultContext *takePostProcessedResultContext();
|
||||
Outcome *takePostProcessedResultContext();
|
||||
signals:
|
||||
void finished();
|
||||
public slots:
|
||||
void process();
|
||||
private:
|
||||
MeshResultContext *m_meshResultContext = nullptr;
|
||||
Outcome *m_outcome = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MESH_SPLITTER_H
|
||||
#define MESH_SPLITTER_H
|
||||
#ifndef DUST3D_MESH_SPLITTER_H
|
||||
#define DUST3D_MESH_SPLITTER_H
|
||||
#include <set>
|
||||
|
||||
class MeshSplitterTriangle
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MESH_UTIL_H
|
||||
#define MESH_UTIL_H
|
||||
#ifndef DUST3D_MESH_UTIL_H
|
||||
#define DUST3D_MESH_UTIL_H
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <QVector3D>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MESH_WELD_SEAM_H
|
||||
#define MESH_WELD_SEAM_H
|
||||
#ifndef DUST3D_MESH_WELD_SEAM_H
|
||||
#define DUST3D_MESH_WELD_SEAM_H
|
||||
#include "meshlite.h"
|
||||
#include "positionmap.h"
|
||||
#include <unordered_set>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MODEL_MESH_BINDER_H
|
||||
#define MODEL_MESH_BINDER_H
|
||||
#ifndef DUST3D_MODEL_MESH_BINDER_H
|
||||
#define DUST3D_MODEL_MESH_BINDER_H
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QMutex>
|
||||
#include <QOpenGLBuffer>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MODEL_SHADER_PROGRAM_H
|
||||
#define MODEL_SHADER_PROGRAM_H
|
||||
#ifndef DUST3D_MODEL_SHADER_PROGRAM_H
|
||||
#define DUST3D_MODEL_SHADER_PROGRAM_H
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QString>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <QGuiApplication>
|
||||
#include <math.h>
|
||||
#include "modelwidget.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
// Modifed from http://doc.qt.io/qt-5/qtopengl-hellogl2-glwidget-cpp.html
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MODEL_WIDGET_H
|
||||
#define MODEL_WIDGET_H
|
||||
#ifndef DUST3D_MODEL_WIDGET_H
|
||||
#define DUST3D_MODEL_WIDGET_H
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "posewidget.h"
|
||||
#include "motionwidget.h"
|
||||
|
||||
MotionClipWidget::MotionClipWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MotionClipWidget::MotionClipWidget(const Document *document, QWidget *parent) :
|
||||
QFrame(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -17,13 +17,13 @@ QSize MotionClipWidget::preferredSize()
|
|||
{
|
||||
int preferredWidth = 0;
|
||||
switch (m_clip.clipType) {
|
||||
case SkeletonMotionClipType::Motion:
|
||||
case MotionClipType::Motion:
|
||||
preferredWidth = Theme::motionPreviewImageSize;
|
||||
break;
|
||||
case SkeletonMotionClipType::Pose:
|
||||
case MotionClipType::Pose:
|
||||
preferredWidth = Theme::posePreviewImageSize;
|
||||
break;
|
||||
case SkeletonMotionClipType::Interpolation:
|
||||
case MotionClipType::Interpolation:
|
||||
preferredWidth = Theme::normalButtonSize;
|
||||
break;
|
||||
default:
|
||||
|
@ -39,7 +39,7 @@ QSize MotionClipWidget::maxSize()
|
|||
return QSize(maxWidth, maxHeight);
|
||||
}
|
||||
|
||||
void MotionClipWidget::setClip(SkeletonMotionClip clip)
|
||||
void MotionClipWidget::setClip(MotionClip clip)
|
||||
{
|
||||
m_clip = clip;
|
||||
reload();
|
||||
|
@ -60,21 +60,21 @@ void MotionClipWidget::reload()
|
|||
layout->addStretch();
|
||||
|
||||
switch (m_clip.clipType) {
|
||||
case SkeletonMotionClipType::Motion:
|
||||
case MotionClipType::Motion:
|
||||
{
|
||||
MotionWidget *motionWidget = new MotionWidget(m_document, m_clip.linkToId);
|
||||
motionWidget->reload();
|
||||
layout->addWidget(motionWidget);
|
||||
}
|
||||
break;
|
||||
case SkeletonMotionClipType::Pose:
|
||||
case MotionClipType::Pose:
|
||||
{
|
||||
PoseWidget *poseWidget = new PoseWidget(m_document, m_clip.linkToId);
|
||||
poseWidget->reload();
|
||||
layout->addWidget(poseWidget);
|
||||
}
|
||||
break;
|
||||
case SkeletonMotionClipType::Interpolation:
|
||||
case MotionClipType::Interpolation:
|
||||
{
|
||||
QHBoxLayout *interpolationButtonLayout = new QHBoxLayout;
|
||||
QPushButton *interpolationButton = new QPushButton(QChar(fa::arrowsh));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MOTION_CLIP_WIDGET_H
|
||||
#define MOTION_CLIP_WIDGET_H
|
||||
#ifndef DUST3D_MOTION_CLIP_WIDGET_H
|
||||
#define DUST3D_MOTION_CLIP_WIDGET_H
|
||||
#include <QFrame>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class MotionClipWidget : public QFrame
|
||||
{
|
||||
|
@ -10,18 +10,18 @@ signals:
|
|||
void modifyInterpolation();
|
||||
|
||||
public:
|
||||
MotionClipWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MotionClipWidget(const Document *document, QWidget *parent=nullptr);
|
||||
QSize preferredSize();
|
||||
static QSize maxSize();
|
||||
|
||||
public slots:
|
||||
void setClip(SkeletonMotionClip clip);
|
||||
void setClip(MotionClip clip);
|
||||
void reload();
|
||||
void updateCheckedState(bool checked);
|
||||
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
SkeletonMotionClip m_clip;
|
||||
const Document *m_document = nullptr;
|
||||
MotionClip m_clip;
|
||||
QWidget *m_reloadToWidget = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#include <QDebug>
|
||||
#include <QStackedWidget>
|
||||
#include "motioneditwidget.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
#include "poselistwidget.h"
|
||||
#include "motionlistwidget.h"
|
||||
#include "version.h"
|
||||
#include "tabwidget.h"
|
||||
|
||||
MotionEditWidget::MotionEditWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MotionEditWidget::MotionEditWidget(const Document *document, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -130,9 +130,9 @@ MotionEditWidget::MotionEditWidget(const SkeletonDocument *document, QWidget *pa
|
|||
|
||||
setLayout(mainLayout);
|
||||
|
||||
connect(this, &MotionEditWidget::addMotion, m_document, &SkeletonDocument::addMotion);
|
||||
connect(this, &MotionEditWidget::renameMotion, m_document, &SkeletonDocument::renameMotion);
|
||||
connect(this, &MotionEditWidget::setMotionClips, m_document, &SkeletonDocument::setMotionClips);
|
||||
connect(this, &MotionEditWidget::addMotion, m_document, &Document::addMotion);
|
||||
connect(this, &MotionEditWidget::renameMotion, m_document, &Document::renameMotion);
|
||||
connect(this, &MotionEditWidget::setMotionClips, m_document, &Document::setMotionClips);
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ void MotionEditWidget::updateTitle()
|
|||
setWindowTitle(unifiedWindowTitle(tr("New") + (m_unsaved ? "*" : "")));
|
||||
return;
|
||||
}
|
||||
const SkeletonMotion *motion = m_document->findMotion(m_motionId);
|
||||
const Motion *motion = m_document->findMotion(m_motionId);
|
||||
if (nullptr == motion) {
|
||||
qDebug() << "Find motion failed:" << m_motionId;
|
||||
return;
|
||||
|
@ -226,7 +226,7 @@ void MotionEditWidget::updateTitle()
|
|||
setWindowTitle(unifiedWindowTitle(motion->name + (m_unsaved ? "*" : "")));
|
||||
}
|
||||
|
||||
void MotionEditWidget::setEditMotionClips(std::vector<SkeletonMotionClip> clips)
|
||||
void MotionEditWidget::setEditMotionClips(std::vector<MotionClip> clips)
|
||||
{
|
||||
m_timelineWidget->setClips(clips);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MOTION_EDIT_WIDGET_H
|
||||
#define MOTION_EDIT_WIDGET_H
|
||||
#ifndef DUST3D_MOTION_EDIT_WIDGET_H
|
||||
#define DUST3D_MOTION_EDIT_WIDGET_H
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QCloseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "motiontimelinewidget.h"
|
||||
#include "modelwidget.h"
|
||||
#include "motionsgenerator.h"
|
||||
|
@ -13,11 +13,11 @@ class MotionEditWidget : public QDialog
|
|||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void addMotion(QString name, std::vector<SkeletonMotionClip> clips);
|
||||
void setMotionClips(QUuid motionId, std::vector<SkeletonMotionClip> clips);
|
||||
void addMotion(QString name, std::vector<MotionClip> clips);
|
||||
void setMotionClips(QUuid motionId, std::vector<MotionClip> clips);
|
||||
void renameMotion(QUuid motionId, QString name);
|
||||
public:
|
||||
MotionEditWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MotionEditWidget(const Document *document, QWidget *parent=nullptr);
|
||||
~MotionEditWidget();
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
@ -29,12 +29,12 @@ public slots:
|
|||
void clearUnsaveState();
|
||||
void setEditMotionId(QUuid poseId);
|
||||
void setEditMotionName(QString name);
|
||||
void setEditMotionClips(std::vector<SkeletonMotionClip> clips);
|
||||
void setEditMotionClips(std::vector<MotionClip> clips);
|
||||
void setUnsavedState();
|
||||
void generatePreviews();
|
||||
void previewsReady();
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
MotionTimelineWidget *m_timelineWidget = nullptr;
|
||||
ModelWidget *m_previewWidget = nullptr;
|
||||
QUuid m_motionId;
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include <QXmlStreamWriter>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include "skeletonxml.h"
|
||||
#include "snapshotxml.h"
|
||||
#include "motionlistwidget.h"
|
||||
|
||||
MotionListWidget::MotionListWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MotionListWidget::MotionListWidget(const Document *document, QWidget *parent) :
|
||||
QTreeWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ MotionListWidget::MotionListWidget(const SkeletonDocument *document, QWidget *pa
|
|||
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
connect(document, &SkeletonDocument::motionListChanged, this, &MotionListWidget::reload);
|
||||
connect(document, &SkeletonDocument::cleanup, this, &MotionListWidget::removeAllContent);
|
||||
connect(document, &Document::motionListChanged, this, &MotionListWidget::reload);
|
||||
connect(document, &Document::cleanup, this, &MotionListWidget::removeAllContent);
|
||||
|
||||
connect(this, &MotionListWidget::removeMotion, document, &SkeletonDocument::removeMotion);
|
||||
connect(this, &MotionListWidget::removeMotion, document, &Document::removeMotion);
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &QTreeWidget::customContextMenuRequested, this, &MotionListWidget::showContextMenu);
|
||||
|
@ -190,7 +190,7 @@ void MotionListWidget::showContextMenu(const QPoint &pos)
|
|||
|
||||
QAction pasteAction(tr("Paste"), this);
|
||||
if (m_document->hasPastableMotionsInClipboard()) {
|
||||
connect(&pasteAction, &QAction::triggered, m_document, &SkeletonDocument::paste);
|
||||
connect(&pasteAction, &QAction::triggered, m_document, &Document::paste);
|
||||
contextMenu.addAction(&pasteAction);
|
||||
}
|
||||
|
||||
|
@ -287,8 +287,8 @@ void MotionListWidget::copy()
|
|||
|
||||
std::set<QUuid> emptySet;
|
||||
|
||||
SkeletonSnapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot, emptySet, SkeletonDocumentToSnapshotFor::Motions,
|
||||
Snapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot, emptySet, DocumentToSnapshotFor::Motions,
|
||||
emptySet, limitMotionIds);
|
||||
QString snapshotXml;
|
||||
QXmlStreamWriter xmlStreamWriter(&snapshotXml);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MOTION_LIST_WIDGET_H
|
||||
#define MOTION_LIST_WIDGET_H
|
||||
#ifndef DUST3D_MOTION_LIST_WIDGET_H
|
||||
#define DUST3D_MOTION_LIST_WIDGET_H
|
||||
#include <QTreeWidget>
|
||||
#include <map>
|
||||
#include <QMouseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "motionwidget.h"
|
||||
|
||||
class MotionListWidget : public QTreeWidget
|
||||
|
@ -14,7 +14,7 @@ signals:
|
|||
void modifyMotion(QUuid motionId);
|
||||
void cornerButtonClicked(QUuid motionId);
|
||||
public:
|
||||
MotionListWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MotionListWidget(const Document *document, QWidget *parent=nullptr);
|
||||
bool isMotionSelected(QUuid motionId);
|
||||
public slots:
|
||||
void reload();
|
||||
|
@ -31,7 +31,7 @@ protected:
|
|||
private:
|
||||
int calculateColumnCount();
|
||||
void updateMotionSelectState(QUuid motionId, bool selected);
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
std::map<QUuid, std::pair<QTreeWidgetItem *, int>> m_itemMap;
|
||||
std::set<QUuid> m_selectedMotionIds;
|
||||
QUuid m_currentSelectedMotionId;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "theme.h"
|
||||
#include "infolabel.h"
|
||||
|
||||
MotionManageWidget::MotionManageWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MotionManageWidget::MotionManageWidget(const Document *document, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -35,8 +35,8 @@ MotionManageWidget::MotionManageWidget(const SkeletonDocument *document, QWidget
|
|||
}
|
||||
};
|
||||
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, this, refreshInfoLabel);
|
||||
connect(m_document, &SkeletonDocument::cleanup, this, refreshInfoLabel);
|
||||
connect(m_document, &Document::resultRigChanged, this, refreshInfoLabel);
|
||||
connect(m_document, &Document::cleanup, this, refreshInfoLabel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(infoLabel);
|
||||
|
@ -61,7 +61,7 @@ void MotionManageWidget::showMotionDialog(QUuid motionId)
|
|||
MotionEditWidget *motionEditWidget = new MotionEditWidget(m_document);
|
||||
motionEditWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
if (!motionId.isNull()) {
|
||||
const SkeletonMotion *motion = m_document->findMotion(motionId);
|
||||
const Motion *motion = m_document->findMotion(motionId);
|
||||
if (nullptr != motion) {
|
||||
motionEditWidget->setEditMotionId(motionId);
|
||||
motionEditWidget->setEditMotionName(motion->name);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MOTION_MANAGE_WIDGET_H
|
||||
#define MOTION_MANAGE_WIDGET_H
|
||||
#ifndef DUST3D_MOTION_MANAGE_WIDGET_H
|
||||
#define DUST3D_MOTION_MANAGE_WIDGET_H
|
||||
#include <QWidget>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "motionlistwidget.h"
|
||||
|
||||
class MotionManageWidget : public QWidget
|
||||
|
@ -11,14 +11,14 @@ signals:
|
|||
void registerDialog(QWidget *widget);
|
||||
void unregisterDialog(QWidget *widget);
|
||||
public:
|
||||
MotionManageWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
MotionManageWidget(const Document *document, QWidget *parent=nullptr);
|
||||
protected:
|
||||
virtual QSize sizeHint() const;
|
||||
public slots:
|
||||
void showAddMotionDialog();
|
||||
void showMotionDialog(QUuid motionId);
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
MotionListWidget *m_motionListWidget = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
MotionsGenerator::MotionsGenerator(const std::vector<AutoRiggerBone> *rigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *rigWeights,
|
||||
const MeshResultContext &meshResultContext) :
|
||||
const Outcome &outcome) :
|
||||
m_rigBones(*rigBones),
|
||||
m_rigWeights(*rigWeights),
|
||||
m_meshResultContext(meshResultContext)
|
||||
m_outcome(outcome)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ void MotionsGenerator::addPoseToLibrary(const QUuid &poseId, const std::map<QStr
|
|||
m_poses[poseId] = parameters;
|
||||
}
|
||||
|
||||
void MotionsGenerator::addMotionToLibrary(const QUuid &motionId, const std::vector<SkeletonMotionClip> &clips)
|
||||
void MotionsGenerator::addMotionToLibrary(const QUuid &motionId, const std::vector<MotionClip> &clips)
|
||||
{
|
||||
m_motions[motionId] = clips;
|
||||
}
|
||||
|
@ -49,19 +49,19 @@ const std::set<QUuid> &MotionsGenerator::generatedMotionIds()
|
|||
return m_generatedMotionIds;
|
||||
}
|
||||
|
||||
std::vector<SkeletonMotionClip> *MotionsGenerator::findMotionClips(const QUuid &motionId)
|
||||
std::vector<MotionClip> *MotionsGenerator::findMotionClips(const QUuid &motionId)
|
||||
{
|
||||
auto findMotionResult = m_motions.find(motionId);
|
||||
if (findMotionResult == m_motions.end())
|
||||
return nullptr;
|
||||
std::vector<SkeletonMotionClip> &clips = findMotionResult->second;
|
||||
std::vector<MotionClip> &clips = findMotionResult->second;
|
||||
return &clips;
|
||||
}
|
||||
|
||||
void MotionsGenerator::generatePreviewsForOutcomes(const std::vector<std::pair<float, JointNodeTree>> &outcomes, std::vector<std::pair<float, MeshLoader *>> &previews)
|
||||
{
|
||||
for (const auto &item: outcomes) {
|
||||
PoseMeshCreator *poseMeshCreator = new PoseMeshCreator(item.second.nodes(), m_meshResultContext, m_rigWeights);
|
||||
PoseMeshCreator *poseMeshCreator = new PoseMeshCreator(item.second.nodes(), m_outcome, m_rigWeights);
|
||||
poseMeshCreator->createMesh();
|
||||
previews.push_back({item.first, poseMeshCreator->takeResultMesh()});
|
||||
delete poseMeshCreator;
|
||||
|
@ -70,7 +70,7 @@ void MotionsGenerator::generatePreviewsForOutcomes(const std::vector<std::pair<f
|
|||
|
||||
float MotionsGenerator::calculateMotionDuration(const QUuid &motionId, std::set<QUuid> &visited)
|
||||
{
|
||||
const std::vector<SkeletonMotionClip> *motionClips = findMotionClips(motionId);
|
||||
const std::vector<MotionClip> *motionClips = findMotionClips(motionId);
|
||||
if (!motionClips || motionClips->empty())
|
||||
return 0;
|
||||
if (visited.find(motionId) != visited.end()) {
|
||||
|
@ -80,11 +80,11 @@ float MotionsGenerator::calculateMotionDuration(const QUuid &motionId, std::set<
|
|||
float totalDuration = 0;
|
||||
visited.insert(motionId);
|
||||
for (const auto &clip: *motionClips) {
|
||||
if (clip.clipType == SkeletonMotionClipType::Interpolation)
|
||||
if (clip.clipType == MotionClipType::Interpolation)
|
||||
totalDuration += clip.duration;
|
||||
else if (clip.clipType == SkeletonMotionClipType::Pose)
|
||||
else if (clip.clipType == MotionClipType::Pose)
|
||||
totalDuration += clip.duration;
|
||||
else if (clip.clipType == SkeletonMotionClipType::Motion)
|
||||
else if (clip.clipType == MotionClipType::Motion)
|
||||
totalDuration += calculateMotionDuration(clip.linkToId, visited);
|
||||
}
|
||||
return totalDuration;
|
||||
|
@ -99,14 +99,14 @@ void MotionsGenerator::generateMotion(const QUuid &motionId, std::set<QUuid> &vi
|
|||
|
||||
visited.insert(motionId);
|
||||
|
||||
std::vector<SkeletonMotionClip> *motionClips = findMotionClips(motionId);
|
||||
std::vector<MotionClip> *motionClips = findMotionClips(motionId);
|
||||
if (!motionClips || motionClips->empty())
|
||||
return;
|
||||
|
||||
std::vector<float> timePoints;
|
||||
float totalDuration = 0;
|
||||
for (auto &clip: *motionClips) {
|
||||
if (clip.clipType == SkeletonMotionClipType::Motion) {
|
||||
if (clip.clipType == MotionClipType::Motion) {
|
||||
std::set<QUuid> subVisited;
|
||||
clip.duration = calculateMotionDuration(clip.linkToId, subVisited);
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ void MotionsGenerator::generateMotion(const QUuid &motionId, std::set<QUuid> &vi
|
|||
break;
|
||||
}
|
||||
float clipLocalProgress = progress - timePoints[clipIndex];
|
||||
const SkeletonMotionClip &progressClip = (*motionClips)[clipIndex];
|
||||
if (SkeletonMotionClipType::Interpolation == progressClip.clipType) {
|
||||
const MotionClip &progressClip = (*motionClips)[clipIndex];
|
||||
if (MotionClipType::Interpolation == progressClip.clipType) {
|
||||
if (clipIndex <= 0) {
|
||||
qDebug() << "Clip type is interpolation, but clip sit at begin";
|
||||
break;
|
||||
|
@ -156,7 +156,7 @@ void MotionsGenerator::generateMotion(const QUuid &motionId, std::set<QUuid> &vi
|
|||
lastProgress = progress;
|
||||
progress += interval;
|
||||
continue;
|
||||
} else if (SkeletonMotionClipType::Pose == progressClip.clipType) {
|
||||
} else if (MotionClipType::Pose == progressClip.clipType) {
|
||||
const JointNodeTree *beginJointNodeTree = findClipBeginJointNodeTree((*motionClips)[clipIndex]);
|
||||
if (nullptr == beginJointNodeTree) {
|
||||
qDebug() << "findClipBeginJointNodeTree failed";
|
||||
|
@ -166,7 +166,7 @@ void MotionsGenerator::generateMotion(const QUuid &motionId, std::set<QUuid> &vi
|
|||
lastProgress = progress;
|
||||
progress += interval;
|
||||
continue;
|
||||
} else if (SkeletonMotionClipType::Motion == progressClip.clipType) {
|
||||
} else if (MotionClipType::Motion == progressClip.clipType) {
|
||||
generateMotion(progressClip.linkToId, visited, outcomes);
|
||||
progress += progressClip.duration;
|
||||
continue;
|
||||
|
@ -193,13 +193,13 @@ const JointNodeTree &MotionsGenerator::poseJointNodeTree(const QUuid &poseId)
|
|||
return insertResult.first->second;
|
||||
}
|
||||
|
||||
const JointNodeTree *MotionsGenerator::findClipBeginJointNodeTree(const SkeletonMotionClip &clip)
|
||||
const JointNodeTree *MotionsGenerator::findClipBeginJointNodeTree(const MotionClip &clip)
|
||||
{
|
||||
if (SkeletonMotionClipType::Pose == clip.clipType) {
|
||||
if (MotionClipType::Pose == clip.clipType) {
|
||||
const JointNodeTree &jointNodeTree = poseJointNodeTree(clip.linkToId);
|
||||
return &jointNodeTree;
|
||||
} else if (SkeletonMotionClipType::Motion == clip.clipType) {
|
||||
const std::vector<SkeletonMotionClip> *motionClips = findMotionClips(clip.linkToId);
|
||||
} else if (MotionClipType::Motion == clip.clipType) {
|
||||
const std::vector<MotionClip> *motionClips = findMotionClips(clip.linkToId);
|
||||
if (nullptr != motionClips && !motionClips->empty()) {
|
||||
return findClipBeginJointNodeTree((*motionClips)[0]);
|
||||
}
|
||||
|
@ -208,13 +208,13 @@ const JointNodeTree *MotionsGenerator::findClipBeginJointNodeTree(const Skeleton
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const JointNodeTree *MotionsGenerator::findClipEndJointNodeTree(const SkeletonMotionClip &clip)
|
||||
const JointNodeTree *MotionsGenerator::findClipEndJointNodeTree(const MotionClip &clip)
|
||||
{
|
||||
if (SkeletonMotionClipType::Pose == clip.clipType) {
|
||||
if (MotionClipType::Pose == clip.clipType) {
|
||||
const JointNodeTree &jointNodeTree = poseJointNodeTree(clip.linkToId);
|
||||
return &jointNodeTree;
|
||||
} else if (SkeletonMotionClipType::Motion == clip.clipType) {
|
||||
const std::vector<SkeletonMotionClip> *motionClips = findMotionClips(clip.linkToId);
|
||||
} else if (MotionClipType::Motion == clip.clipType) {
|
||||
const std::vector<MotionClip> *motionClips = findMotionClips(clip.linkToId);
|
||||
if (nullptr != motionClips && !motionClips->empty()) {
|
||||
return findClipEndJointNodeTree((*motionClips)[motionClips->size() - 1]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MOTIONS_GENERATOR_H
|
||||
#define MOTIONS_GENERATOR_H
|
||||
#ifndef DUST3D_MOTIONS_GENERATOR_H
|
||||
#define DUST3D_MOTIONS_GENERATOR_H
|
||||
#include <QObject>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
@ -7,7 +7,7 @@
|
|||
#include "meshloader.h"
|
||||
#include "autorigger.h"
|
||||
#include "jointnodetree.h"
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "tetrapodposer.h"
|
||||
|
||||
class MotionsGenerator : public QObject
|
||||
|
@ -16,10 +16,10 @@ class MotionsGenerator : public QObject
|
|||
public:
|
||||
MotionsGenerator(const std::vector<AutoRiggerBone> *rigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *rigWeights,
|
||||
const MeshResultContext &meshResultContext);
|
||||
const Outcome &outcome);
|
||||
~MotionsGenerator();
|
||||
void addPoseToLibrary(const QUuid &poseId, const std::map<QString, std::map<QString, QString>> ¶meters);
|
||||
void addMotionToLibrary(const QUuid &motionId, const std::vector<SkeletonMotionClip> &clips);
|
||||
void addMotionToLibrary(const QUuid &motionId, const std::vector<MotionClip> &clips);
|
||||
void addRequirement(const QUuid &motionId);
|
||||
std::vector<std::pair<float, MeshLoader *>> takeResultPreviewMeshs(const QUuid &motionId);
|
||||
std::vector<std::pair<float, JointNodeTree>> takeResultJointNodeTrees(const QUuid &motionId);
|
||||
|
@ -36,17 +36,17 @@ private:
|
|||
void generateMotion(const QUuid &motionId, std::set<QUuid> &visited, std::vector<std::pair<float, JointNodeTree>> &outcomes);
|
||||
const JointNodeTree &poseJointNodeTree(const QUuid &poseId);
|
||||
JointNodeTree generateInterpolation(InterpolationType interpolationType, const JointNodeTree &first, const JointNodeTree &second, float progress);
|
||||
const JointNodeTree *findClipBeginJointNodeTree(const SkeletonMotionClip &clip);
|
||||
const JointNodeTree *findClipEndJointNodeTree(const SkeletonMotionClip &clip);
|
||||
std::vector<SkeletonMotionClip> *findMotionClips(const QUuid &motionId);
|
||||
const JointNodeTree *findClipBeginJointNodeTree(const MotionClip &clip);
|
||||
const JointNodeTree *findClipEndJointNodeTree(const MotionClip &clip);
|
||||
std::vector<MotionClip> *findMotionClips(const QUuid &motionId);
|
||||
void generatePreviewsForOutcomes(const std::vector<std::pair<float, JointNodeTree>> &outcomes, std::vector<std::pair<float, MeshLoader *>> &previews);
|
||||
float calculateMotionDuration(const QUuid &motionId, std::set<QUuid> &visited);
|
||||
|
||||
std::vector<AutoRiggerBone> m_rigBones;
|
||||
std::map<int, AutoRiggerVertexWeights> m_rigWeights;
|
||||
MeshResultContext m_meshResultContext;
|
||||
Outcome m_outcome;
|
||||
std::map<QUuid, std::map<QString, std::map<QString, QString>>> m_poses;
|
||||
std::map<QUuid, std::vector<SkeletonMotionClip>> m_motions;
|
||||
std::map<QUuid, std::vector<MotionClip>> m_motions;
|
||||
std::set<QUuid> m_requiredMotionIds;
|
||||
std::set<QUuid> m_generatedMotionIds;
|
||||
std::map<QUuid, std::vector<std::pair<float, MeshLoader *>>> m_resultPreviewMeshs;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "posewidget.h"
|
||||
#include "motionwidget.h"
|
||||
|
||||
MotionTimelineWidget::MotionTimelineWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
MotionTimelineWidget::MotionTimelineWidget(const Document *document, QWidget *parent) :
|
||||
QListWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -39,12 +39,12 @@ QSize MotionTimelineWidget::sizeHint() const
|
|||
return QSize(0, MotionClipWidget::maxSize().height() + 4);
|
||||
}
|
||||
|
||||
const std::vector<SkeletonMotionClip> &MotionTimelineWidget::clips()
|
||||
const std::vector<MotionClip> &MotionTimelineWidget::clips()
|
||||
{
|
||||
return m_clips;
|
||||
}
|
||||
|
||||
void MotionTimelineWidget::setClips(std::vector<SkeletonMotionClip> clips)
|
||||
void MotionTimelineWidget::setClips(std::vector<MotionClip> clips)
|
||||
{
|
||||
m_clips = clips;
|
||||
if (m_currentSelectedIndex >= (int)m_clips.size())
|
||||
|
@ -54,38 +54,38 @@ void MotionTimelineWidget::setClips(std::vector<SkeletonMotionClip> clips)
|
|||
|
||||
void MotionTimelineWidget::addPose(QUuid poseId)
|
||||
{
|
||||
SkeletonMotionClip clip;
|
||||
MotionClip clip;
|
||||
clip.linkToId = poseId;
|
||||
clip.clipType = SkeletonMotionClipType::Pose;
|
||||
clip.clipType = MotionClipType::Pose;
|
||||
clip.duration = 0;
|
||||
addClipAfterCurrentIndex(clip);
|
||||
emit clipsChanged();
|
||||
reload();
|
||||
}
|
||||
|
||||
void MotionTimelineWidget::addClipAfterCurrentIndex(const SkeletonMotionClip &clip)
|
||||
void MotionTimelineWidget::addClipAfterCurrentIndex(const MotionClip &clip)
|
||||
{
|
||||
SkeletonMotionClip interpolationClip;
|
||||
MotionClip interpolationClip;
|
||||
bool needPrependInterpolationClip = false;
|
||||
int afterIndex = m_currentSelectedIndex;
|
||||
if (-1 == afterIndex)
|
||||
afterIndex = m_clips.size() - 1;
|
||||
|
||||
if (-1 != afterIndex) {
|
||||
if (m_clips[afterIndex].clipType == SkeletonMotionClipType::Interpolation) {
|
||||
if (m_clips[afterIndex].clipType == MotionClipType::Interpolation) {
|
||||
--afterIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip.clipType == SkeletonMotionClipType::Interpolation) {
|
||||
if (clip.clipType == MotionClipType::Interpolation) {
|
||||
if (m_clips.empty())
|
||||
return;
|
||||
if (m_clips[m_clips.size() - 1].clipType == SkeletonMotionClipType::Interpolation)
|
||||
if (m_clips[m_clips.size() - 1].clipType == MotionClipType::Interpolation)
|
||||
return;
|
||||
} else {
|
||||
if (!m_clips.empty() && m_clips[m_clips.size() - 1].clipType != SkeletonMotionClipType::Interpolation) {
|
||||
if (!m_clips.empty() && m_clips[m_clips.size() - 1].clipType != MotionClipType::Interpolation) {
|
||||
interpolationClip.interpolationType = InterpolationType::EaseInOutCubic;
|
||||
interpolationClip.clipType = SkeletonMotionClipType::Interpolation;
|
||||
interpolationClip.clipType = MotionClipType::Interpolation;
|
||||
interpolationClip.duration = 1.0;
|
||||
needPrependInterpolationClip = true;
|
||||
}
|
||||
|
@ -104,9 +104,9 @@ void MotionTimelineWidget::addClipAfterCurrentIndex(const SkeletonMotionClip &cl
|
|||
|
||||
void MotionTimelineWidget::addMotion(QUuid motionId)
|
||||
{
|
||||
SkeletonMotionClip clip;
|
||||
MotionClip clip;
|
||||
clip.linkToId = motionId;
|
||||
clip.clipType = SkeletonMotionClipType::Motion;
|
||||
clip.clipType = MotionClipType::Motion;
|
||||
clip.duration = 0;
|
||||
addClipAfterCurrentIndex(clip);
|
||||
emit clipsChanged();
|
||||
|
@ -118,7 +118,7 @@ void MotionTimelineWidget::setClipInterpolationType(int index, InterpolationType
|
|||
if (index >= (int)m_clips.size())
|
||||
return;
|
||||
|
||||
if (m_clips[index].clipType != SkeletonMotionClipType::Interpolation)
|
||||
if (m_clips[index].clipType != MotionClipType::Interpolation)
|
||||
return;
|
||||
|
||||
m_clips[index].interpolationType = type;
|
||||
|
@ -130,7 +130,7 @@ void MotionTimelineWidget::setClipDuration(int index, float duration)
|
|||
if (index >= (int)m_clips.size())
|
||||
return;
|
||||
|
||||
if (m_clips[index].clipType == SkeletonMotionClipType::Motion)
|
||||
if (m_clips[index].clipType == MotionClipType::Motion)
|
||||
return;
|
||||
|
||||
m_clips[index].duration = duration;
|
||||
|
@ -284,7 +284,7 @@ void MotionTimelineWidget::showContextMenu(const QPoint &pos)
|
|||
|
||||
QAction doubleDurationAction(tr("Double Duration"), this);
|
||||
if (-1 != m_currentSelectedIndex) {
|
||||
if (m_clips[m_currentSelectedIndex].clipType == SkeletonMotionClipType::Interpolation) {
|
||||
if (m_clips[m_currentSelectedIndex].clipType == MotionClipType::Interpolation) {
|
||||
connect(&doubleDurationAction, &QAction::triggered, [=]() {
|
||||
setClipDuration(m_currentSelectedIndex, m_clips[m_currentSelectedIndex].duration * 2);
|
||||
});
|
||||
|
@ -294,7 +294,7 @@ void MotionTimelineWidget::showContextMenu(const QPoint &pos)
|
|||
|
||||
QAction halveDurationAction(tr("Halve Duration"), this);
|
||||
if (-1 != m_currentSelectedIndex) {
|
||||
if (m_clips[m_currentSelectedIndex].clipType == SkeletonMotionClipType::Interpolation) {
|
||||
if (m_clips[m_currentSelectedIndex].clipType == MotionClipType::Interpolation) {
|
||||
connect(&halveDurationAction, &QAction::triggered, [=]() {
|
||||
setClipDuration(m_currentSelectedIndex, m_clips[m_currentSelectedIndex].duration / 2);
|
||||
});
|
||||
|
@ -304,7 +304,7 @@ void MotionTimelineWidget::showContextMenu(const QPoint &pos)
|
|||
|
||||
QAction deleteAction(tr("Delete"), this);
|
||||
if (-1 != m_currentSelectedIndex) {
|
||||
if (m_clips[m_currentSelectedIndex].clipType != SkeletonMotionClipType::Interpolation) {
|
||||
if (m_clips[m_currentSelectedIndex].clipType != MotionClipType::Interpolation) {
|
||||
connect(&deleteAction, &QAction::triggered, [=]() {
|
||||
removeClip(m_currentSelectedIndex);
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MOTION_TIMELINE_WIDGET_H
|
||||
#define MOTION_TIMELINE_WIDGET_H
|
||||
#ifndef DUST3D_MOTION_TIMELINE_WIDGET_H
|
||||
#define DUST3D_MOTION_TIMELINE_WIDGET_H
|
||||
#include <QListWidget>
|
||||
#include <QUuid>
|
||||
#include <QMouseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "interpolationtype.h"
|
||||
|
||||
class MotionTimelineWidget : public QListWidget
|
||||
|
@ -12,11 +12,11 @@ class MotionTimelineWidget : public QListWidget
|
|||
signals:
|
||||
void clipsChanged();
|
||||
public:
|
||||
MotionTimelineWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
const std::vector<SkeletonMotionClip> &clips();
|
||||
MotionTimelineWidget(const Document *document, QWidget *parent=nullptr);
|
||||
const std::vector<MotionClip> &clips();
|
||||
|
||||
public slots:
|
||||
void setClips(std::vector<SkeletonMotionClip> clips);
|
||||
void setClips(std::vector<MotionClip> clips);
|
||||
void addPose(QUuid poseId);
|
||||
void addMotion(QUuid motionId);
|
||||
void reload();
|
||||
|
@ -32,10 +32,10 @@ protected:
|
|||
QSize sizeHint() const override;
|
||||
|
||||
private:
|
||||
void addClipAfterCurrentIndex(const SkeletonMotionClip &clip);
|
||||
void addClipAfterCurrentIndex(const MotionClip &clip);
|
||||
|
||||
std::vector<SkeletonMotionClip> m_clips;
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
std::vector<MotionClip> m_clips;
|
||||
const Document *m_document = nullptr;
|
||||
int m_currentSelectedIndex = -1;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include "motionwidget.h"
|
||||
|
||||
MotionWidget::MotionWidget(const SkeletonDocument *document, QUuid motionId) :
|
||||
MotionWidget::MotionWidget(const Document *document, QUuid motionId) :
|
||||
m_motionId(motionId),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -31,12 +31,12 @@ MotionWidget::MotionWidget(const SkeletonDocument *document, QUuid motionId) :
|
|||
|
||||
setFixedSize(Theme::motionPreviewImageSize, MotionWidget::preferredHeight());
|
||||
|
||||
connect(document, &SkeletonDocument::motionNameChanged, this, [=](QUuid motionId) {
|
||||
connect(document, &Document::motionNameChanged, this, [=](QUuid motionId) {
|
||||
if (motionId != m_motionId)
|
||||
return;
|
||||
updateName();
|
||||
});
|
||||
connect(document, &SkeletonDocument::motionPreviewChanged, this, [=](QUuid motionId) {
|
||||
connect(document, &Document::motionPreviewChanged, this, [=](QUuid motionId) {
|
||||
if (motionId != m_motionId)
|
||||
return;
|
||||
updatePreview();
|
||||
|
@ -76,7 +76,7 @@ void MotionWidget::reload()
|
|||
|
||||
void MotionWidget::updatePreview()
|
||||
{
|
||||
const SkeletonMotion *motion = m_document->findMotion(m_motionId);
|
||||
const Motion *motion = m_document->findMotion(m_motionId);
|
||||
if (!motion) {
|
||||
qDebug() << "Motion not found:" << m_motionId;
|
||||
return;
|
||||
|
@ -87,7 +87,7 @@ void MotionWidget::updatePreview()
|
|||
|
||||
void MotionWidget::updateName()
|
||||
{
|
||||
const SkeletonMotion *motion = m_document->findMotion(m_motionId);
|
||||
const Motion *motion = m_document->findMotion(m_motionId);
|
||||
if (!motion) {
|
||||
qDebug() << "Motion not found:" << m_motionId;
|
||||
return;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef MOTION_WIDGET_H
|
||||
#define MOTION_WIDGET_H
|
||||
#ifndef DUST3D_MOTION_WIDGET_H
|
||||
#define DUST3D_MOTION_WIDGET_H
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QIcon>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "modelwidget.h"
|
||||
|
||||
class MotionWidget : public QFrame
|
||||
|
@ -13,7 +13,7 @@ signals:
|
|||
void modifyMotion(QUuid motionId);
|
||||
void cornerButtonClicked(QUuid motionId);
|
||||
public:
|
||||
MotionWidget(const SkeletonDocument *document, QUuid motionId);
|
||||
MotionWidget(const Document *document, QUuid motionId);
|
||||
static int preferredHeight();
|
||||
ModelWidget *previewWidget();
|
||||
protected:
|
||||
|
@ -27,7 +27,7 @@ public slots:
|
|||
void setCornerButtonVisible(bool visible);
|
||||
private:
|
||||
QUuid m_motionId;
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
ModelWidget *m_previewWidget = nullptr;
|
||||
QLabel *m_nameLabel = nullptr;
|
||||
QPushButton *m_cornerButton = nullptr;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <simpleuv/uvunwrapper.h>
|
||||
#include "texturegenerator.h"
|
||||
#include "theme.h"
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
#include "positionmap.h"
|
||||
#include "anglesmooth.h"
|
||||
|
||||
|
@ -26,7 +26,7 @@ struct CandidateEdge
|
|||
float length;
|
||||
};
|
||||
|
||||
MeshResultContext::MeshResultContext() :
|
||||
Outcome::Outcome() :
|
||||
m_triangleSourceResolved(false),
|
||||
m_triangleMaterialResolved(false),
|
||||
m_triangleEdgeSourceMapResolved(false),
|
||||
|
@ -38,7 +38,7 @@ MeshResultContext::MeshResultContext() :
|
|||
{
|
||||
}
|
||||
|
||||
const std::vector<std::pair<QUuid, QUuid>> &MeshResultContext::triangleSourceNodes()
|
||||
const std::vector<std::pair<QUuid, QUuid>> &Outcome::triangleSourceNodes()
|
||||
{
|
||||
if (!m_triangleSourceResolved) {
|
||||
m_triangleSourceResolved = true;
|
||||
|
@ -48,7 +48,7 @@ const std::vector<std::pair<QUuid, QUuid>> &MeshResultContext::triangleSourceNod
|
|||
return m_triangleSourceNodes;
|
||||
}
|
||||
|
||||
const std::map<int, std::pair<QUuid, QUuid>> &MeshResultContext::vertexSourceMap()
|
||||
const std::map<int, std::pair<QUuid, QUuid>> &Outcome::vertexSourceMap()
|
||||
{
|
||||
if (!m_triangleSourceResolved) {
|
||||
m_triangleSourceResolved = true;
|
||||
|
@ -58,7 +58,7 @@ const std::map<int, std::pair<QUuid, QUuid>> &MeshResultContext::vertexSourceMap
|
|||
return m_vertexSourceMap;
|
||||
}
|
||||
|
||||
const std::vector<Material> &MeshResultContext::triangleMaterials()
|
||||
const std::vector<OutcomeMaterial> &Outcome::triangleMaterials()
|
||||
{
|
||||
if (!m_triangleMaterialResolved) {
|
||||
calculateTriangleMaterials(m_triangleMaterials);
|
||||
|
@ -67,7 +67,7 @@ const std::vector<Material> &MeshResultContext::triangleMaterials()
|
|||
return m_triangleMaterials;
|
||||
}
|
||||
|
||||
const std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &MeshResultContext::triangleEdgeSourceMap()
|
||||
const std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &Outcome::triangleEdgeSourceMap()
|
||||
{
|
||||
if (!m_triangleEdgeSourceMapResolved) {
|
||||
calculateTriangleEdgeSourceMap(m_triangleEdgeSourceMap);
|
||||
|
@ -76,7 +76,7 @@ const std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &MeshResultContext:
|
|||
return m_triangleEdgeSourceMap;
|
||||
}
|
||||
|
||||
const std::map<std::pair<QUuid, QUuid>, BmeshNode *> &MeshResultContext::bmeshNodeMap()
|
||||
const std::map<std::pair<QUuid, QUuid>, OutcomeNode *> &Outcome::bmeshNodeMap()
|
||||
{
|
||||
if (!m_bmeshNodeMapResolved) {
|
||||
calculateBmeshNodeMap(m_bmeshNodeMap);
|
||||
|
@ -85,7 +85,7 @@ const std::map<std::pair<QUuid, QUuid>, BmeshNode *> &MeshResultContext::bmeshNo
|
|||
return m_bmeshNodeMap;
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateTriangleSourceNodes(std::vector<std::pair<QUuid, QUuid>> &triangleSourceNodes, std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap)
|
||||
void Outcome::calculateTriangleSourceNodes(std::vector<std::pair<QUuid, QUuid>> &triangleSourceNodes, std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap)
|
||||
{
|
||||
PositionMap<std::pair<QUuid, QUuid>> positionMap;
|
||||
std::map<std::pair<int, int>, HalfColorEdge> halfColorEdgeMap;
|
||||
|
@ -95,7 +95,7 @@ void MeshResultContext::calculateTriangleSourceNodes(std::vector<std::pair<QUuid
|
|||
std::make_pair(it.partId, it.nodeId));
|
||||
}
|
||||
for (auto x = 0u; x < vertices.size(); x++) {
|
||||
ResultVertex *resultVertex = &vertices[x];
|
||||
OutcomeVertex *resultVertex = &vertices[x];
|
||||
std::pair<QUuid, QUuid> source;
|
||||
if (positionMap.findPosition(resultVertex->position.x(), resultVertex->position.y(), resultVertex->position.z(), &source)) {
|
||||
vertexSourceMap[x] = source;
|
||||
|
@ -228,7 +228,7 @@ void MeshResultContext::calculateTriangleSourceNodes(std::vector<std::pair<QUuid
|
|||
}
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateRemainingVertexSourceNodesAfterTriangleSourceNodesSolved(std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap)
|
||||
void Outcome::calculateRemainingVertexSourceNodesAfterTriangleSourceNodesSolved(std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap)
|
||||
{
|
||||
std::map<int, std::set<std::pair<QUuid, QUuid>>> remainings;
|
||||
for (auto x = 0u; x < triangles.size(); x++) {
|
||||
|
@ -259,9 +259,9 @@ void MeshResultContext::calculateRemainingVertexSourceNodesAfterTriangleSourceNo
|
|||
}
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateTriangleMaterials(std::vector<Material> &triangleMaterials)
|
||||
void Outcome::calculateTriangleMaterials(std::vector<OutcomeMaterial> &triangleMaterials)
|
||||
{
|
||||
std::map<std::pair<QUuid, QUuid>, Material> nodeMaterialMap;
|
||||
std::map<std::pair<QUuid, QUuid>, OutcomeMaterial> nodeMaterialMap;
|
||||
for (const auto &it: bmeshNodes) {
|
||||
nodeMaterialMap[std::make_pair(it.partId, it.nodeId)] = it.material;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void MeshResultContext::calculateTriangleMaterials(std::vector<Material> &triang
|
|||
}
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateTriangleEdgeSourceMap(std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &triangleEdgeSourceMap)
|
||||
void Outcome::calculateTriangleEdgeSourceMap(std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &triangleEdgeSourceMap)
|
||||
{
|
||||
const std::vector<std::pair<QUuid, QUuid>> sourceNodes = triangleSourceNodes();
|
||||
for (auto x = 0u; x < triangles.size(); x++) {
|
||||
|
@ -284,20 +284,20 @@ void MeshResultContext::calculateTriangleEdgeSourceMap(std::map<std::pair<int, i
|
|||
}
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateBmeshNodeMap(std::map<std::pair<QUuid, QUuid>, BmeshNode *> &bmeshNodeMap) {
|
||||
void Outcome::calculateBmeshNodeMap(std::map<std::pair<QUuid, QUuid>, OutcomeNode *> &bmeshNodeMap) {
|
||||
for (auto i = 0u; i < bmeshNodes.size(); i++) {
|
||||
BmeshNode *bmeshNode = &bmeshNodes[i];
|
||||
OutcomeNode *bmeshNode = &bmeshNodes[i];
|
||||
bmeshNodeMap[std::make_pair(bmeshNode->partId, bmeshNode->nodeId)] = bmeshNode;
|
||||
}
|
||||
}
|
||||
|
||||
struct BmeshNodeDistWithWorldCenter
|
||||
{
|
||||
BmeshNode *bmeshNode;
|
||||
OutcomeNode *bmeshNode;
|
||||
float dist2;
|
||||
};
|
||||
|
||||
const std::map<QUuid, ResultPart> &MeshResultContext::parts()
|
||||
const std::map<QUuid, ResultPart> &Outcome::parts()
|
||||
{
|
||||
if (!m_resultPartsResolved) {
|
||||
calculateResultParts(m_resultParts);
|
||||
|
@ -306,7 +306,7 @@ const std::map<QUuid, ResultPart> &MeshResultContext::parts()
|
|||
return m_resultParts;
|
||||
}
|
||||
|
||||
const std::vector<ResultTriangleUv> &MeshResultContext::triangleUvs()
|
||||
const std::vector<OutcomeTriangleUv> &Outcome::triangleUvs()
|
||||
{
|
||||
if (!m_resultTriangleUvsResolved) {
|
||||
calculateResultTriangleUvs(m_resultTriangleUvs, m_seamVertices);
|
||||
|
@ -315,7 +315,7 @@ const std::vector<ResultTriangleUv> &MeshResultContext::triangleUvs()
|
|||
return m_resultTriangleUvs;
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
||||
void Outcome::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
||||
{
|
||||
std::map<std::pair<QUuid, int>, int> oldVertexToNewMap;
|
||||
for (auto x = 0u; x < triangles.size(); x++) {
|
||||
|
@ -329,7 +329,7 @@ void MeshResultContext::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
|||
parts.insert(std::make_pair(sourceNode.first, newPart));
|
||||
}
|
||||
auto &resultPart = parts[sourceNode.first];
|
||||
ResultTriangle newTriangle;
|
||||
OutcomeTriangle newTriangle;
|
||||
newTriangle.normal = triangle.normal;
|
||||
for (auto i = 0u; i < 3; i++) {
|
||||
const auto &normal = interpolatedTriangleVertexNormals()[normalIndex++];
|
||||
|
@ -341,7 +341,7 @@ void MeshResultContext::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
|||
int newIndex = resultPart.vertices.size();
|
||||
resultPart.verticesOldIndicies.push_back(triangle.indicies[i]);
|
||||
resultPart.vertices.push_back(vertices[triangle.indicies[i]]);
|
||||
ResultVertexUv vertexUv;
|
||||
OutcomeVertexUv vertexUv;
|
||||
vertexUv.uv[0] = triangleUvs()[x].uv[i][0];
|
||||
vertexUv.uv[1] = triangleUvs()[x].uv[i][1];
|
||||
resultPart.vertexUvs.push_back(vertexUv);
|
||||
|
@ -359,7 +359,7 @@ void MeshResultContext::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
|||
}
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateResultTriangleUvs(std::vector<ResultTriangleUv> &uvs, std::set<int> &seamVertices)
|
||||
void Outcome::calculateResultTriangleUvs(std::vector<OutcomeTriangleUv> &uvs, std::set<int> &seamVertices)
|
||||
{
|
||||
simpleuv::Mesh inputMesh;
|
||||
const auto &choosenVertices = vertices;
|
||||
|
@ -420,7 +420,7 @@ void MeshResultContext::calculateResultTriangleUvs(std::vector<ResultTriangleUv>
|
|||
}
|
||||
}
|
||||
|
||||
void MeshResultContext::interpolateTriangleVertexNormals(std::vector<QVector3D> &resultNormals)
|
||||
void Outcome::interpolateTriangleVertexNormals(std::vector<QVector3D> &resultNormals)
|
||||
{
|
||||
std::vector<QVector3D> inputVerticies;
|
||||
std::vector<std::tuple<size_t, size_t, size_t>> inputTriangles;
|
||||
|
@ -435,7 +435,7 @@ void MeshResultContext::interpolateTriangleVertexNormals(std::vector<QVector3D>
|
|||
angleSmooth(inputVerticies, inputTriangles, inputNormals, thresholdAngleDegrees, resultNormals);
|
||||
}
|
||||
|
||||
const std::vector<QVector3D> &MeshResultContext::interpolatedTriangleVertexNormals()
|
||||
const std::vector<QVector3D> &Outcome::interpolatedTriangleVertexNormals()
|
||||
{
|
||||
if (!m_triangleVertexNormalsInterpolated) {
|
||||
m_triangleVertexNormalsInterpolated = true;
|
||||
|
@ -444,7 +444,7 @@ const std::vector<QVector3D> &MeshResultContext::interpolatedTriangleVertexNorma
|
|||
return m_interpolatedTriangleVertexNormals;
|
||||
}
|
||||
|
||||
const std::vector<QVector3D> &MeshResultContext::triangleTangents()
|
||||
const std::vector<QVector3D> &Outcome::triangleTangents()
|
||||
{
|
||||
if (!m_triangleTangentsResolved) {
|
||||
m_triangleTangentsResolved = true;
|
||||
|
@ -453,7 +453,7 @@ const std::vector<QVector3D> &MeshResultContext::triangleTangents()
|
|||
return m_triangleTangents;
|
||||
}
|
||||
|
||||
void MeshResultContext::calculateTriangleTangents(std::vector<QVector3D> &tangents)
|
||||
void Outcome::calculateTriangleTangents(std::vector<QVector3D> &tangents)
|
||||
{
|
||||
tangents.resize(triangles.size());
|
||||
|
|
@ -1,84 +1,90 @@
|
|||
#ifndef MESH_RESULT_CONTEXT_H
|
||||
#define MESH_RESULT_CONTEXT_H
|
||||
#ifndef DUST3D_OUTCOME_H
|
||||
#define DUST3D_OUTCOME_H
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <QVector3D>
|
||||
#include <QUuid>
|
||||
#include <QColor>
|
||||
#include "positionmap.h"
|
||||
#include "skeletonbonemark.h"
|
||||
#include "bonemark.h"
|
||||
#include "texturetype.h"
|
||||
#include "material.h"
|
||||
|
||||
#define MAX_WEIGHT_NUM 4
|
||||
|
||||
struct BmeshNode
|
||||
struct OutcomeMaterial
|
||||
{
|
||||
QColor color;
|
||||
QUuid materialId;
|
||||
};
|
||||
|
||||
struct OutcomeNode
|
||||
{
|
||||
QUuid partId;
|
||||
QUuid nodeId;
|
||||
QVector3D origin;
|
||||
float radius = 0;
|
||||
Material material;
|
||||
OutcomeMaterial material;
|
||||
QUuid mirrorFromPartId;
|
||||
SkeletonBoneMark boneMark;
|
||||
BoneMark boneMark;
|
||||
};
|
||||
|
||||
struct BmeshVertex
|
||||
struct OutcomeNodeVertex
|
||||
{
|
||||
QVector3D position;
|
||||
QUuid partId;
|
||||
QUuid nodeId;
|
||||
};
|
||||
|
||||
struct ResultVertex
|
||||
struct OutcomeVertex
|
||||
{
|
||||
QVector3D position;
|
||||
};
|
||||
|
||||
struct ResultTriangle
|
||||
struct OutcomeTriangle
|
||||
{
|
||||
int indicies[3] = {0, 0, 0};
|
||||
QVector3D normal;
|
||||
};
|
||||
|
||||
struct ResultTriangleUv
|
||||
struct OutcomeTriangleUv
|
||||
{
|
||||
float uv[3][2] = {{0, 0}, {0, 0}, {0, 0}};
|
||||
bool resolved = false;
|
||||
};
|
||||
|
||||
struct ResultVertexUv
|
||||
struct OutcomeVertexUv
|
||||
{
|
||||
float uv[2] = {0, 0};
|
||||
};
|
||||
|
||||
struct ResultPart
|
||||
{
|
||||
Material material;
|
||||
std::vector<ResultVertex> vertices;
|
||||
OutcomeMaterial material;
|
||||
std::vector<OutcomeVertex> vertices;
|
||||
std::vector<int> verticesOldIndicies;
|
||||
std::vector<QVector3D> interpolatedTriangleVertexNormals;
|
||||
std::vector<ResultTriangle> triangles;
|
||||
std::vector<ResultTriangleUv> uvs;
|
||||
std::vector<ResultVertexUv> vertexUvs;
|
||||
std::vector<OutcomeTriangle> triangles;
|
||||
std::vector<OutcomeTriangleUv> uvs;
|
||||
std::vector<OutcomeVertexUv> vertexUvs;
|
||||
std::vector<QVector3D> triangleTangents;
|
||||
};
|
||||
|
||||
class MeshResultContext
|
||||
class Outcome
|
||||
{
|
||||
public:
|
||||
std::vector<BmeshNode> bmeshNodes;
|
||||
std::vector<BmeshVertex> bmeshVertices;
|
||||
std::vector<ResultVertex> vertices;
|
||||
std::vector<ResultTriangle> triangles;
|
||||
MeshResultContext();
|
||||
std::vector<OutcomeNode> bmeshNodes;
|
||||
std::vector<OutcomeNodeVertex> bmeshVertices;
|
||||
std::vector<OutcomeVertex> vertices;
|
||||
std::vector<OutcomeTriangle> triangles;
|
||||
Outcome();
|
||||
public:
|
||||
const std::vector<std::pair<QUuid, QUuid>> &triangleSourceNodes();
|
||||
const std::vector<Material> &triangleMaterials();
|
||||
const std::vector<OutcomeMaterial> &triangleMaterials();
|
||||
const std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &triangleEdgeSourceMap();
|
||||
const std::map<std::pair<QUuid, QUuid>, BmeshNode *> &bmeshNodeMap();
|
||||
const std::map<std::pair<QUuid, QUuid>, OutcomeNode *> &bmeshNodeMap();
|
||||
const std::map<QUuid, ResultPart> &parts();
|
||||
const std::vector<ResultTriangleUv> &triangleUvs();
|
||||
const std::vector<OutcomeTriangleUv> &triangleUvs();
|
||||
const std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap();
|
||||
const std::vector<QVector3D> &interpolatedTriangleVertexNormals();
|
||||
const std::vector<QVector3D> &triangleTangents();
|
||||
|
@ -93,11 +99,11 @@ private:
|
|||
bool m_triangleTangentsResolved;
|
||||
private:
|
||||
std::vector<std::pair<QUuid, QUuid>> m_triangleSourceNodes;
|
||||
std::vector<Material> m_triangleMaterials;
|
||||
std::vector<OutcomeMaterial> m_triangleMaterials;
|
||||
std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> m_triangleEdgeSourceMap;
|
||||
std::map<std::pair<QUuid, QUuid>, BmeshNode *> m_bmeshNodeMap;
|
||||
std::map<std::pair<QUuid, QUuid>, OutcomeNode *> m_bmeshNodeMap;
|
||||
std::map<QUuid, ResultPart> m_resultParts;
|
||||
std::vector<ResultTriangleUv> m_resultTriangleUvs;
|
||||
std::vector<OutcomeTriangleUv> m_resultTriangleUvs;
|
||||
std::set<int> m_seamVertices;
|
||||
std::map<int, std::pair<QUuid, QUuid>> m_vertexSourceMap;
|
||||
std::map<int, int> m_rearrangedVerticesToOldIndexMap;
|
||||
|
@ -106,11 +112,11 @@ private:
|
|||
private:
|
||||
void calculateTriangleSourceNodes(std::vector<std::pair<QUuid, QUuid>> &triangleSourceNodes, std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap);
|
||||
void calculateRemainingVertexSourceNodesAfterTriangleSourceNodesSolved(std::map<int, std::pair<QUuid, QUuid>> &vertexSourceMap);
|
||||
void calculateTriangleMaterials(std::vector<Material> &triangleMaterials);
|
||||
void calculateTriangleMaterials(std::vector<OutcomeMaterial> &triangleMaterials);
|
||||
void calculateTriangleEdgeSourceMap(std::map<std::pair<int, int>, std::pair<QUuid, QUuid>> &triangleEdgeSourceMap);
|
||||
void calculateBmeshNodeMap(std::map<std::pair<QUuid, QUuid>, BmeshNode *> &bmeshNodeMap);
|
||||
void calculateBmeshNodeMap(std::map<std::pair<QUuid, QUuid>, OutcomeNode *> &bmeshNodeMap);
|
||||
void calculateResultParts(std::map<QUuid, ResultPart> &parts);
|
||||
void calculateResultTriangleUvs(std::vector<ResultTriangleUv> &uvs, std::set<int> &seamVertices);
|
||||
void calculateResultTriangleUvs(std::vector<OutcomeTriangleUv> &uvs, std::set<int> &seamVertices);
|
||||
void interpolateTriangleVertexNormals(std::vector<QVector3D> &resultNormals);
|
||||
void calculateTriangleTangents(std::vector<QVector3D> &tangents);
|
||||
};
|
|
@ -6,12 +6,12 @@
|
|||
#include <QRadialGradient>
|
||||
#include <QBrush>
|
||||
#include <QGuiApplication>
|
||||
#include "skeletonparttreewidget.h"
|
||||
#include "skeletonpartwidget.h"
|
||||
#include "parttreewidget.h"
|
||||
#include "partwidget.h"
|
||||
#include "skeletongraphicswidget.h"
|
||||
#include "floatnumberwidget.h"
|
||||
|
||||
SkeletonPartTreeWidget::SkeletonPartTreeWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
PartTreeWidget::PartTreeWidget(const Document *document, QWidget *parent) :
|
||||
QTreeWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -56,13 +56,13 @@ SkeletonPartTreeWidget::SkeletonPartTreeWidget(const SkeletonDocument *document,
|
|||
gradient.setColorAt(1, Qt::transparent);
|
||||
m_hightlightedPartBackground = QBrush(gradient);
|
||||
|
||||
connect(this, &QTreeWidget::customContextMenuRequested, this, &SkeletonPartTreeWidget::showContextMenu);
|
||||
connect(this, &QTreeWidget::itemChanged, this, &SkeletonPartTreeWidget::groupChanged);
|
||||
connect(this, &QTreeWidget::itemExpanded, this, &SkeletonPartTreeWidget::groupExpanded);
|
||||
connect(this, &QTreeWidget::itemCollapsed, this, &SkeletonPartTreeWidget::groupCollapsed);
|
||||
connect(this, &QTreeWidget::customContextMenuRequested, this, &PartTreeWidget::showContextMenu);
|
||||
connect(this, &QTreeWidget::itemChanged, this, &PartTreeWidget::groupChanged);
|
||||
connect(this, &QTreeWidget::itemExpanded, this, &PartTreeWidget::groupExpanded);
|
||||
connect(this, &QTreeWidget::itemCollapsed, this, &PartTreeWidget::groupCollapsed);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::selectComponent(QUuid componentId, bool multiple)
|
||||
void PartTreeWidget::selectComponent(QUuid componentId, bool multiple)
|
||||
{
|
||||
if (multiple) {
|
||||
if (!m_currentSelectedComponentId.isNull()) {
|
||||
|
@ -103,9 +103,9 @@ void SkeletonPartTreeWidget::selectComponent(QUuid componentId, bool multiple)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::updateComponentSelectState(QUuid componentId, bool selected)
|
||||
void PartTreeWidget::updateComponentSelectState(QUuid componentId, bool selected)
|
||||
{
|
||||
const SkeletonComponent *component = m_document->findComponent(componentId);
|
||||
const Component *component = m_document->findComponent(componentId);
|
||||
if (nullptr == component) {
|
||||
qDebug() << "Component not found:" << componentId;
|
||||
return;
|
||||
|
@ -113,7 +113,7 @@ void SkeletonPartTreeWidget::updateComponentSelectState(QUuid componentId, bool
|
|||
if (!component->linkToPartId.isNull()) {
|
||||
auto item = m_partItemMap.find(component->linkToPartId);
|
||||
if (item != m_componentItemMap.end()) {
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateCheckedState(selected);
|
||||
}
|
||||
return;
|
||||
|
@ -130,7 +130,7 @@ void SkeletonPartTreeWidget::updateComponentSelectState(QUuid componentId, bool
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::mousePressEvent(QMouseEvent *event)
|
||||
void PartTreeWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QModelIndex itemIndex = indexAt(event->pos());
|
||||
QTreeView::mousePressEvent(event);
|
||||
|
@ -141,7 +141,7 @@ void SkeletonPartTreeWidget::mousePressEvent(QMouseEvent *event)
|
|||
auto componentId = QUuid(item->data(0, Qt::UserRole).toString());
|
||||
if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) {
|
||||
if (!m_shiftStartComponentId.isNull()) {
|
||||
const SkeletonComponent *parent = m_document->findComponentParent(m_shiftStartComponentId);
|
||||
const Component *parent = m_document->findComponentParent(m_shiftStartComponentId);
|
||||
if (parent) {
|
||||
if (!parent->childrenIds.empty()) {
|
||||
bool startAdd = false;
|
||||
|
@ -190,11 +190,11 @@ void SkeletonPartTreeWidget::mousePressEvent(QMouseEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::showContextMenu(const QPoint &pos)
|
||||
void PartTreeWidget::showContextMenu(const QPoint &pos)
|
||||
{
|
||||
const SkeletonComponent *component = nullptr;
|
||||
const SkeletonPart *part = nullptr;
|
||||
SkeletonPartWidget *partWidget = nullptr;
|
||||
const Component *component = nullptr;
|
||||
const Part *part = nullptr;
|
||||
PartWidget *partWidget = nullptr;
|
||||
|
||||
std::set<QUuid> unorderedComponentIds = m_selectedComponentIds;
|
||||
if (!m_currentSelectedComponentId.isNull())
|
||||
|
@ -238,7 +238,7 @@ void SkeletonPartTreeWidget::showContextMenu(const QPoint &pos)
|
|||
if (nullptr != part) {
|
||||
auto findItem = m_partItemMap.find(part->id);
|
||||
if (findItem != m_partItemMap.end()) {
|
||||
partWidget = (SkeletonPartWidget *)itemWidget(findItem->second, 0);
|
||||
partWidget = (PartWidget *)itemWidget(findItem->second, 0);
|
||||
}
|
||||
}
|
||||
if (nullptr != part && nullptr != partWidget) {
|
||||
|
@ -500,7 +500,7 @@ void SkeletonPartTreeWidget::showContextMenu(const QPoint &pos)
|
|||
});
|
||||
|
||||
addChildGroupsFunc = [this, &groupsActions, &addChildGroupsFunc, &moveToMenu, &componentIds](QUuid currentId, int tabs) -> void {
|
||||
const SkeletonComponent *current = m_document->findComponent(currentId);
|
||||
const Component *current = m_document->findComponent(currentId);
|
||||
if (nullptr == current)
|
||||
return;
|
||||
if (!current->id.isNull() && current->linkDataType().isEmpty()) {
|
||||
|
@ -535,11 +535,11 @@ void SkeletonPartTreeWidget::showContextMenu(const QPoint &pos)
|
|||
}
|
||||
}
|
||||
|
||||
QWidget *SkeletonPartTreeWidget::createSmoothMenuWidget(QUuid componentId)
|
||||
QWidget *PartTreeWidget::createSmoothMenuWidget(QUuid componentId)
|
||||
{
|
||||
QWidget *popup = new QWidget;
|
||||
|
||||
const SkeletonComponent *component = m_document->findComponent(componentId);
|
||||
const Component *component = m_document->findComponent(componentId);
|
||||
if (!component) {
|
||||
qDebug() << "Find component failed:" << componentId;
|
||||
return popup;
|
||||
|
@ -607,7 +607,7 @@ QWidget *SkeletonPartTreeWidget::createSmoothMenuWidget(QUuid componentId)
|
|||
return popup;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *SkeletonPartTreeWidget::findComponentItem(QUuid componentId)
|
||||
QTreeWidgetItem *PartTreeWidget::findComponentItem(QUuid componentId)
|
||||
{
|
||||
auto findResult = m_componentItemMap.find(componentId);
|
||||
if (findResult == m_componentItemMap.end())
|
||||
|
@ -616,7 +616,7 @@ QTreeWidgetItem *SkeletonPartTreeWidget::findComponentItem(QUuid componentId)
|
|||
return findResult->second;
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::componentNameChanged(QUuid componentId)
|
||||
void PartTreeWidget::componentNameChanged(QUuid componentId)
|
||||
{
|
||||
auto componentItem = m_componentItemMap.find(componentId);
|
||||
if (componentItem == m_componentItemMap.end()) {
|
||||
|
@ -624,7 +624,7 @@ void SkeletonPartTreeWidget::componentNameChanged(QUuid componentId)
|
|||
return;
|
||||
}
|
||||
|
||||
const SkeletonComponent *component = m_document->findComponent(componentId);
|
||||
const Component *component = m_document->findComponent(componentId);
|
||||
if (nullptr == component) {
|
||||
qDebug() << "Find component failed:" << componentId;
|
||||
return;
|
||||
|
@ -633,7 +633,7 @@ void SkeletonPartTreeWidget::componentNameChanged(QUuid componentId)
|
|||
componentItem->second->setText(0, component->name);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::componentExpandStateChanged(QUuid componentId)
|
||||
void PartTreeWidget::componentExpandStateChanged(QUuid componentId)
|
||||
{
|
||||
auto componentItem = m_componentItemMap.find(componentId);
|
||||
if (componentItem == m_componentItemMap.end()) {
|
||||
|
@ -641,7 +641,7 @@ void SkeletonPartTreeWidget::componentExpandStateChanged(QUuid componentId)
|
|||
return;
|
||||
}
|
||||
|
||||
const SkeletonComponent *component = m_document->findComponent(componentId);
|
||||
const Component *component = m_document->findComponent(componentId);
|
||||
if (nullptr == component) {
|
||||
qDebug() << "Find component failed:" << componentId;
|
||||
return;
|
||||
|
@ -650,14 +650,14 @@ void SkeletonPartTreeWidget::componentExpandStateChanged(QUuid componentId)
|
|||
componentItem->second->setExpanded(component->expanded);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::addComponentChildrenToItem(QUuid componentId, QTreeWidgetItem *parentItem)
|
||||
void PartTreeWidget::addComponentChildrenToItem(QUuid componentId, QTreeWidgetItem *parentItem)
|
||||
{
|
||||
const SkeletonComponent *parentComponent = m_document->findComponent(componentId);
|
||||
const Component *parentComponent = m_document->findComponent(componentId);
|
||||
if (nullptr == parentComponent)
|
||||
return;
|
||||
|
||||
for (const auto &childId: parentComponent->childrenIds) {
|
||||
const SkeletonComponent *component = m_document->findComponent(childId);
|
||||
const Component *component = m_document->findComponent(childId);
|
||||
if (nullptr == component)
|
||||
continue;
|
||||
if (!component->linkToPartId.isNull()) {
|
||||
|
@ -666,8 +666,8 @@ void SkeletonPartTreeWidget::addComponentChildrenToItem(QUuid componentId, QTree
|
|||
item->setData(0, Qt::UserRole, QVariant(component->id.toString()));
|
||||
item->setFlags(item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable));
|
||||
QUuid partId = component->linkToPartId;
|
||||
SkeletonPartWidget *widget = new SkeletonPartWidget(m_document, partId);
|
||||
item->setSizeHint(0, SkeletonPartWidget::preferredSize());
|
||||
PartWidget *widget = new PartWidget(m_document, partId);
|
||||
item->setSizeHint(0, PartWidget::preferredSize());
|
||||
setItemWidget(item, 0, widget);
|
||||
widget->reload();
|
||||
m_partItemMap[partId] = item;
|
||||
|
@ -685,13 +685,13 @@ void SkeletonPartTreeWidget::addComponentChildrenToItem(QUuid componentId, QTree
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::deleteItemChildren(QTreeWidgetItem *item)
|
||||
void PartTreeWidget::deleteItemChildren(QTreeWidgetItem *item)
|
||||
{
|
||||
auto children = item->takeChildren();
|
||||
while (!children.isEmpty()) {
|
||||
auto first = children.takeFirst();
|
||||
auto componentId = QUuid(first->data(0, Qt::UserRole).toString());
|
||||
const SkeletonComponent *component = m_document->findComponent(componentId);
|
||||
const Component *component = m_document->findComponent(componentId);
|
||||
if (nullptr != component) {
|
||||
m_componentItemMap.erase(componentId);
|
||||
if (!component->linkToPartId.isNull()) {
|
||||
|
@ -703,7 +703,7 @@ void SkeletonPartTreeWidget::deleteItemChildren(QTreeWidgetItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::componentChildrenChanged(QUuid componentId)
|
||||
void PartTreeWidget::componentChildrenChanged(QUuid componentId)
|
||||
{
|
||||
QTreeWidgetItem *parentItem = findComponentItem(componentId);
|
||||
if (nullptr == parentItem) {
|
||||
|
@ -723,7 +723,7 @@ void SkeletonPartTreeWidget::componentChildrenChanged(QUuid componentId)
|
|||
}
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::removeAllContent()
|
||||
void PartTreeWidget::removeAllContent()
|
||||
{
|
||||
qDeleteAll(invisibleRootItem()->takeChildren());
|
||||
m_partItemMap.clear();
|
||||
|
@ -731,7 +731,7 @@ void SkeletonPartTreeWidget::removeAllContent()
|
|||
m_componentItemMap[QUuid()] = invisibleRootItem();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::componentRemoved(QUuid componentId)
|
||||
void PartTreeWidget::componentRemoved(QUuid componentId)
|
||||
{
|
||||
auto componentItem = m_componentItemMap.find(componentId);
|
||||
if (componentItem == m_componentItemMap.end())
|
||||
|
@ -742,12 +742,12 @@ void SkeletonPartTreeWidget::componentRemoved(QUuid componentId)
|
|||
m_componentItemMap.erase(componentId);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::componentAdded(QUuid componentId)
|
||||
void PartTreeWidget::componentAdded(QUuid componentId)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partRemoved(QUuid partId)
|
||||
void PartTreeWidget::partRemoved(QUuid partId)
|
||||
{
|
||||
auto partItem = m_partItemMap.find(partId);
|
||||
if (partItem == m_partItemMap.end())
|
||||
|
@ -756,14 +756,14 @@ void SkeletonPartTreeWidget::partRemoved(QUuid partId)
|
|||
m_partItemMap.erase(partItem);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::groupChanged(QTreeWidgetItem *item, int column)
|
||||
void PartTreeWidget::groupChanged(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
if (0 != column)
|
||||
return;
|
||||
|
||||
auto componentId = QUuid(item->data(0, Qt::UserRole).toString());
|
||||
|
||||
const SkeletonComponent *component = m_document->findComponent(componentId);
|
||||
const Component *component = m_document->findComponent(componentId);
|
||||
if (nullptr == component) {
|
||||
qDebug() << "Find component failed:" << componentId;
|
||||
return;
|
||||
|
@ -773,140 +773,140 @@ void SkeletonPartTreeWidget::groupChanged(QTreeWidgetItem *item, int column)
|
|||
emit renameComponent(componentId, item->text(0));
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::groupExpanded(QTreeWidgetItem *item)
|
||||
void PartTreeWidget::groupExpanded(QTreeWidgetItem *item)
|
||||
{
|
||||
QUuid componentId = QUuid(item->data(0, Qt::UserRole).toString());
|
||||
emit setComponentExpandState(componentId, true);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::groupCollapsed(QTreeWidgetItem *item)
|
||||
void PartTreeWidget::groupCollapsed(QTreeWidgetItem *item)
|
||||
{
|
||||
QUuid componentId = QUuid(item->data(0, Qt::UserRole).toString());
|
||||
emit setComponentExpandState(componentId, false);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partPreviewChanged(QUuid partId)
|
||||
void PartTreeWidget::partPreviewChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updatePreview();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partLockStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partLockStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateLockButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partVisibleStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partVisibleStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateVisibleButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partSubdivStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partSubdivStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateSubdivButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partDisableStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partDisableStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateDisableButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partXmirrorStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partXmirrorStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateXmirrorButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partDeformChanged(QUuid partId)
|
||||
void PartTreeWidget::partDeformChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateDeformButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partRoundStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partRoundStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateRoundButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partWrapStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partWrapStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateWrapButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partColorStateChanged(QUuid partId)
|
||||
void PartTreeWidget::partColorStateChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateColorButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partMaterialIdChanged(QUuid partId)
|
||||
void PartTreeWidget::partMaterialIdChanged(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
qDebug() << "Part item not found:" << partId;
|
||||
return;
|
||||
}
|
||||
SkeletonPartWidget *widget = (SkeletonPartWidget *)itemWidget(item->second, 0);
|
||||
PartWidget *widget = (PartWidget *)itemWidget(item->second, 0);
|
||||
widget->updateColorButton();
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partChecked(QUuid partId)
|
||||
void PartTreeWidget::partChecked(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
|
@ -916,7 +916,7 @@ void SkeletonPartTreeWidget::partChecked(QUuid partId)
|
|||
item->second->setBackground(0, m_hightlightedPartBackground);
|
||||
}
|
||||
|
||||
void SkeletonPartTreeWidget::partUnchecked(QUuid partId)
|
||||
void PartTreeWidget::partUnchecked(QUuid partId)
|
||||
{
|
||||
auto item = m_partItemMap.find(partId);
|
||||
if (item == m_partItemMap.end()) {
|
||||
|
@ -926,13 +926,13 @@ void SkeletonPartTreeWidget::partUnchecked(QUuid partId)
|
|||
item->second->setBackground(0, QBrush(Qt::transparent));
|
||||
}
|
||||
|
||||
QSize SkeletonPartTreeWidget::sizeHint() const
|
||||
QSize PartTreeWidget::sizeHint() const
|
||||
{
|
||||
QSize size = SkeletonPartWidget::preferredSize();
|
||||
QSize size = PartWidget::preferredSize();
|
||||
return QSize(size.width() * 1.35, size.height() * 5.5);
|
||||
}
|
||||
|
||||
bool SkeletonPartTreeWidget::isComponentSelected(QUuid componentId)
|
||||
bool PartTreeWidget::isComponentSelected(QUuid componentId)
|
||||
{
|
||||
return (m_currentSelectedComponentId == componentId ||
|
||||
m_selectedComponentIds.find(componentId) != m_selectedComponentIds.end());
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef SKELETON_PART_TREE_WIDGET_H
|
||||
#define SKELETON_PART_TREE_WIDGET_H
|
||||
#ifndef DUST3D_PART_TREE_WIDGET_H
|
||||
#define DUST3D_PART_TREE_WIDGET_H
|
||||
#include <QTreeWidget>
|
||||
#include <QUuid>
|
||||
#include <QMouseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
|
||||
class SkeletonPartTreeWidget : public QTreeWidget
|
||||
class PartTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
|
@ -41,7 +41,7 @@ signals:
|
|||
void addPartToSelection(QUuid partId);
|
||||
void groupOperationAdded();
|
||||
public:
|
||||
SkeletonPartTreeWidget(const SkeletonDocument *document, QWidget *parent);
|
||||
PartTreeWidget(const Document *document, QWidget *parent);
|
||||
QTreeWidgetItem *findComponentItem(QUuid componentId);
|
||||
public slots:
|
||||
void componentNameChanged(QUuid componentId);
|
||||
|
@ -79,7 +79,7 @@ private:
|
|||
void updateComponentSelectState(QUuid componentId, bool selected);
|
||||
bool isComponentSelected(QUuid componentId);
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
std::map<QUuid, QTreeWidgetItem *> m_partItemMap;
|
||||
std::map<QUuid, QTreeWidgetItem *> m_componentItemMap;
|
||||
QFont m_normalFont;
|
|
@ -6,13 +6,13 @@
|
|||
#include <QColorDialog>
|
||||
#include <QSizePolicy>
|
||||
#include <QFileDialog>
|
||||
#include "skeletonpartwidget.h"
|
||||
#include "partwidget.h"
|
||||
#include "theme.h"
|
||||
#include "floatnumberwidget.h"
|
||||
#include "materiallistwidget.h"
|
||||
#include "infolabel.h"
|
||||
|
||||
SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid partId) :
|
||||
PartWidget::PartWidget(const Document *document, QUuid partId) :
|
||||
m_document(document),
|
||||
m_partId(partId)
|
||||
{
|
||||
|
@ -124,25 +124,25 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
|
||||
setLayout(mainLayout);
|
||||
|
||||
connect(this, &SkeletonPartWidget::setPartLockState, m_document, &SkeletonDocument::setPartLockState);
|
||||
connect(this, &SkeletonPartWidget::setPartVisibleState, m_document, &SkeletonDocument::setPartVisibleState);
|
||||
connect(this, &SkeletonPartWidget::setPartSubdivState, m_document, &SkeletonDocument::setPartSubdivState);
|
||||
connect(this, &SkeletonPartWidget::setPartDisableState, m_document, &SkeletonDocument::setPartDisableState);
|
||||
connect(this, &SkeletonPartWidget::setPartXmirrorState, m_document, &SkeletonDocument::setPartXmirrorState);
|
||||
connect(this, &SkeletonPartWidget::setPartDeformThickness, m_document, &SkeletonDocument::setPartDeformThickness);
|
||||
connect(this, &SkeletonPartWidget::setPartDeformWidth, m_document, &SkeletonDocument::setPartDeformWidth);
|
||||
connect(this, &SkeletonPartWidget::setPartRoundState, m_document, &SkeletonDocument::setPartRoundState);
|
||||
connect(this, &SkeletonPartWidget::setPartWrapState, m_document, &SkeletonDocument::setPartWrapState);
|
||||
connect(this, &SkeletonPartWidget::setPartColorState, m_document, &SkeletonDocument::setPartColorState);
|
||||
connect(this, &SkeletonPartWidget::setPartMaterialId, m_document, &SkeletonDocument::setPartMaterialId);
|
||||
connect(this, &SkeletonPartWidget::checkPart, m_document, &SkeletonDocument::checkPart);
|
||||
connect(this, &SkeletonPartWidget::enableBackgroundBlur, m_document, &SkeletonDocument::enableBackgroundBlur);
|
||||
connect(this, &SkeletonPartWidget::disableBackgroundBlur, m_document, &SkeletonDocument::disableBackgroundBlur);
|
||||
connect(this, &PartWidget::setPartLockState, m_document, &Document::setPartLockState);
|
||||
connect(this, &PartWidget::setPartVisibleState, m_document, &Document::setPartVisibleState);
|
||||
connect(this, &PartWidget::setPartSubdivState, m_document, &Document::setPartSubdivState);
|
||||
connect(this, &PartWidget::setPartDisableState, m_document, &Document::setPartDisableState);
|
||||
connect(this, &PartWidget::setPartXmirrorState, m_document, &Document::setPartXmirrorState);
|
||||
connect(this, &PartWidget::setPartDeformThickness, m_document, &Document::setPartDeformThickness);
|
||||
connect(this, &PartWidget::setPartDeformWidth, m_document, &Document::setPartDeformWidth);
|
||||
connect(this, &PartWidget::setPartRoundState, m_document, &Document::setPartRoundState);
|
||||
connect(this, &PartWidget::setPartWrapState, m_document, &Document::setPartWrapState);
|
||||
connect(this, &PartWidget::setPartColorState, m_document, &Document::setPartColorState);
|
||||
connect(this, &PartWidget::setPartMaterialId, m_document, &Document::setPartMaterialId);
|
||||
connect(this, &PartWidget::checkPart, m_document, &Document::checkPart);
|
||||
connect(this, &PartWidget::enableBackgroundBlur, m_document, &Document::enableBackgroundBlur);
|
||||
connect(this, &PartWidget::disableBackgroundBlur, m_document, &Document::disableBackgroundBlur);
|
||||
|
||||
connect(this, &SkeletonPartWidget::groupOperationAdded, m_document, &SkeletonDocument::saveSnapshot);
|
||||
connect(this, &PartWidget::groupOperationAdded, m_document, &Document::saveSnapshot);
|
||||
|
||||
connect(m_lockButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -152,7 +152,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_visibleButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -162,7 +162,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_subdivButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -172,7 +172,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_disableButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -182,7 +182,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_xMirrorButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -192,7 +192,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_deformButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -201,7 +201,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_roundButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -211,7 +211,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_colorButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -220,7 +220,7 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
});
|
||||
|
||||
connect(m_wrapButton, &QPushButton::clicked, [=]() {
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -235,17 +235,17 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
|
|||
updateAllButtons();
|
||||
}
|
||||
|
||||
ModelWidget *SkeletonPartWidget::previewWidget()
|
||||
ModelWidget *PartWidget::previewWidget()
|
||||
{
|
||||
return m_previewWidget;
|
||||
}
|
||||
|
||||
QSize SkeletonPartWidget::preferredSize()
|
||||
QSize PartWidget::preferredSize()
|
||||
{
|
||||
return QSize(Theme::miniIconSize + Theme::partPreviewImageSize + Theme::miniIconSize * 4 + 5 + 2, Theme::partPreviewImageSize + 6);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateAllButtons()
|
||||
void PartWidget::updateAllButtons()
|
||||
{
|
||||
updateVisibleButton();
|
||||
updateLockButton();
|
||||
|
@ -258,7 +258,7 @@ void SkeletonPartWidget::updateAllButtons()
|
|||
updateWrapButton();
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateCheckedState(bool checked)
|
||||
void PartWidget::updateCheckedState(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
m_backgroundWidget->setStyleSheet("QWidget#background {border: 1px solid " + Theme::red.name() + ";}");
|
||||
|
@ -266,27 +266,27 @@ void SkeletonPartWidget::updateCheckedState(bool checked)
|
|||
m_backgroundWidget->setStyleSheet("QWidget#background {border: 1px solid transparent;}");
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
void PartWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
emit checkPart(m_partId);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::initToolButtonWithoutFont(QPushButton *button)
|
||||
void PartWidget::initToolButtonWithoutFont(QPushButton *button)
|
||||
{
|
||||
Theme::initAwesomeToolButtonWithoutFont(button);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::initToolButton(QPushButton *button)
|
||||
void PartWidget::initToolButton(QPushButton *button)
|
||||
{
|
||||
Theme::initAwesomeToolButton(button);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::showColorSettingPopup(const QPoint &pos)
|
||||
void PartWidget::showColorSettingPopup(const QPoint &pos)
|
||||
{
|
||||
QMenu popupMenu;
|
||||
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Find part failed:" << m_partId;
|
||||
return;
|
||||
|
@ -353,11 +353,11 @@ void SkeletonPartWidget::showColorSettingPopup(const QPoint &pos)
|
|||
popupMenu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::showDeformSettingPopup(const QPoint &pos)
|
||||
void PartWidget::showDeformSettingPopup(const QPoint &pos)
|
||||
{
|
||||
QMenu popupMenu;
|
||||
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Find part failed:" << m_partId;
|
||||
return;
|
||||
|
@ -421,19 +421,19 @@ void SkeletonPartWidget::showDeformSettingPopup(const QPoint &pos)
|
|||
popupMenu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::initButton(QPushButton *button)
|
||||
void PartWidget::initButton(QPushButton *button)
|
||||
{
|
||||
Theme::initAwesomeMiniButton(button);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateButton(QPushButton *button, QChar icon, bool highlighted)
|
||||
void PartWidget::updateButton(QPushButton *button, QChar icon, bool highlighted)
|
||||
{
|
||||
Theme::updateAwesomeMiniButton(button, icon, highlighted);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updatePreview()
|
||||
void PartWidget::updatePreview()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -443,9 +443,9 @@ void SkeletonPartWidget::updatePreview()
|
|||
m_previewWidget->updateMesh(previewMesh);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateLockButton()
|
||||
void PartWidget::updateLockButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -456,9 +456,9 @@ void SkeletonPartWidget::updateLockButton()
|
|||
updateButton(m_lockButton, QChar(fa::unlock), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateVisibleButton()
|
||||
void PartWidget::updateVisibleButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -469,9 +469,9 @@ void SkeletonPartWidget::updateVisibleButton()
|
|||
updateButton(m_visibleButton, QChar(fa::eyeslash), true);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateSubdivButton()
|
||||
void PartWidget::updateSubdivButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -482,9 +482,9 @@ void SkeletonPartWidget::updateSubdivButton()
|
|||
updateButton(m_subdivButton, QChar(fa::squareo), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateDisableButton()
|
||||
void PartWidget::updateDisableButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -495,9 +495,9 @@ void SkeletonPartWidget::updateDisableButton()
|
|||
updateButton(m_disableButton, QChar(fa::link), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateXmirrorButton()
|
||||
void PartWidget::updateXmirrorButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -508,9 +508,9 @@ void SkeletonPartWidget::updateXmirrorButton()
|
|||
updateButton(m_xMirrorButton, QChar(fa::balancescale), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateDeformButton()
|
||||
void PartWidget::updateDeformButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -521,9 +521,9 @@ void SkeletonPartWidget::updateDeformButton()
|
|||
updateButton(m_deformButton, QChar(fa::handlizardo), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateRoundButton()
|
||||
void PartWidget::updateRoundButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -534,9 +534,9 @@ void SkeletonPartWidget::updateRoundButton()
|
|||
updateButton(m_roundButton, QChar(fa::magnet), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateColorButton()
|
||||
void PartWidget::updateColorButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -547,9 +547,9 @@ void SkeletonPartWidget::updateColorButton()
|
|||
updateButton(m_colorButton, QChar(fa::eyedropper), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::updateWrapButton()
|
||||
void PartWidget::updateWrapButton()
|
||||
{
|
||||
const SkeletonPart *part = m_document->findPart(m_partId);
|
||||
const Part *part = m_document->findPart(m_partId);
|
||||
if (!part) {
|
||||
qDebug() << "Part not found:" << m_partId;
|
||||
return;
|
||||
|
@ -560,7 +560,7 @@ void SkeletonPartWidget::updateWrapButton()
|
|||
updateButton(m_wrapButton, QChar(fa::cube), false);
|
||||
}
|
||||
|
||||
void SkeletonPartWidget::reload()
|
||||
void PartWidget::reload()
|
||||
{
|
||||
updatePreview();
|
||||
updateAllButtons();
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef SKELETON_PART_WIDGET_H
|
||||
#define SKELETON_PART_WIDGET_H
|
||||
#ifndef DUST3D_PART_WIDGET_H
|
||||
#define DUST3D_PART_WIDGET_H
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMouseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "modelwidget.h"
|
||||
|
||||
class SkeletonPartWidget : public QWidget
|
||||
class PartWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
|
@ -31,7 +31,7 @@ signals:
|
|||
void enableBackgroundBlur();
|
||||
void disableBackgroundBlur();
|
||||
public:
|
||||
SkeletonPartWidget(const SkeletonDocument *document, QUuid partId);
|
||||
PartWidget(const Document *document, QUuid partId);
|
||||
void reload();
|
||||
void updatePreview();
|
||||
void updateLockButton();
|
||||
|
@ -53,7 +53,7 @@ public slots:
|
|||
void showDeformSettingPopup(const QPoint &pos);
|
||||
void showColorSettingPopup(const QPoint &pos);
|
||||
private: // need initialize
|
||||
const SkeletonDocument *m_document;
|
||||
const Document *m_document;
|
||||
QUuid m_partId;
|
||||
private:
|
||||
ModelWidget *m_previewWidget;
|
|
@ -11,7 +11,7 @@
|
|||
#include "floatnumberwidget.h"
|
||||
#include "version.h"
|
||||
|
||||
PoseEditWidget::PoseEditWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
PoseEditWidget::PoseEditWidget(const Document *document, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -125,15 +125,15 @@ PoseEditWidget::PoseEditWidget(const SkeletonDocument *document, QWidget *parent
|
|||
|
||||
setLayout(mainLayout);
|
||||
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, this, &PoseEditWidget::updatePreview);
|
||||
connect(m_document, &Document::resultRigChanged, this, &PoseEditWidget::updatePreview);
|
||||
connect(this, &PoseEditWidget::parametersAdjusted, this, &PoseEditWidget::updatePreview);
|
||||
connect(this, &PoseEditWidget::parametersAdjusted, [=]() {
|
||||
m_unsaved = true;
|
||||
updateTitle();
|
||||
});
|
||||
connect(this, &PoseEditWidget::addPose, m_document, &SkeletonDocument::addPose);
|
||||
connect(this, &PoseEditWidget::renamePose, m_document, &SkeletonDocument::renamePose);
|
||||
connect(this, &PoseEditWidget::setPoseParameters, m_document, &SkeletonDocument::setPoseParameters);
|
||||
connect(this, &PoseEditWidget::addPose, m_document, &Document::addPose);
|
||||
connect(this, &PoseEditWidget::renamePose, m_document, &Document::renamePose);
|
||||
connect(this, &PoseEditWidget::setPoseParameters, m_document, &Document::setPoseParameters);
|
||||
|
||||
updatePreview();
|
||||
updateTitle();
|
||||
|
@ -220,7 +220,7 @@ void PoseEditWidget::updateTitle()
|
|||
setWindowTitle(unifiedWindowTitle(tr("New") + (m_unsaved ? "*" : "")));
|
||||
return;
|
||||
}
|
||||
const SkeletonPose *pose = m_document->findPose(m_poseId);
|
||||
const Pose *pose = m_document->findPose(m_poseId);
|
||||
if (nullptr == pose) {
|
||||
qDebug() << "Find pose failed:" << m_poseId;
|
||||
return;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef POSE_EDIT_WIDGET_H
|
||||
#define POSE_EDIT_WIDGET_H
|
||||
#ifndef DUST3D_POSE_EDIT_WIDGET_H
|
||||
#define DUST3D_POSE_EDIT_WIDGET_H
|
||||
#include <QDialog>
|
||||
#include <map>
|
||||
#include <QCloseEvent>
|
||||
#include <QLineEdit>
|
||||
#include "posepreviewmanager.h"
|
||||
#include "tetrapodposer.h"
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "modelwidget.h"
|
||||
|
||||
enum class PopupWidgetType
|
||||
|
@ -25,7 +25,7 @@ signals:
|
|||
void renamePose(QUuid poseId, QString name);
|
||||
void parametersAdjusted();
|
||||
public:
|
||||
PoseEditWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
PoseEditWidget(const Document *document, QWidget *parent=nullptr);
|
||||
~PoseEditWidget();
|
||||
public slots:
|
||||
void updatePreview();
|
||||
|
@ -41,7 +41,7 @@ protected:
|
|||
void closeEvent(QCloseEvent *event) override;
|
||||
void reject() override;
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
PosePreviewManager *m_posePreviewManager = nullptr;
|
||||
ModelWidget *m_previewWidget = nullptr;
|
||||
bool m_isPreviewDirty = false;
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include <QXmlStreamWriter>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include "skeletonxml.h"
|
||||
#include "snapshotxml.h"
|
||||
#include "poselistwidget.h"
|
||||
|
||||
PoseListWidget::PoseListWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
PoseListWidget::PoseListWidget(const Document *document, QWidget *parent) :
|
||||
QTreeWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ PoseListWidget::PoseListWidget(const SkeletonDocument *document, QWidget *parent
|
|||
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
connect(document, &SkeletonDocument::poseListChanged, this, &PoseListWidget::reload);
|
||||
connect(document, &SkeletonDocument::cleanup, this, &PoseListWidget::removeAllContent);
|
||||
connect(document, &Document::poseListChanged, this, &PoseListWidget::reload);
|
||||
connect(document, &Document::cleanup, this, &PoseListWidget::removeAllContent);
|
||||
|
||||
connect(this, &PoseListWidget::removePose, document, &SkeletonDocument::removePose);
|
||||
connect(this, &PoseListWidget::removePose, document, &Document::removePose);
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &QTreeWidget::customContextMenuRequested, this, &PoseListWidget::showContextMenu);
|
||||
|
@ -190,7 +190,7 @@ void PoseListWidget::showContextMenu(const QPoint &pos)
|
|||
|
||||
QAction pasteAction(tr("Paste"), this);
|
||||
if (m_document->hasPastablePosesInClipboard()) {
|
||||
connect(&pasteAction, &QAction::triggered, m_document, &SkeletonDocument::paste);
|
||||
connect(&pasteAction, &QAction::triggered, m_document, &Document::paste);
|
||||
contextMenu.addAction(&pasteAction);
|
||||
}
|
||||
|
||||
|
@ -287,8 +287,8 @@ void PoseListWidget::copy()
|
|||
|
||||
std::set<QUuid> emptySet;
|
||||
|
||||
SkeletonSnapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot, emptySet, SkeletonDocumentToSnapshotFor::Poses,
|
||||
Snapshot snapshot;
|
||||
m_document->toSnapshot(&snapshot, emptySet, DocumentToSnapshotFor::Poses,
|
||||
limitPoseIds);
|
||||
QString snapshotXml;
|
||||
QXmlStreamWriter xmlStreamWriter(&snapshotXml);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef POSE_LIST_WIDGET_H
|
||||
#define POSE_LIST_WIDGET_H
|
||||
#ifndef DUST3D_POSE_LIST_WIDGET_H
|
||||
#define DUST3D_POSE_LIST_WIDGET_H
|
||||
#include <QTreeWidget>
|
||||
#include <map>
|
||||
#include <QMouseEvent>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "posewidget.h"
|
||||
|
||||
class PoseListWidget : public QTreeWidget
|
||||
|
@ -14,7 +14,7 @@ signals:
|
|||
void modifyPose(QUuid poseId);
|
||||
void cornerButtonClicked(QUuid poseId);
|
||||
public:
|
||||
PoseListWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
PoseListWidget(const Document *document, QWidget *parent=nullptr);
|
||||
bool isPoseSelected(QUuid poseId);
|
||||
public slots:
|
||||
void reload();
|
||||
|
@ -31,7 +31,7 @@ protected:
|
|||
private:
|
||||
int calculateColumnCount();
|
||||
void updatePoseSelectState(QUuid poseId, bool selected);
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
std::map<QUuid, std::pair<QTreeWidgetItem *, int>> m_itemMap;
|
||||
std::set<QUuid> m_selectedPoseIds;
|
||||
QUuid m_currentSelectedPoseId;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "poseeditwidget.h"
|
||||
#include "infolabel.h"
|
||||
|
||||
PoseManageWidget::PoseManageWidget(const SkeletonDocument *document, QWidget *parent) :
|
||||
PoseManageWidget::PoseManageWidget(const Document *document, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_document(document)
|
||||
{
|
||||
|
@ -35,8 +35,8 @@ PoseManageWidget::PoseManageWidget(const SkeletonDocument *document, QWidget *pa
|
|||
}
|
||||
};
|
||||
|
||||
connect(m_document, &SkeletonDocument::resultRigChanged, this, refreshInfoLabel);
|
||||
connect(m_document, &SkeletonDocument::cleanup, this, refreshInfoLabel);
|
||||
connect(m_document, &Document::resultRigChanged, this, refreshInfoLabel);
|
||||
connect(m_document, &Document::cleanup, this, refreshInfoLabel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(infoLabel);
|
||||
|
@ -66,7 +66,7 @@ void PoseManageWidget::showPoseDialog(QUuid poseId)
|
|||
PoseEditWidget *poseEditWidget = new PoseEditWidget(m_document);
|
||||
poseEditWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
if (!poseId.isNull()) {
|
||||
const SkeletonPose *pose = m_document->findPose(poseId);
|
||||
const Pose *pose = m_document->findPose(poseId);
|
||||
if (nullptr != pose) {
|
||||
poseEditWidget->setEditPoseId(poseId);
|
||||
poseEditWidget->setEditPoseName(pose->name);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef POSE_MANAGE_WIDGET_H
|
||||
#define POSE_MANAGE_WIDGET_H
|
||||
#ifndef DUST3D_POSE_MANAGE_WIDGET_H
|
||||
#define DUST3D_POSE_MANAGE_WIDGET_H
|
||||
#include <QWidget>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "poselistwidget.h"
|
||||
|
||||
class PoseManageWidget : public QWidget
|
||||
|
@ -11,7 +11,7 @@ signals:
|
|||
void registerDialog(QWidget *widget);
|
||||
void unregisterDialog(QWidget *widget);
|
||||
public:
|
||||
PoseManageWidget(const SkeletonDocument *document, QWidget *parent=nullptr);
|
||||
PoseManageWidget(const Document *document, QWidget *parent=nullptr);
|
||||
PoseListWidget *poseListWidget();
|
||||
protected:
|
||||
virtual QSize sizeHint() const;
|
||||
|
@ -19,7 +19,7 @@ public slots:
|
|||
void showAddPoseDialog();
|
||||
void showPoseDialog(QUuid poseId);
|
||||
private:
|
||||
const SkeletonDocument *m_document = nullptr;
|
||||
const Document *m_document = nullptr;
|
||||
PoseListWidget *m_poseListWidget = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#include "skinnedmeshcreator.h"
|
||||
|
||||
PoseMeshCreator::PoseMeshCreator(const std::vector<JointNode> &resultNodes,
|
||||
const MeshResultContext &meshResultContext,
|
||||
const Outcome &outcome,
|
||||
const std::map<int, AutoRiggerVertexWeights> &resultWeights) :
|
||||
m_resultNodes(resultNodes),
|
||||
m_meshResultContext(meshResultContext),
|
||||
m_outcome(outcome),
|
||||
m_resultWeights(resultWeights)
|
||||
{
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ MeshLoader *PoseMeshCreator::takeResultMesh()
|
|||
|
||||
void PoseMeshCreator::createMesh()
|
||||
{
|
||||
SkinnedMeshCreator skinnedMeshCreator(m_meshResultContext, m_resultWeights);
|
||||
SkinnedMeshCreator skinnedMeshCreator(m_outcome, m_resultWeights);
|
||||
|
||||
std::vector<QMatrix4x4> matricies;
|
||||
matricies.resize(m_resultNodes.size());
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef POSE_MESH_CREATOR_H
|
||||
#define POSE_MESH_CREATOR_H
|
||||
#ifndef DUST3D_POSE_MESH_CREATOR_H
|
||||
#define DUST3D_POSE_MESH_CREATOR_H
|
||||
#include <QObject>
|
||||
#include "meshloader.h"
|
||||
#include "jointnodetree.h"
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
|
||||
class PoseMeshCreator : public QObject
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ signals:
|
|||
void finished();
|
||||
public:
|
||||
PoseMeshCreator(const std::vector<JointNode> &resultNodes,
|
||||
const MeshResultContext &meshResultContext,
|
||||
const Outcome &outcome,
|
||||
const std::map<int, AutoRiggerVertexWeights> &resultWeights);
|
||||
~PoseMeshCreator();
|
||||
void createMesh();
|
||||
|
@ -21,7 +21,7 @@ public slots:
|
|||
void process();
|
||||
private:
|
||||
std::vector<JointNode> m_resultNodes;
|
||||
MeshResultContext m_meshResultContext;
|
||||
Outcome m_outcome;
|
||||
std::map<int, AutoRiggerVertexWeights> m_resultWeights;
|
||||
MeshLoader *m_resultMesh = nullptr;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ bool PosePreviewManager::isRendering()
|
|||
}
|
||||
|
||||
bool PosePreviewManager::postUpdate(const Poser &poser,
|
||||
const MeshResultContext &meshResultContext,
|
||||
const Outcome &outcome,
|
||||
const std::map<int, AutoRiggerVertexWeights> &resultWeights)
|
||||
{
|
||||
if (nullptr != m_poseMeshCreator)
|
||||
|
@ -26,7 +26,7 @@ bool PosePreviewManager::postUpdate(const Poser &poser,
|
|||
qDebug() << "Pose mesh generating..";
|
||||
|
||||
QThread *thread = new QThread;
|
||||
m_poseMeshCreator = new PoseMeshCreator(poser.resultNodes(), meshResultContext, resultWeights);
|
||||
m_poseMeshCreator = new PoseMeshCreator(poser.resultNodes(), outcome, resultWeights);
|
||||
m_poseMeshCreator->moveToThread(thread);
|
||||
connect(thread, &QThread::started, m_poseMeshCreator, &PoseMeshCreator::process);
|
||||
connect(m_poseMeshCreator, &PoseMeshCreator::finished, this, &PosePreviewManager::poseMeshReady);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef POSE_PREVIEW_MANAGER_H
|
||||
#define POSE_PREVIEW_MANAGER_H
|
||||
#ifndef DUST3D_POSE_PREVIEW_MANAGER_H
|
||||
#define DUST3D_POSE_PREVIEW_MANAGER_H
|
||||
#include <QWidget>
|
||||
#include "skeletondocument.h"
|
||||
#include "document.h"
|
||||
#include "poser.h"
|
||||
#include "posemeshcreator.h"
|
||||
#include "meshloader.h"
|
||||
|
@ -14,7 +14,7 @@ public:
|
|||
~PosePreviewManager();
|
||||
bool isRendering();
|
||||
bool postUpdate(const Poser &poser,
|
||||
const MeshResultContext &meshResultContext,
|
||||
const Outcome &outcome,
|
||||
const std::map<int, AutoRiggerVertexWeights> &resultWeights);
|
||||
MeshLoader *takeResultPreviewMesh();
|
||||
private slots:
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
PosePreviewsGenerator::PosePreviewsGenerator(const std::vector<AutoRiggerBone> *rigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *rigWeights,
|
||||
const MeshResultContext &meshResultContext) :
|
||||
const Outcome &outcome) :
|
||||
m_rigBones(*rigBones),
|
||||
m_rigWeights(*rigWeights),
|
||||
m_meshResultContext(new MeshResultContext(meshResultContext))
|
||||
m_outcome(new Outcome(outcome))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ PosePreviewsGenerator::~PosePreviewsGenerator()
|
|||
for (auto &item: m_previews) {
|
||||
delete item.second;
|
||||
}
|
||||
delete m_meshResultContext;
|
||||
delete m_outcome;
|
||||
}
|
||||
|
||||
void PosePreviewsGenerator::addPose(QUuid poseId, const std::map<QString, std::map<QString, QString>> &pose)
|
||||
|
@ -48,7 +48,7 @@ void PosePreviewsGenerator::process()
|
|||
poser->parameters() = pose.second;
|
||||
poser->commit();
|
||||
|
||||
PoseMeshCreator *poseMeshCreator = new PoseMeshCreator(poser->resultNodes(), *m_meshResultContext, m_rigWeights);
|
||||
PoseMeshCreator *poseMeshCreator = new PoseMeshCreator(poser->resultNodes(), *m_outcome, m_rigWeights);
|
||||
poseMeshCreator->createMesh();
|
||||
m_previews[pose.first] = poseMeshCreator->takeResultMesh();
|
||||
delete poseMeshCreator;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef POSE_PREVIEWS_GENERATOR_H
|
||||
#define POSE_PREVIEWS_GENERATOR_H
|
||||
#ifndef DUST3D_POSE_PREVIEWS_GENERATOR_H
|
||||
#define DUST3D_POSE_PREVIEWS_GENERATOR_H
|
||||
#include <QObject>
|
||||
#include <map>
|
||||
#include <QUuid>
|
||||
#include <vector>
|
||||
#include "meshloader.h"
|
||||
#include "autorigger.h"
|
||||
#include "meshresultcontext.h"
|
||||
#include "outcome.h"
|
||||
|
||||
class PosePreviewsGenerator : public QObject
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ class PosePreviewsGenerator : public QObject
|
|||
public:
|
||||
PosePreviewsGenerator(const std::vector<AutoRiggerBone> *rigBones,
|
||||
const std::map<int, AutoRiggerVertexWeights> *rigWeights,
|
||||
const MeshResultContext &meshResultContext);
|
||||
const Outcome &outcome);
|
||||
~PosePreviewsGenerator();
|
||||
void addPose(QUuid poseId, const std::map<QString, std::map<QString, QString>> &pose);
|
||||
const std::set<QUuid> &generatedPreviewPoseIds();
|
||||
|
@ -26,7 +26,7 @@ public slots:
|
|||
private:
|
||||
std::vector<AutoRiggerBone> m_rigBones;
|
||||
std::map<int, AutoRiggerVertexWeights> m_rigWeights;
|
||||
MeshResultContext *m_meshResultContext = nullptr;
|
||||
Outcome *m_outcome = nullptr;
|
||||
std::vector<std::pair<QUuid, std::map<QString, std::map<QString, QString>>>> m_poses;
|
||||
std::map<QUuid, MeshLoader *> m_previews;
|
||||
std::set<QUuid> m_generatedPoseIds;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef POSER_H
|
||||
#define POSER_H
|
||||
#ifndef DUST3D_POSER_H
|
||||
#define DUST3D_POSER_H
|
||||
#include <QObject>
|
||||
#include "autorigger.h"
|
||||
#include "jointnodetree.h"
|
||||
#include "dust3dutil.h"
|
||||
#include "util.h"
|
||||
|
||||
class Poser : public QObject
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue