FIX:fix obj import crash
jira: github 6333 Change-Id: I3df9edce95b24751f39bcdcbe75e7050fede68a1 (cherry picked from commit 46678882ed2630f3e4593fa4176cec64e8e5ed13)
This commit is contained in:
parent
a52a466e80
commit
cb5ac14fd3
|
@ -49,8 +49,9 @@
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
const std::vector<std::string> CONST_FILAMENTS = {
|
const std::vector<std::string> CONST_FILAMENTS = {
|
||||||
"", "4", "8", "0C", "1C", "2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "AC", "BC", "CC", "DC",
|
"", "4", "8", "0C", "1C", "2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "AC", "BC", "CC","DC",//16
|
||||||
}; // 5 10 15 16
|
"EC", "0FC", "1FC", "2FC", "3FC", "4FC", "5FC", "6FC", "7FC", "8FC", "9FC", "AFC", "BFC", "CFC", "DFC", "EFC",//32
|
||||||
|
}; // 1 5 10 15 16
|
||||||
// BBS initialization of static variables
|
// BBS initialization of static variables
|
||||||
std::map<size_t, ExtruderParams> Model::extruderParamsMap = { {0,{"",0,0}}};
|
std::map<size_t, ExtruderParams> Model::extruderParamsMap = { {0,{"",0,0}}};
|
||||||
GlobalSpeedMap Model::printSpeedMap{};
|
GlobalSpeedMap Model::printSpeedMap{};
|
||||||
|
@ -3629,6 +3630,7 @@ static void get_real_filament_id(const unsigned char &id, std::string &result) {
|
||||||
if (id < CONST_FILAMENTS.size()) {
|
if (id < CONST_FILAMENTS.size()) {
|
||||||
result = CONST_FILAMENTS[id];
|
result = CONST_FILAMENTS[id];
|
||||||
} else {
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "check error:CONST_FILAMENTS out of array ";
|
||||||
result = "";//error
|
result = "";//error
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1680,9 +1680,9 @@ std::pair<std::vector<std::pair<int, int>>, std::vector<bool>> TriangleSelector:
|
||||||
if (n >= 3) {
|
if (n >= 3) {
|
||||||
data.second.insert(data.second.end(), {true, true});
|
data.second.insert(data.second.end(), {true, true});
|
||||||
n -= 3;
|
n -= 3;
|
||||||
while (n >= 16) {
|
while (n >= 15) {
|
||||||
data.second.insert(data.second.end(), {true, true, true, true});
|
data.second.insert(data.second.end(), {true, true, true, true});
|
||||||
n -= 16;
|
n -= 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t bit_idx = 0; bit_idx < 4; ++bit_idx)
|
for (size_t bit_idx = 0; bit_idx < 4; ++bit_idx)
|
||||||
|
@ -1771,7 +1771,7 @@ void TriangleSelector::deserialize(const std::pair<std::vector<std::pair<int, in
|
||||||
num++;
|
num++;
|
||||||
next_code = next_nibble();
|
next_code = next_nibble();
|
||||||
}
|
}
|
||||||
state = EnforcerBlockerType(next_code + 16 * num + (code >> 2));
|
state = EnforcerBlockerType(next_code + 15 * num + 3);//old:next_nibble() + 3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state = EnforcerBlockerType(code >> 2);
|
state = EnforcerBlockerType(code >> 2);
|
||||||
|
@ -1871,9 +1871,23 @@ bool TriangleSelector::has_facets(const std::pair<std::vector<std::pair<int, int
|
||||||
auto num_children_or_state = [&next_nibble]() -> int {
|
auto num_children_or_state = [&next_nibble]() -> int {
|
||||||
int code = next_nibble();
|
int code = next_nibble();
|
||||||
int num_of_split_sides = code & 0b11;
|
int num_of_split_sides = code & 0b11;
|
||||||
return num_of_split_sides == 0 ?
|
if (num_of_split_sides == 0) {
|
||||||
((code & 0b1100) == 0b1100 ? next_nibble() + 3 : code >> 2) :
|
int state = 0;
|
||||||
- num_of_split_sides - 1;
|
if ((code & 0b1100) == 0b1100) {
|
||||||
|
int next_code = next_nibble();
|
||||||
|
int num = 0;
|
||||||
|
while (next_code == 0b1111) {
|
||||||
|
num++;
|
||||||
|
next_code = next_nibble();
|
||||||
|
}
|
||||||
|
state = next_code + 15 * num + 3; // old:next_nibble() + 3;
|
||||||
|
} else {
|
||||||
|
state = code >> 2;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
} else {
|
||||||
|
return -num_of_split_sides - 1;// < 0 -> negative of a number of children
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int state = num_children_or_state();
|
int state = num_children_or_state();
|
||||||
|
|
Loading…
Reference in New Issue