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