Reduced size of GCodeProcessor::MoveVertex
This commit is contained in:
parent
57dad5dfd2
commit
2c69d96239
@ -232,9 +232,9 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||
pos = comment.find_last_of(",T");
|
||||
try
|
||||
{
|
||||
unsigned int extruder_id = (pos == comment.npos) ? 0 : static_cast<unsigned int>(std::stoi(comment.substr(pos + 1, comment.npos)));
|
||||
unsigned char extruder_id = (pos == comment.npos) ? 0 : static_cast<unsigned char>(std::stoi(comment.substr(pos + 1, comment.npos)));
|
||||
|
||||
m_extruders_color[extruder_id] = static_cast<unsigned int>(m_extruder_offsets.size()) + m_cp_color.counter; // color_change position in list of color for preview
|
||||
m_extruders_color[extruder_id] = static_cast<unsigned char>(m_extruder_offsets.size()) + m_cp_color.counter; // color_change position in list of color for preview
|
||||
++m_cp_color.counter;
|
||||
|
||||
if (m_extruder_id == extruder_id)
|
||||
@ -252,7 +252,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||
pos = comment.find(Pause_Print_Tag);
|
||||
if (pos != comment.npos)
|
||||
{
|
||||
m_cp_color.current = INT_MAX;
|
||||
m_cp_color.current = 255;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||
pos = comment.find(Custom_Code_Tag);
|
||||
if (pos != comment.npos)
|
||||
{
|
||||
m_cp_color.current = INT_MAX;
|
||||
m_cp_color.current = 255;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
||||
pos = comment.find(End_Pause_Print_Or_Custom_Code_Tag);
|
||||
if (pos != comment.npos)
|
||||
{
|
||||
if (m_cp_color.current == INT_MAX)
|
||||
if (m_cp_color.current == 255)
|
||||
m_cp_color.current = m_extruders_color[m_extruder_id];
|
||||
|
||||
return;
|
||||
@ -556,16 +556,16 @@ void GCodeProcessor::process_T(const std::string& command)
|
||||
{
|
||||
try
|
||||
{
|
||||
unsigned int id = static_cast<unsigned int>(std::stoi(command.substr(1)));
|
||||
unsigned char id = static_cast<unsigned char>(std::stoi(command.substr(1)));
|
||||
if (m_extruder_id != id)
|
||||
{
|
||||
unsigned int extruders_count = static_cast<unsigned int>(m_extruder_offsets.size());
|
||||
unsigned char extruders_count = static_cast<unsigned char>(m_extruder_offsets.size());
|
||||
if (id >= extruders_count)
|
||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid toolchange, maybe from a custom gcode.";
|
||||
else
|
||||
{
|
||||
m_extruder_id = id;
|
||||
if (m_cp_color.current != INT_MAX)
|
||||
if (m_cp_color.current != 255)
|
||||
m_cp_color.current = m_extruders_color[id];
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace Slic3r {
|
||||
|
||||
private:
|
||||
using AxisCoords = std::array<float, 4>;
|
||||
using ExtrudersColor = std::vector<unsigned int>;
|
||||
using ExtrudersColor = std::vector<unsigned char>;
|
||||
|
||||
enum class EUnits : unsigned char
|
||||
{
|
||||
@ -60,8 +60,8 @@ namespace Slic3r {
|
||||
|
||||
struct CpColor
|
||||
{
|
||||
unsigned int counter;
|
||||
unsigned int current;
|
||||
unsigned char counter;
|
||||
unsigned char current;
|
||||
|
||||
void reset();
|
||||
};
|
||||
@ -71,14 +71,14 @@ namespace Slic3r {
|
||||
{
|
||||
EMoveType type{ EMoveType::Noop };
|
||||
ExtrusionRole extrusion_role{ erNone };
|
||||
unsigned char extruder_id{ 0 };
|
||||
unsigned char cp_color_id{ 0 };
|
||||
Vec3f position{ Vec3f::Zero() }; // mm
|
||||
float feedrate{ 0.0f }; // mm/s
|
||||
float width{ 0.0f }; // mm
|
||||
float height{ 0.0f }; // mm
|
||||
float mm3_per_mm{ 0.0f };
|
||||
float fan_speed{ 0.0f }; // percentage
|
||||
unsigned int extruder_id{ 0 };
|
||||
unsigned int cp_color_id{ 0 };
|
||||
|
||||
std::string to_string() const
|
||||
{
|
||||
@ -122,7 +122,7 @@ namespace Slic3r {
|
||||
float m_mm3_per_mm;
|
||||
float m_fan_speed; // percentage
|
||||
ExtrusionRole m_extrusion_role;
|
||||
unsigned int m_extruder_id;
|
||||
unsigned char m_extruder_id;
|
||||
ExtrudersColor m_extruders_color;
|
||||
CpColor m_cp_color;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user