Skip to content

Commit

Permalink
Fix component preview crash
Browse files Browse the repository at this point in the history
  • Loading branch information
huxingyi committed Jan 10, 2023
1 parent 870897c commit 03efbc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions application/sources/document_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,8 @@ void DocumentWindow::generateComponentPreviewImages()
continue;
component.second.isPreviewMeshObsolete = false;
auto previewMesh = std::unique_ptr<ModelMesh>(component.second.takePreviewMesh());
if (nullptr == previewMesh)
continue;
bool useFrontView = false;
if (!component.second.linkToPartId.isNull()) {
const auto& part = m_document->findPart(component.second.linkToPartId);
Expand Down
7 changes: 7 additions & 0 deletions application/sources/uv_map_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "image_forever.h"
#include <QMatrix>
#include <QPainter>
#include <dust3d/base/part_target.h>
#include <dust3d/uv/uv_map_packer.h>
#include <unordered_set>

Expand Down Expand Up @@ -97,6 +98,9 @@ void UvMapGenerator::packUvs()
m_mapPacker = std::make_unique<dust3d::UvMapPacker>();

for (const auto& partIt : m_snapshot->parts) {
auto partTarget = dust3d::PartTargetFromString(dust3d::String::valueOrEmpty(partIt.second, "target").c_str());
if (dust3d::PartTarget::Model != partTarget)
continue;
dust3d::Uuid imageId;
dust3d::Color color(1.0, 1.0, 1.0);
double width = 1.0;
Expand Down Expand Up @@ -126,6 +130,9 @@ void UvMapGenerator::packUvs()
m_mapPacker->addPart(part);
}

// Combining stitching line texture image
// TODO: ...

m_mapPacker->addSeams(m_object->seamTriangleUvs);

m_mapPacker->pack();
Expand Down

0 comments on commit 03efbc7

Please sign in to comment.