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
This commit is contained in:
lane.wei 2023-04-26 16:20:47 +08:00 committed by Lane.Wei
parent 3d8b1408ec
commit 8e10423685

View file

@ -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<int, ModelVolume*>::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<int, ModelVolume*>::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) {