Update section preview

master
Jeremy HU 2022-11-04 22:41:57 +11:00
parent a7b2caecfc
commit 358f08d593
2 changed files with 4 additions and 4 deletions

View File

@ -1161,9 +1161,12 @@ void DocumentWindow::generateComponentPreviewImages()
continue; continue;
component.second.isPreviewMeshObsolete = false; component.second.isPreviewMeshObsolete = false;
auto previewMesh = std::unique_ptr<ModelMesh>(component.second.takePreviewMesh()); auto previewMesh = std::unique_ptr<ModelMesh>(component.second.takePreviewMesh());
bool useFrontView = false;
if (!component.second.linkToPartId.isNull()) { if (!component.second.linkToPartId.isNull()) {
const auto& part = m_document->findPart(component.second.linkToPartId); const auto& part = m_document->findPart(component.second.linkToPartId);
if (nullptr != part) { if (nullptr != part) {
if (dust3d::PartTarget::CutFace == part->target)
useFrontView = true;
if (!part->colorImageId.isNull()) { if (!part->colorImageId.isNull()) {
const auto& colorImage = ImageForever::get(part->colorImageId); const auto& colorImage = ImageForever::get(part->colorImageId);
if (nullptr != colorImage) { if (nullptr != colorImage) {
@ -1172,7 +1175,7 @@ void DocumentWindow::generateComponentPreviewImages()
} }
} }
} }
m_componentPreviewImagesGenerator->addInput(component.first, std::move(previewMesh)); m_componentPreviewImagesGenerator->addInput(component.first, std::move(previewMesh), useFrontView);
} }
m_componentPreviewImagesGenerator->moveToThread(thread); m_componentPreviewImagesGenerator->moveToThread(thread);
connect(thread, &QThread::started, m_componentPreviewImagesGenerator, &MeshPreviewImagesGenerator::process); connect(thread, &QThread::started, m_componentPreviewImagesGenerator, &MeshPreviewImagesGenerator::process);

View File

@ -83,9 +83,6 @@ void SectionPreviewMeshBuilder::build()
ropeParameters.defaultRadius = 0.075; ropeParameters.defaultRadius = 0.075;
RopeMesh ropeMesh(ropeParameters); RopeMesh ropeMesh(ropeParameters);
ropeMesh.addRope(cutFaceVertices, true); ropeMesh.addRope(cutFaceVertices, true);
for (size_t i = 0; i < cutFaceVertices.size(); ++i) {
ropeMesh.addRope({ cutFaceVertices[i], cutFaceVertices[i] - Vector3(0.0, 0.0, 1.5) }, false);
}
for (const auto& it : ropeMesh.resultVertices()) { for (const auto& it : ropeMesh.resultVertices()) {
m_resultVertices.push_back(it); m_resultVertices.push_back(it);
m_resultVertexProperties.emplace_back(frameVertexProperty); m_resultVertexProperties.emplace_back(frameVertexProperty);