mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-11 19:17:33 +00:00
Merge pull request #170 from Snapmaker/dev_2.3.0_alves
fix a crash caused by a consumables transparency issue.
This commit is contained in:
@@ -3055,29 +3055,19 @@ void SSWCP_MachineOption_Instance::sw_GetFileFilamentMapping()
|
|||||||
|
|
||||||
long long res = 0;
|
long long res = 0;
|
||||||
if ((oriclr.size() != 7 && oriclr.size() != 9) || oriclr[0] != '#') {
|
if ((oriclr.size() != 7 && oriclr.size() != 9) || oriclr[0] != '#') {
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oriclr.size() == 7) {
|
auto colorSize = oriclr.size();//7 or 9
|
||||||
for (int i = 1; i <= 6; ++i) {
|
for (auto i = 1; i < colorSize; i++)
|
||||||
if (oriclr[7 - i] - '0' >= 0 && oriclr[7 - i] - '0' <= 9) {
|
{
|
||||||
res += std::pow(16, i - 1) * (oriclr[7 - i] - '0');
|
if (oriclr[colorSize - i] - '0' >= 0 && oriclr[colorSize - i] - '0' <= 9) {
|
||||||
} else {
|
res += std::pow(16, i - 1) * (oriclr[colorSize - i] - '0');
|
||||||
res += std::pow(16, i - 1) * (oriclr[7 - i] - 'A' + 10);
|
} else {
|
||||||
}
|
res += std::pow(16, i - 1) * (oriclr[colorSize - i] - 'A' + 10);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (int i = 1; i <= 8; ++i) {
|
|
||||||
if (oriclr[7 - i] - '0' >= 0 && oriclr[7 - i] - '0' <= 9) {
|
|
||||||
res += std::pow(16, i - 1) * (oriclr[7 - i] - '0');
|
|
||||||
} else {
|
|
||||||
res += std::pow(16, i - 1) * (oriclr[7 - i] - 'A' + 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user