Enable three nodes branch on gridded part

master
Jeremy Hu 2019-12-15 11:44:04 +09:30
parent 4f6c82d825
commit 40a6968599
4 changed files with 16 additions and 5 deletions

View File

@ -421,14 +421,17 @@ void GridMeshBuilder::setSubdived(bool subdived)
m_subdived = subdived;
}
void GridMeshBuilder::build()
bool GridMeshBuilder::build()
{
if (m_subdived)
applyModifiers();
prepareNodeVertices();
findCycles();
if (m_cycles.empty())
return false;
generateFaces();
extrude();
return true;
}
void GridMeshBuilder::findCycles()
@ -442,3 +445,4 @@ void GridMeshBuilder::findCycles()
cycleFinder.find();
m_cycles = cycleFinder.getCycles();
}

View File

@ -25,7 +25,7 @@ public:
size_t addNode(const QVector3D &position, float radius);
size_t addEdge(size_t firstNodeIndex, size_t secondNodeIndex);
void setSubdived(bool subdived);
void build();
bool build();
const std::vector<QVector3D> &getGeneratedPositions();
const std::vector<size_t> &getGeneratedSources();
const std::vector<std::vector<size_t>> &getGeneratedFaces();

View File

@ -580,8 +580,7 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
if (subdived)
gridMeshBuilder->setSubdived(true);
gridMeshBuilder->build();
buildSucceed = true;
buildSucceed = gridMeshBuilder->build();
partCache.vertices = gridMeshBuilder->getGeneratedPositions();
partCache.faces = gridMeshBuilder->getGeneratedFaces();

View File

@ -73,5 +73,13 @@ void SkeletonDocument::findAllNeighbors(QUuid nodeId, std::set<QUuid> &neighbors
bool SkeletonDocument::isNodeConnectable(QUuid nodeId) const
{
const auto &node = findNode(nodeId);
if (nullptr == node)
return false;
if (node->edgeIds.size() < 2)
return true;
const SkeletonPart *part = findPart(node->partId);
if (nullptr == part)
return false;
return part->gridded;
}