From 231d3f38cf8aa18de51616df6e43b2b498a113e1 Mon Sep 17 00:00:00 2001 From: Jeremy HU Date: Mon, 7 Nov 2022 23:13:11 +1100 Subject: [PATCH] Prepare bone functions --- application/sources/document.cc | 35 +++++++++++++++++++++++++++++++++ application/sources/document.h | 17 ++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/application/sources/document.cc b/application/sources/document.cc index c3d8fab1..8d1a169b 100644 --- a/application/sources/document.cc +++ b/application/sources/document.cc @@ -20,6 +20,11 @@ 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) { if (toRadius < MeshGenerator::m_minimalRadius) @@ -2775,3 +2780,33 @@ void Document::collectCutFaceList(std::vector& cutFaces) const for (const auto& it : cutFacePartIdList) 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& nodeIds) +{ + // TODO: +} + +void Document::removeNodesFromBone(const dust3d::Uuid& boneId, const std::vector& 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: +} diff --git a/application/sources/document.h b/application/sources/document.h index 1df5f665..4bdab676 100644 --- a/application/sources/document.h +++ b/application/sources/document.h @@ -561,6 +561,15 @@ public: std::set m_childrenIdSet; }; + class Bone { + public: + dust3d::Uuid id; + dust3d::Uuid parentId; + std::vector childrenIds; + + Bone(const dust3d::Uuid& withId = dust3d::Uuid()); + }; + signals: void nodeCutRotationChanged(dust3d::Uuid nodeId); void nodeCutFaceChanged(dust3d::Uuid nodeId); @@ -656,7 +665,9 @@ public: // need initialize std::map nodeMap; std::map edgeMap; std::map componentMap; + std::map boneMap; Component rootComponent; + Bone rootBone; public: Document(); @@ -851,6 +862,12 @@ public slots: void setYlockState(bool locked); void setZlockState(bool locked); void setRadiusLockState(bool locked); + void addBone(const dust3d::Uuid& boneId); + void addNodesToBone(const dust3d::Uuid& boneId, const std::vector& nodeIds); + void removeNodesFromBone(const dust3d::Uuid& boneId, const std::vector& 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: void resolveSnapshotBoundingBox(const dust3d::Snapshot& snapshot, QRectF* mainProfile, QRectF* sideProfile);