Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_contours
This commit is contained in:
commit
c9aa88db0d
10 changed files with 2 additions and 167 deletions
|
@ -836,11 +836,9 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
|||
m_time_processor.export_remaining_time_enabled = config.remaining_times.value;
|
||||
m_use_volumetric_e = config.use_volumetric_e;
|
||||
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
const ConfigOptionFloatOrPercent* first_layer_height = config.option<ConfigOptionFloatOrPercent>("first_layer_height");
|
||||
if (first_layer_height != nullptr)
|
||||
m_first_layer_height = std::abs(first_layer_height->value);
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
}
|
||||
|
||||
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||
|
@ -1065,11 +1063,9 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
|||
if (use_volumetric_e != nullptr)
|
||||
m_use_volumetric_e = use_volumetric_e->value;
|
||||
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
const ConfigOptionFloatOrPercent* first_layer_height = config.option<ConfigOptionFloatOrPercent>("first_layer_height");
|
||||
if (first_layer_height != nullptr)
|
||||
m_first_layer_height = std::abs(first_layer_height->value);
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
}
|
||||
|
||||
void GCodeProcessor::enable_stealth_time_estimator(bool enabled)
|
||||
|
@ -1092,9 +1088,7 @@ void GCodeProcessor::reset()
|
|||
m_wiping = false;
|
||||
|
||||
m_line_id = 0;
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
m_last_line_id = 0;
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
m_feedrate = 0.0f;
|
||||
m_width = 0.0f;
|
||||
m_height = 0.0f;
|
||||
|
@ -1115,10 +1109,8 @@ void GCodeProcessor::reset()
|
|||
}
|
||||
|
||||
m_extruded_last_z = 0.0f;
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
m_first_layer_height = 0.0f;
|
||||
m_processing_start_custom_gcode = false;
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
m_g1_line_id = 0;
|
||||
m_layer_id = 0;
|
||||
m_cp_color.reset();
|
||||
|
@ -1493,13 +1485,9 @@ void GCodeProcessor::process_tags(const std::string_view comment)
|
|||
// extrusion role tag
|
||||
if (boost::starts_with(comment, reserved_tag(ETags::Role))) {
|
||||
set_extrusion_role(ExtrusionEntity::string_to_role(comment.substr(reserved_tag(ETags::Role).length())));
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
if (m_extrusion_role == erExternalPerimeter)
|
||||
m_seams_detector.activate(true);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
m_processing_start_custom_gcode = (m_extrusion_role == erCustom && m_g1_line_id == 0);
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1637,10 +1625,9 @@ bool GCodeProcessor::process_cura_tags(const std::string_view comment)
|
|||
BOOST_LOG_TRIVIAL(warning) << "GCodeProcessor found unknown extrusion role: " << type;
|
||||
}
|
||||
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
if (m_extrusion_role == erExternalPerimeter)
|
||||
m_seams_detector.activate(true);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1705,9 +1692,7 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment)
|
|||
pos = cmt.find(" outer perimeter");
|
||||
if (pos == 0) {
|
||||
set_extrusion_role(erExternalPerimeter);
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
m_seams_detector.activate(true);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1862,10 +1847,8 @@ bool GCodeProcessor::process_craftware_tags(const std::string_view comment)
|
|||
BOOST_LOG_TRIVIAL(warning) << "GCodeProcessor found unknown extrusion role: " << type;
|
||||
}
|
||||
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
if (m_extrusion_role == erExternalPerimeter)
|
||||
m_seams_detector.activate(true);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1906,10 +1889,9 @@ bool GCodeProcessor::process_ideamaker_tags(const std::string_view comment)
|
|||
BOOST_LOG_TRIVIAL(warning) << "GCodeProcessor found unknown extrusion role: " << type;
|
||||
}
|
||||
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
if (m_extrusion_role == erExternalPerimeter)
|
||||
m_seams_detector.activate(true);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1978,9 +1960,7 @@ bool GCodeProcessor::process_kissslicer_tags(const std::string_view comment)
|
|||
pos = comment.find(" 'Perimeter Path'");
|
||||
if (pos == 0) {
|
||||
set_extrusion_role(erExternalPerimeter);
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
m_seams_detector.activate(true);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2187,11 +2167,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
}
|
||||
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
if (type == EMoveType::Extrude && (m_width == 0.0f || m_height == 0.0f))
|
||||
#else
|
||||
if (type == EMoveType::Extrude && (m_extrusion_role == erCustom || m_width == 0.0f || m_height == 0.0f))
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
type = EMoveType::Travel;
|
||||
|
||||
// time estimate section
|
||||
|
@ -2358,7 +2334,6 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||
machine.calculate_time(TimeProcessor::Planner::queue_size);
|
||||
}
|
||||
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
if (m_seams_detector.is_active()) {
|
||||
// check for seam starting vertex
|
||||
if (type == EMoveType::Extrude && m_extrusion_role == erExternalPerimeter && !m_seams_detector.has_first_vertex())
|
||||
|
@ -2382,7 +2357,6 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||
m_seams_detector.activate(false);
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
// store move
|
||||
store_move_vertex(type);
|
||||
|
@ -2837,27 +2811,17 @@ void GCodeProcessor::process_T(const std::string_view command)
|
|||
|
||||
void GCodeProcessor::store_move_vertex(EMoveType type)
|
||||
{
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
m_last_line_id = (type == EMoveType::Color_change || type == EMoveType::Pause_Print || type == EMoveType::Custom_GCode) ?
|
||||
m_line_id + 1 :
|
||||
((type == EMoveType::Seam) ? m_last_line_id : m_line_id);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
MoveVertex vertex = {
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
m_last_line_id,
|
||||
#else
|
||||
(type == EMoveType::Color_change || type == EMoveType::Pause_Print || type == EMoveType::Custom_GCode) ? m_line_id + 1 : m_line_id,
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
type,
|
||||
m_extrusion_role,
|
||||
m_extruder_id,
|
||||
m_cp_color.current,
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z]) + m_extruder_offsets[m_extruder_id],
|
||||
#else
|
||||
Vec3f(m_end_position[X], m_end_position[Y], m_end_position[Z]) + m_extruder_offsets[m_extruder_id],
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
m_end_position[E] - m_start_position[E],
|
||||
m_feedrate,
|
||||
m_width,
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
#include <optional>
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -23,9 +21,7 @@ namespace Slic3r {
|
|||
Noop,
|
||||
Retract,
|
||||
Unretract,
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
Seam,
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
Tool_change,
|
||||
Color_change,
|
||||
Pause_Print,
|
||||
|
@ -363,7 +359,6 @@ namespace Slic3r {
|
|||
void reset();
|
||||
};
|
||||
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
class SeamsDetector
|
||||
{
|
||||
bool m_active{ false };
|
||||
|
@ -384,7 +379,6 @@ namespace Slic3r {
|
|||
bool is_active() const { return m_active; }
|
||||
bool has_first_vertex() const { return m_first_vertex.has_value(); }
|
||||
};
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
struct DataChecker
|
||||
|
@ -470,9 +464,7 @@ namespace Slic3r {
|
|||
bool m_wiping;
|
||||
|
||||
unsigned int m_line_id;
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
unsigned int m_last_line_id;
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
float m_feedrate; // mm/s
|
||||
float m_width; // mm
|
||||
float m_height; // mm
|
||||
|
@ -485,17 +477,13 @@ namespace Slic3r {
|
|||
ExtruderColors m_extruder_colors;
|
||||
ExtruderTemps m_extruder_temps;
|
||||
float m_extruded_last_z;
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
float m_first_layer_height; // mm
|
||||
bool m_processing_start_custom_gcode;
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
unsigned int m_g1_line_id;
|
||||
unsigned int m_layer_id;
|
||||
CpColor m_cp_color;
|
||||
bool m_use_volumetric_e;
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
SeamsDetector m_seams_detector;
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
|
||||
enum class EProducer
|
||||
{
|
||||
|
|
|
@ -41,14 +41,6 @@
|
|||
//====================
|
||||
#define ENABLE_2_4_0_ALPHA0 1
|
||||
|
||||
// Enable a modified version of automatic downscale on load of objects too big
|
||||
#define ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG (1 && ENABLE_2_4_0_ALPHA0)
|
||||
// Enable scrollable legend in preview
|
||||
#define ENABLE_SCROLLABLE_LEGEND (1 && ENABLE_2_4_0_ALPHA0)
|
||||
// Enable visualization of start gcode as regular toolpaths
|
||||
#define ENABLE_START_GCODE_VISUALIZATION (1 && ENABLE_2_4_0_ALPHA0)
|
||||
// Enable visualization of seams in preview
|
||||
#define ENABLE_SEAMS_VISUALIZATION (1 && ENABLE_2_4_0_ALPHA0)
|
||||
// Enable project dirty state manager
|
||||
#define ENABLE_PROJECT_DIRTY_STATE (1 && ENABLE_2_4_0_ALPHA0)
|
||||
// Enable project dirty state manager debug window
|
||||
|
|
|
@ -121,9 +121,7 @@ bool GCodeViewer::Path::matches(const GCodeProcessor::MoveVertex& move) const
|
|||
case EMoveType::Custom_GCode:
|
||||
case EMoveType::Retract:
|
||||
case EMoveType::Unretract:
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Seam:
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Extrude: {
|
||||
// use rounding to reduce the number of generated paths
|
||||
return type == move.type && extruder_id == move.extruder_id && cp_color_id == move.cp_color_id && role == move.extrusion_role &&
|
||||
|
@ -507,9 +505,7 @@ const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors {{
|
|||
const std::vector<GCodeViewer::Color> GCodeViewer::Options_Colors {{
|
||||
{ 0.803f, 0.135f, 0.839f }, // Retractions
|
||||
{ 0.287f, 0.679f, 0.810f }, // Unretractions
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
{ 0.900f, 0.900f, 0.900f }, // Seams
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
{ 0.758f, 0.744f, 0.389f }, // ToolChanges
|
||||
{ 0.856f, 0.582f, 0.546f }, // ColorChanges
|
||||
{ 0.322f, 0.942f, 0.512f }, // PausePrints
|
||||
|
@ -552,20 +548,12 @@ GCodeViewer::GCodeViewer()
|
|||
case EMoveType::Pause_Print:
|
||||
case EMoveType::Custom_GCode:
|
||||
case EMoveType::Retract:
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Unretract:
|
||||
case EMoveType::Seam: {
|
||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Point;
|
||||
buffer.vertices.format = VBuffer::EFormat::Position;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
case EMoveType::Unretract: {
|
||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Point;
|
||||
buffer.vertices.format = VBuffer::EFormat::Position;
|
||||
break;
|
||||
}
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Wipe:
|
||||
case EMoveType::Extrude: {
|
||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Triangle;
|
||||
|
@ -775,18 +763,11 @@ void GCodeViewer::render() const
|
|||
case EMoveType::Pause_Print:
|
||||
case EMoveType::Custom_GCode:
|
||||
case EMoveType::Retract:
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Unretract:
|
||||
case EMoveType::Seam: {
|
||||
buffer.shader = wxGetApp().is_glsl_version_greater_or_equal_to(1, 20) ? "options_120" : "options_110";
|
||||
break;
|
||||
}
|
||||
#else
|
||||
case EMoveType::Unretract: {
|
||||
buffer.shader = wxGetApp().is_glsl_version_greater_or_equal_to(1, 20) ? "options_120" : "options_110";
|
||||
break;
|
||||
}
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Wipe:
|
||||
case EMoveType::Extrude: {
|
||||
buffer.shader = "gouraud_light";
|
||||
|
@ -911,9 +892,7 @@ unsigned int GCodeViewer::get_options_visibility_flags() const
|
|||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Wipe), is_toolpath_move_type_visible(EMoveType::Wipe));
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Retractions), is_toolpath_move_type_visible(EMoveType::Retract));
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Unretractions), is_toolpath_move_type_visible(EMoveType::Unretract));
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Seams), is_toolpath_move_type_visible(EMoveType::Seam));
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ToolChanges), is_toolpath_move_type_visible(EMoveType::Tool_change));
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ColorChanges), is_toolpath_move_type_visible(EMoveType::Color_change));
|
||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::PausePrints), is_toolpath_move_type_visible(EMoveType::Pause_Print));
|
||||
|
@ -934,9 +913,7 @@ void GCodeViewer::set_options_visibility_from_flags(unsigned int flags)
|
|||
set_toolpath_move_type_visible(EMoveType::Wipe, is_flag_set(static_cast<unsigned int>(Preview::OptionType::Wipe)));
|
||||
set_toolpath_move_type_visible(EMoveType::Retract, is_flag_set(static_cast<unsigned int>(Preview::OptionType::Retractions)));
|
||||
set_toolpath_move_type_visible(EMoveType::Unretract, is_flag_set(static_cast<unsigned int>(Preview::OptionType::Unretractions)));
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
set_toolpath_move_type_visible(EMoveType::Seam, is_flag_set(static_cast<unsigned int>(Preview::OptionType::Seams)));
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
set_toolpath_move_type_visible(EMoveType::Tool_change, is_flag_set(static_cast<unsigned int>(Preview::OptionType::ToolChanges)));
|
||||
set_toolpath_move_type_visible(EMoveType::Color_change, is_flag_set(static_cast<unsigned int>(Preview::OptionType::ColorChanges)));
|
||||
set_toolpath_move_type_visible(EMoveType::Pause_Print, is_flag_set(static_cast<unsigned int>(Preview::OptionType::PausePrints)));
|
||||
|
@ -1412,11 +1389,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
|
|||
// for the gcode viewer we need to take in account all moves to correctly size the printbed
|
||||
m_paths_bounding_box.merge(move.position.cast<double>());
|
||||
else {
|
||||
#if ENABLE_START_GCODE_VISUALIZATION
|
||||
if (move.type == EMoveType::Extrude && move.extrusion_role != erCustom && move.width != 0.0f && move.height != 0.0f)
|
||||
#else
|
||||
if (move.type == EMoveType::Extrude && move.width != 0.0f && move.height != 0.0f)
|
||||
#endif // ENABLE_START_GCODE_VISUALIZATION
|
||||
m_paths_bounding_box.merge(move.position.cast<double>());
|
||||
}
|
||||
}
|
||||
|
@ -2168,9 +2141,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||
case EMoveType::Custom_GCode: { color = Options_Colors[static_cast<unsigned int>(EOptionsColors::CustomGCodes)]; break; }
|
||||
case EMoveType::Retract: { color = Options_Colors[static_cast<unsigned int>(EOptionsColors::Retractions)]; break; }
|
||||
case EMoveType::Unretract: { color = Options_Colors[static_cast<unsigned int>(EOptionsColors::Unretractions)]; break; }
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Seam: { color = Options_Colors[static_cast<unsigned int>(EOptionsColors::Seams)]; break; }
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
case EMoveType::Extrude: {
|
||||
if (!top_layer_only ||
|
||||
m_sequential_view.current.last == global_endpoints.last ||
|
||||
|
@ -2579,25 +2550,17 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
if (!m_legend_enabled)
|
||||
return;
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
|
||||
imgui.set_next_window_pos(0.0f, 0.0f, ImGuiCond_Always);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::SetNextWindowBgAlpha(0.6f);
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
const float max_height = 0.75f * static_cast<float>(cnv_size.get_height());
|
||||
const float child_height = 0.3333f * max_height;
|
||||
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, max_height });
|
||||
imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
|
||||
#else
|
||||
imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
|
||||
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
enum class EItemType : unsigned char
|
||||
{
|
||||
|
@ -2608,30 +2571,22 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
};
|
||||
|
||||
const PrintEstimatedStatistics::Mode& time_mode = m_print_statistics.modes[static_cast<size_t>(m_time_estimate_mode)];
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
bool show_estimated_time = time_mode.time > 0.0f && (m_view_type == EViewType::FeatureType ||
|
||||
(m_view_type == EViewType::ColorPrint && !time_mode.custom_gcode_times.empty()));
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
const float icon_size = ImGui::GetTextLineHeight();
|
||||
const float percent_bar_size = 2.0f * ImGui::GetTextLineHeight();
|
||||
|
||||
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
auto append_item = [this, icon_size, percent_bar_size, &imgui, imperial_units](EItemType type, const Color& color, const std::string& label,
|
||||
#else
|
||||
auto append_item = [this, draw_list, icon_size, percent_bar_size, &imgui, imperial_units](EItemType type, const Color& color, const std::string& label,
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
bool visible = true, const std::string& time = "", float percent = 0.0f, float max_percent = 0.0f, const std::array<float, 4>& offsets = { 0.0f, 0.0f, 0.0f, 0.0f },
|
||||
double used_filament_m = 0.0, double used_filament_g = 0.0,
|
||||
std::function<void()> callback = nullptr) {
|
||||
if (!visible)
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.3333f);
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
switch (type) {
|
||||
default:
|
||||
|
@ -2984,7 +2939,6 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
}
|
||||
case EViewType::ColorPrint:
|
||||
{
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
const std::vector<CustomGCode::Item>& custom_gcode_per_print_z = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
|
||||
size_t total_items = 1;
|
||||
for (unsigned char i : m_extruder_ids) {
|
||||
|
@ -2996,9 +2950,6 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
// add scrollable region, if needed
|
||||
if (need_scrollable)
|
||||
ImGui::BeginChild("color_prints", { -1.0f, child_height }, false);
|
||||
#else
|
||||
const std::vector<CustomGCode::Item>& custom_gcode_per_print_z = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
if (m_extruders_count == 1) { // single extruder use case
|
||||
const std::vector<std::pair<Color, std::pair<double, double>>> cp_values = color_print_ranges(0, custom_gcode_per_print_z);
|
||||
const int items_cnt = static_cast<int>(cp_values.size());
|
||||
|
@ -3049,10 +3000,8 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
}
|
||||
}
|
||||
}
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
if (need_scrollable)
|
||||
ImGui::EndChild();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -3203,12 +3152,10 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
|
||||
ImGui::Spacing();
|
||||
append_headers({ _u8L("Event"), _u8L("Remaining time"), _u8L("Duration"), _u8L("Used filament") }, offsets);
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
const bool need_scrollable = static_cast<float>(partial_times.size()) * (icon_size + ImGui::GetStyle().ItemSpacing.y) > child_height;
|
||||
if (need_scrollable)
|
||||
// add scrollable region
|
||||
ImGui::BeginChild("events", { -1.0f, child_height }, false);
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
for (const PartialTime& item : partial_times) {
|
||||
switch (item.type)
|
||||
|
@ -3230,10 +3177,8 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
if (need_scrollable)
|
||||
ImGui::EndChild();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3292,12 +3237,8 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
available(EMoveType::Pause_Print) ||
|
||||
available(EMoveType::Retract) ||
|
||||
available(EMoveType::Tool_change) ||
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
available(EMoveType::Unretract) ||
|
||||
available(EMoveType::Seam);
|
||||
#else
|
||||
available(EMoveType::Unretract);
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
};
|
||||
|
||||
auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) {
|
||||
|
@ -3315,9 +3256,7 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
// items
|
||||
add_option(EMoveType::Retract, EOptionsColors::Retractions, _u8L("Retractions"));
|
||||
add_option(EMoveType::Unretract, EOptionsColors::Unretractions, _u8L("Deretractions"));
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
add_option(EMoveType::Seam, EOptionsColors::Seams, _u8L("Seams"));
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
add_option(EMoveType::Tool_change, EOptionsColors::ToolChanges, _u8L("Tool changes"));
|
||||
add_option(EMoveType::Color_change, EOptionsColors::ColorChanges, _u8L("Color changes"));
|
||||
add_option(EMoveType::Pause_Print, EOptionsColors::PausePrints, _u8L("Print pauses"));
|
||||
|
@ -3383,14 +3322,7 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
}
|
||||
|
||||
// total estimated printing time section
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
if (show_estimated_time) {
|
||||
#else
|
||||
if (time_mode.time > 0.0f && (m_view_type == EViewType::FeatureType ||
|
||||
(m_view_type == EViewType::ColorPrint && !time_mode.custom_gcode_times.empty()))) {
|
||||
|
||||
ImGui::Spacing();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
ImGui::Spacing();
|
||||
std::string time_title = _u8L("Estimated printing times");
|
||||
switch (m_time_estimate_mode)
|
||||
|
|
|
@ -38,9 +38,7 @@ class GCodeViewer
|
|||
{
|
||||
Retractions,
|
||||
Unretractions,
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
Seams,
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
ToolChanges,
|
||||
ColorChanges,
|
||||
PausePrints,
|
||||
|
|
|
@ -4707,13 +4707,11 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||
if (m_canvas == nullptr && m_context == nullptr)
|
||||
return;
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
const std::array<unsigned int, 2> new_size = { w, h };
|
||||
if (m_old_size == new_size)
|
||||
return;
|
||||
|
||||
m_old_size = new_size;
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
auto *imgui = wxGetApp().imgui();
|
||||
imgui->set_display_size(static_cast<float>(w), static_cast<float>(h));
|
||||
|
@ -4724,9 +4722,7 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||
imgui->set_scaling(font_size, m_canvas->GetContentScaleFactor(), 1.0f);
|
||||
#endif
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
this->request_extra_frame();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
// ensures that this canvas is current
|
||||
_set_current();
|
||||
|
|
|
@ -427,9 +427,7 @@ private:
|
|||
Model* m_model;
|
||||
BackgroundSlicingProcess *m_process;
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
std::array<unsigned int, 2> m_old_size{ 0, 0 };
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
// Screen is only refreshed from the OnIdle handler if it is dirty.
|
||||
bool m_dirty;
|
||||
|
@ -787,9 +785,7 @@ public:
|
|||
const Print* fff_print() const;
|
||||
const SLAPrint* sla_print() const;
|
||||
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
void reset_old_size() { m_old_size = { 0, 0 }; }
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
|
||||
private:
|
||||
bool _is_shown_on_screen() const;
|
||||
|
|
|
@ -264,9 +264,7 @@ bool Preview::init(wxWindow* parent, Model* model)
|
|||
get_option_type_string(OptionType::Wipe) + "|0|" +
|
||||
get_option_type_string(OptionType::Retractions) + "|0|" +
|
||||
get_option_type_string(OptionType::Unretractions) + "|0|" +
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
get_option_type_string(OptionType::Seams) + "|0|" +
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
get_option_type_string(OptionType::ToolChanges) + "|0|" +
|
||||
get_option_type_string(OptionType::ColorChanges) + "|0|" +
|
||||
get_option_type_string(OptionType::PausePrints) + "|0|" +
|
||||
|
@ -1033,9 +1031,7 @@ wxString Preview::get_option_type_string(OptionType type) const
|
|||
case OptionType::Wipe: { return _L("Wipe"); }
|
||||
case OptionType::Retractions: { return _L("Retractions"); }
|
||||
case OptionType::Unretractions: { return _L("Deretractions"); }
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
case OptionType::Seams: { return _L("Seams"); }
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
case OptionType::ToolChanges: { return _L("Tool changes"); }
|
||||
case OptionType::ColorChanges: { return _L("Color changes"); }
|
||||
case OptionType::PausePrints: { return _L("Print pauses"); }
|
||||
|
|
|
@ -121,9 +121,7 @@ public:
|
|||
Wipe,
|
||||
Retractions,
|
||||
Unretractions,
|
||||
#if ENABLE_SEAMS_VISUALIZATION
|
||||
Seams,
|
||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||
ToolChanges,
|
||||
ColorChanges,
|
||||
PausePrints,
|
||||
|
|
|
@ -2520,7 +2520,6 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
|
|||
#endif /* AUTOPLACEMENT_ON_LOAD */
|
||||
}
|
||||
|
||||
#if ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG
|
||||
for (size_t i = 0; i < object->instances.size(); ++i) {
|
||||
ModelInstance* instance = object->instances[i];
|
||||
const Vec3d size = object->instance_bounding_box(i).size();
|
||||
|
@ -2542,26 +2541,6 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
|
|||
scaled_down = true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
const Vec3d size = object->bounding_box().size();
|
||||
const Vec3d ratio = size.cwiseQuotient(bed_size);
|
||||
const double max_ratio = std::max(ratio(0), ratio(1));
|
||||
if (max_ratio > 10000) {
|
||||
// the size of the object is too big -> this could lead to overflow when moving to clipper coordinates,
|
||||
// so scale down the mesh
|
||||
double inv = 1. / max_ratio;
|
||||
object->scale_mesh_after_creation(Vec3d(inv, inv, inv));
|
||||
object->origin_translation = Vec3d::Zero();
|
||||
object->center_around_origin();
|
||||
scaled_down = true;
|
||||
} else if (max_ratio > 5) {
|
||||
const Vec3d inverse = 1.0 / max_ratio * Vec3d::Ones();
|
||||
for (ModelInstance *instance : object->instances) {
|
||||
instance->set_scaling_factor(inverse);
|
||||
}
|
||||
scaled_down = true;
|
||||
}
|
||||
#endif // ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG
|
||||
|
||||
object->ensure_on_bed(allow_negative_z);
|
||||
}
|
||||
|
@ -3616,10 +3595,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
|
|||
|
||||
// sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
|
||||
view3D->set_as_dirty();
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
// reset cached size to force a resize on next call to render() to keep imgui in synch with canvas size
|
||||
view3D->get_canvas3d()->reset_old_size();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
view_toolbar.select_item("3D");
|
||||
if (notification_manager != nullptr)
|
||||
notification_manager->set_in_preview(false);
|
||||
|
@ -3640,10 +3617,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
|
|||
preview->reload_print(true);
|
||||
|
||||
preview->set_as_dirty();
|
||||
#if ENABLE_SCROLLABLE_LEGEND
|
||||
// reset cached size to force a resize on next call to render() to keep imgui in synch with canvas size
|
||||
preview->get_canvas3d()->reset_old_size();
|
||||
#endif // ENABLE_SCROLLABLE_LEGEND
|
||||
view_toolbar.select_item("Preview");
|
||||
if (notification_manager != nullptr)
|
||||
notification_manager->set_in_preview(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue