mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-11 11:07:40 +00:00
FIX:add error deal:mtl file lost some material
jira: github 5687 Change-Id: I2394d27b027cfe34ac3cb260735aceaee65ff6d9 (cherry picked from commit 58f9c7d0b2800c4b8b67991f5d3e43d57a6cd1eb)
This commit is contained in:
@@ -170,6 +170,11 @@ bool load_obj(const char *path, TriangleMesh *meshptr, ObjInfo& obj_info, std::s
|
||||
}
|
||||
obj_info.face_colors.emplace_back(face_color);
|
||||
}
|
||||
else {
|
||||
if (obj_info.lost_material_name.empty()) {
|
||||
obj_info.lost_material_name = mtl_name;
|
||||
}
|
||||
}
|
||||
};
|
||||
auto set_face_color_by_mtl = [&data, &set_face_color](int face_index) {
|
||||
if (data.usemtls.size() == 1) {
|
||||
|
||||
@@ -12,6 +12,7 @@ struct ObjInfo {
|
||||
std::vector<RGBA> vertex_colors;
|
||||
std::vector<RGBA> face_colors;
|
||||
bool is_single_mtl{false};
|
||||
std::string lost_material_name{""};
|
||||
std::vector<std::array<Vec2f,3>> uvs;
|
||||
std::string obj_dircetory;
|
||||
std::map<std::string,bool> pngs;
|
||||
@@ -28,6 +29,7 @@ struct ObjDialogInOut
|
||||
unsigned char first_extruder_id;
|
||||
bool deal_vertex_color;
|
||||
Model * model{nullptr};
|
||||
std::string lost_material_name{""};
|
||||
};
|
||||
typedef std::function<void(ObjDialogInOut &in_out)> ObjImportColorFn;
|
||||
extern bool load_obj(const char *path, TriangleMesh *mesh, ObjInfo &vertex_colors, std::string &message);
|
||||
|
||||
Reference in New Issue
Block a user