From 8e104236858d4abfd673c5d1db43f2a6f17c49f0 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Wed, 26 Apr 2023 16:20:47 +0800 Subject: [PATCH] FIX: fix the shared mesh not loaded issue sometimes the root mesh is loaded after the shared mesh we need to treat the shared mesh loaded at first as the root mesh Change-Id: Ibc6f6a07c5069f3dc9471a129c2f434b48f486e9 --- src/libslic3r/Format/bbs_3mf.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index 5f447f91a0..37616d138b 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -4095,6 +4095,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) ModelVolume* volume = nullptr; ModelVolume *shared_volume = nullptr; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": line %1%, subobject_id %2%, shared_mesh_id %3%")%__LINE__ %sub_object->id %shared_mesh_id; if (shared_mesh_id != -1) { std::map::iterator iter = m_shared_meshes.find(shared_mesh_id); if (iter != m_shared_meshes.end()) { @@ -4102,6 +4103,14 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": line %1%, found shared mesh, id %2%, mesh %3%")%__LINE__%shared_mesh_id%shared_volume; } } + else { + //for some cases, object point to this shared mesh already loaded, treat that one as the root + std::map::iterator iter = m_shared_meshes.find(sub_object->id); + if (iter != m_shared_meshes.end()) { + shared_volume = iter->second; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": line %1%, already loaded copy-share mesh before, id %2%, mesh %3%")%__LINE__%sub_object->id%shared_volume; + } + } const size_t triangles_count = sub_object->geometry.triangles.size(); if (triangles_count == 0) {