Prepare bone functions

master
Jeremy HU 2022-11-07 23:13:11 +11:00
parent 9aef6b1855
commit 231d3f38cf
2 changed files with 52 additions and 0 deletions

View File

@ -20,6 +20,11 @@
unsigned long Document::m_maxSnapshot = 1000; unsigned long Document::m_maxSnapshot = 1000;
Document::Bone::Bone(const dust3d::Uuid& withId)
{
id = withId.isNull() ? dust3d::Uuid::createUuid() : withId;
}
void Document::Node::setRadius(float toRadius) void Document::Node::setRadius(float toRadius)
{ {
if (toRadius < MeshGenerator::m_minimalRadius) if (toRadius < MeshGenerator::m_minimalRadius)
@ -2775,3 +2780,33 @@ void Document::collectCutFaceList(std::vector<QString>& cutFaces) const
for (const auto& it : cutFacePartIdList) for (const auto& it : cutFacePartIdList)
cutFaces.push_back(QString(it.toString().c_str())); cutFaces.push_back(QString(it.toString().c_str()));
} }
void Document::addBone(const dust3d::Uuid& boneId)
{
// TODO:
}
void Document::addNodesToBone(const dust3d::Uuid& boneId, const std::vector<dust3d::Uuid>& nodeIds)
{
// TODO:
}
void Document::removeNodesFromBone(const dust3d::Uuid& boneId, const std::vector<dust3d::Uuid>& nodeIds)
{
// TODO:
}
void Document::markNodeAsJointForBone(const dust3d::Uuid& boneId, const dust3d::Uuid& nodeId)
{
// TODO:
}
void Document::markNodeAsNotJointForBone(const dust3d::Uuid& boneId, const dust3d::Uuid& nodeId)
{
// TODO:
}
void Document::removeBone(const dust3d::Uuid& boneId)
{
// TODO:
}

View File

@ -561,6 +561,15 @@ public:
std::set<dust3d::Uuid> m_childrenIdSet; std::set<dust3d::Uuid> m_childrenIdSet;
}; };
class Bone {
public:
dust3d::Uuid id;
dust3d::Uuid parentId;
std::vector<dust3d::Uuid> childrenIds;
Bone(const dust3d::Uuid& withId = dust3d::Uuid());
};
signals: signals:
void nodeCutRotationChanged(dust3d::Uuid nodeId); void nodeCutRotationChanged(dust3d::Uuid nodeId);
void nodeCutFaceChanged(dust3d::Uuid nodeId); void nodeCutFaceChanged(dust3d::Uuid nodeId);
@ -656,7 +665,9 @@ public: // need initialize
std::map<dust3d::Uuid, Node> nodeMap; std::map<dust3d::Uuid, Node> nodeMap;
std::map<dust3d::Uuid, Edge> edgeMap; std::map<dust3d::Uuid, Edge> edgeMap;
std::map<dust3d::Uuid, Component> componentMap; std::map<dust3d::Uuid, Component> componentMap;
std::map<dust3d::Uuid, Bone> boneMap;
Component rootComponent; Component rootComponent;
Bone rootBone;
public: public:
Document(); Document();
@ -851,6 +862,12 @@ public slots:
void setYlockState(bool locked); void setYlockState(bool locked);
void setZlockState(bool locked); void setZlockState(bool locked);
void setRadiusLockState(bool locked); void setRadiusLockState(bool locked);
void addBone(const dust3d::Uuid& boneId);
void addNodesToBone(const dust3d::Uuid& boneId, const std::vector<dust3d::Uuid>& nodeIds);
void removeNodesFromBone(const dust3d::Uuid& boneId, const std::vector<dust3d::Uuid>& nodeIds);
void markNodeAsJointForBone(const dust3d::Uuid& boneId, const dust3d::Uuid& nodeId);
void markNodeAsNotJointForBone(const dust3d::Uuid& boneId, const dust3d::Uuid& nodeId);
void removeBone(const dust3d::Uuid& boneId);
private: private:
void resolveSnapshotBoundingBox(const dust3d::Snapshot& snapshot, QRectF* mainProfile, QRectF* sideProfile); void resolveSnapshotBoundingBox(const dust3d::Snapshot& snapshot, QRectF* mainProfile, QRectF* sideProfile);