mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 10:11:10 -06:00
GCodeAnalyzer and GCodePreviewData removed from tech ENABLE_GCODE_VIEWER
This commit is contained in:
parent
c29f0a4849
commit
5c6a56ca29
22 changed files with 311 additions and 156 deletions
|
|
@ -5,11 +5,15 @@
|
|||
#include "libslic3r/ExtrusionEntity.hpp"
|
||||
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/SLAPrint.hpp"
|
||||
#include "libslic3r/Slicing.hpp"
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/Analyzer.hpp"
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#include "slic3r/GUI/BitmapCache.hpp"
|
||||
#include "libslic3r/Format/STL.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
#include "libslic3r/SLAPrint.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/GCode/PostProcessor.hpp"
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/Format/SL1.hpp"
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
||||
|
|
@ -89,7 +91,7 @@ void BackgroundSlicingProcess::process_fff()
|
|||
m_print->process();
|
||||
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_slicing_completed_id));
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data, m_gcode_result, m_thumbnail_cb);
|
||||
m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, m_thumbnail_cb);
|
||||
#else
|
||||
m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data, m_thumbnail_cb);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
|
@ -385,9 +387,7 @@ Print::ApplyStatus BackgroundSlicingProcess::apply(const Model &model, const Dyn
|
|||
// Some FFF status was invalidated, and the G-code was not exported yet.
|
||||
// Let the G-code preview UI know that the final G-code preview is not valid.
|
||||
// In addition, this early memory deallocation reduces memory footprint.
|
||||
if (m_gcode_preview_data != nullptr)
|
||||
m_gcode_preview_data->reset();
|
||||
else if (m_gcode_result != nullptr)
|
||||
if (m_gcode_result != nullptr)
|
||||
m_gcode_result->reset();
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -50,10 +50,11 @@ public:
|
|||
|
||||
void set_fff_print(Print *print) { m_fff_print = print; }
|
||||
void set_sla_print(SLAPrint *print) { m_sla_print = print; m_sla_print->set_printer(&m_sla_archive); }
|
||||
void set_gcode_preview_data(GCodePreviewData *gpd) { m_gcode_preview_data = gpd; }
|
||||
void set_thumbnail_cb(ThumbnailsGeneratorCallback cb) { m_thumbnail_cb = cb; }
|
||||
void set_thumbnail_cb(ThumbnailsGeneratorCallback cb) { m_thumbnail_cb = cb; }
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void set_gcode_result(GCodeProcessor::Result* result) { m_gcode_result = result; }
|
||||
#else
|
||||
void set_gcode_preview_data(GCodePreviewData* gpd) { m_gcode_preview_data = gpd; }
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// The following wxCommandEvent will be sent to the UI thread / Plater window, when the slicing is finished
|
||||
|
|
@ -156,15 +157,17 @@ private:
|
|||
// Non-owned pointers to Print instances.
|
||||
Print *m_fff_print = nullptr;
|
||||
SLAPrint *m_sla_print = nullptr;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
// Data structure, to which the G-code export writes its annotations.
|
||||
GCodeProcessor::Result *m_gcode_result = nullptr;
|
||||
#else
|
||||
// Data structure, to which the G-code export writes its annotations.
|
||||
GCodePreviewData *m_gcode_preview_data = nullptr;
|
||||
// Callback function, used to write thumbnails into gcode.
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Callback function, used to write thumbnails into gcode.
|
||||
ThumbnailsGeneratorCallback m_thumbnail_cb = nullptr;
|
||||
SL1Archive m_sla_archive;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
GCodeProcessor::Result* m_gcode_result = nullptr;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID.
|
||||
// Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID.
|
||||
std::string m_temp_output_path;
|
||||
// Output path provided by the user. The output path may be set even if the slicing is running,
|
||||
// but once set, it cannot be re-set.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include "wxExtensions.hpp"
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode.hpp"
|
||||
#else
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "I18N.hpp"
|
||||
|
|
@ -1945,7 +1949,11 @@ std::string TickCodeInfo::get_color_for_tick(TickCode tick, const std::string& c
|
|||
{
|
||||
if (mode == t_mode::SingleExtruder && code == ColorChangeCode && m_use_default_colors)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
const std::vector<std::string>& colors = ColorPrintColors::get();
|
||||
#else
|
||||
const std::vector<std::string>& colors = GCodePreviewData::ColorPrintColors();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
if (ticks.empty())
|
||||
return colors[0];
|
||||
m_default_color_idx++;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors{ {
|
|||
{ 0.69f, 0.19f, 0.16f }, // erInternalInfill
|
||||
{ 0.84f, 0.20f, 0.84f }, // erSolidInfill
|
||||
{ 1.00f, 0.10f, 0.10f }, // erTopSolidInfill
|
||||
{ 0.00f, 1.00f, 1.00f }, // erIroning
|
||||
{ 1.00f, 0.55f, 0.41f }, // erIroning
|
||||
{ 0.60f, 0.60f, 1.00f }, // erBridgeInfill
|
||||
{ 1.00f, 1.00f, 1.00f }, // erGapFill
|
||||
{ 0.52f, 0.48f, 0.13f }, // erSkirt
|
||||
|
|
@ -404,7 +404,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
|
|||
std::vector<float> vertices_data(m_vertices.vertices_count * 3);
|
||||
for (size_t i = 0; i < m_vertices.vertices_count; ++i) {
|
||||
const GCodeProcessor::MoveVertex& move = gcode_result.moves[i];
|
||||
m_bounding_box.merge(move.position.cast<double>());
|
||||
if (move.type == GCodeProcessor::EMoveType::Extrude)
|
||||
m_bounding_box.merge(move.position.cast<double>());
|
||||
::memcpy(static_cast<void*>(&vertices_data[i * 3]), static_cast<const void*>(move.position.data()), 3 * sizeof(float));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
#include "polypartition.h"
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/ThumbnailData.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/ExtrusionEntity.hpp"
|
||||
|
|
@ -56,10 +58,6 @@
|
|||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_DEBUG_OUTPUT
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#endif // ENABLE_GCODE_VIEWER_DEBUG_OUTPUT
|
||||
|
||||
#include <iostream>
|
||||
#include <float.h>
|
||||
#include <algorithm>
|
||||
|
|
@ -2747,22 +2745,8 @@ static void load_gcode_retractions(const GCodePreviewData::Retraction& retractio
|
|||
#if ENABLE_GCODE_VIEWER
|
||||
void GLCanvas3D::load_gcode_preview(const GCodeProcessor::Result& gcode_result)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER_DEBUG_OUTPUT
|
||||
static unsigned int last_result_id = 0;
|
||||
if (last_result_id != gcode_result.id)
|
||||
{
|
||||
last_result_id = gcode_result.id;
|
||||
boost::filesystem::path path("d:/processor.output");
|
||||
boost::nowide::ofstream out;
|
||||
out.open(path.string());
|
||||
for (const GCodeProcessor::MoveVertex& v : gcode_result.moves)
|
||||
{
|
||||
out << v.to_string() << "\n";
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER_DEBUG_OUTPUT
|
||||
m_gcode_viewer.load(gcode_result, *this->fff_print(), m_initialized);
|
||||
_show_warning_texture_if_needed(WarningTexture::ToolpathOutside);
|
||||
}
|
||||
|
||||
void GLCanvas3D::refresh_gcode_preview(const GCodeProcessor::Result& gcode_result, const std::vector<std::string>& str_tool_colors)
|
||||
|
|
@ -2771,9 +2755,7 @@ void GLCanvas3D::refresh_gcode_preview(const GCodeProcessor::Result& gcode_resul
|
|||
set_as_dirty();
|
||||
request_extra_frame();
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#else
|
||||
void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const std::vector<std::string>& str_tool_colors)
|
||||
{
|
||||
const Print *print = this->fff_print();
|
||||
|
|
@ -2842,7 +2824,7 @@ void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const
|
|||
_generate_legend_texture(preview_data, tool_colors);
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void GLCanvas3D::load_sla_preview()
|
||||
{
|
||||
|
|
@ -3144,7 +3126,24 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
}
|
||||
#endif // ENABLE_RENDER_PICKING_PASS
|
||||
case 'Z':
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
case 'z':
|
||||
{
|
||||
if (!m_selection.is_empty())
|
||||
zoom_to_selection();
|
||||
else
|
||||
{
|
||||
if (!m_volumes.empty())
|
||||
zoom_to_volumes();
|
||||
else
|
||||
_zoom_to_box(m_gcode_viewer.get_bounding_box());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#else
|
||||
case 'z': { m_selection.is_empty() ? zoom_to_volumes() : zoom_to_selection(); break; }
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
default: { evt.Skip(); break; }
|
||||
}
|
||||
}
|
||||
|
|
@ -5467,8 +5466,39 @@ void GLCanvas3D::_rectangular_selection_picking_pass() const
|
|||
_update_volumes_hover_state();
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
static BoundingBoxf3 print_volume(const DynamicPrintConfig& config)
|
||||
{
|
||||
// tolerance to avoid false detection at bed edges
|
||||
const double tolerance_x = 0.05;
|
||||
const double tolerance_y = 0.05;
|
||||
|
||||
BoundingBoxf3 ret;
|
||||
const ConfigOptionPoints* opt = dynamic_cast<const ConfigOptionPoints*>(config.option("bed_shape"));
|
||||
if (opt != nullptr)
|
||||
{
|
||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
||||
ret = BoundingBoxf3(Vec3d(unscale<double>(bed_box_2D.min(0)) - tolerance_x, unscale<double>(bed_box_2D.min(1)) - tolerance_y, 0.0), Vec3d(unscale<double>(bed_box_2D.max(0)) + tolerance_x, unscale<double>(bed_box_2D.max(1)) + tolerance_y, config.opt_float("max_print_height")));
|
||||
// Allow the objects to protrude below the print bed
|
||||
ret.min(2) = -1e10;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void GLCanvas3D::_render_background() const
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool use_error_color = m_dynamic_background_enabled;
|
||||
if (!m_volumes.empty())
|
||||
use_error_color &= _is_any_volume_outside();
|
||||
else
|
||||
{
|
||||
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
|
||||
use_error_color &= (test_volume.radius() > 0.0) ? !test_volume.contains(m_gcode_viewer.get_bounding_box()) : false;
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glLoadIdentity());
|
||||
glsafe(::glMatrixMode(GL_PROJECTION));
|
||||
|
|
@ -5479,7 +5509,11 @@ void GLCanvas3D::_render_background() const
|
|||
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||
|
||||
::glBegin(GL_QUADS);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (use_error_color)
|
||||
#else
|
||||
if (m_dynamic_background_enabled && _is_any_volume_outside())
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
::glColor3fv(ERROR_BG_DARK_COLOR);
|
||||
else
|
||||
::glColor3fv(DEFAULT_BG_DARK_COLOR);
|
||||
|
|
@ -5487,8 +5521,12 @@ void GLCanvas3D::_render_background() const
|
|||
::glVertex2f(-1.0f, -1.0f);
|
||||
::glVertex2f(1.0f, -1.0f);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (use_error_color)
|
||||
#else
|
||||
if (m_dynamic_background_enabled && _is_any_volume_outside())
|
||||
::glColor3fv(ERROR_BG_LIGHT_COLOR);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
::glColor3fv(ERROR_BG_LIGHT_COLOR);
|
||||
else
|
||||
::glColor3fv(DEFAULT_BG_LIGHT_COLOR);
|
||||
|
||||
|
|
@ -6991,6 +7029,7 @@ void GLCanvas3D::_load_sla_shells()
|
|||
update_volumes_colors_by_extruder();
|
||||
}
|
||||
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
void GLCanvas3D::_update_gcode_volumes_visibility(const GCodePreviewData& preview_data)
|
||||
{
|
||||
unsigned int size = (unsigned int)m_gcode_preview_volume_index.first_volumes.size();
|
||||
|
|
@ -7048,9 +7087,13 @@ void GLCanvas3D::_update_gcode_volumes_visibility(const GCodePreviewData& previe
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
|
||||
void GLCanvas3D::_update_toolpath_volumes_outside_state()
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
|
||||
#else
|
||||
// tolerance to avoid false detection at bed edges
|
||||
static const double tolerance_x = 0.05;
|
||||
static const double tolerance_y = 0.05;
|
||||
|
|
@ -7067,15 +7110,23 @@ void GLCanvas3D::_update_toolpath_volumes_outside_state()
|
|||
print_volume.min(2) = -1e10;
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
for (GLVolume* volume : m_volumes.volumes)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
volume->is_outside = ((test_volume.radius() > 0.0) && volume->is_extrusion_path) ? !test_volume.contains(volume->bounding_box()) : false;
|
||||
#else
|
||||
volume->is_outside = ((print_volume.radius() > 0.0) && volume->is_extrusion_path) ? !print_volume.contains(volume->bounding_box()) : false;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
}
|
||||
|
||||
void GLCanvas3D::_update_sla_shells_outside_state()
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
|
||||
#else
|
||||
// tolerance to avoid false detection at bed edges
|
||||
static const double tolerance_x = 0.05;
|
||||
static const double tolerance_y = 0.05;
|
||||
|
|
@ -7092,17 +7143,34 @@ void GLCanvas3D::_update_sla_shells_outside_state()
|
|||
print_volume.min(2) = -1e10;
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
for (GLVolume* volume : m_volumes.volumes)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
volume->is_outside = ((test_volume.radius() > 0.0) && volume->shader_outside_printer_detection_enabled) ? !test_volume.contains(volume->transformed_convex_hull_bounding_box()) : false;
|
||||
#else
|
||||
volume->is_outside = ((print_volume.radius() > 0.0) && volume->shader_outside_printer_detection_enabled) ? !print_volume.contains(volume->transformed_convex_hull_bounding_box()) : false;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
}
|
||||
|
||||
void GLCanvas3D::_show_warning_texture_if_needed(WarningTexture::Warning warning)
|
||||
{
|
||||
_set_current();
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool show = false;
|
||||
if (!m_volumes.empty())
|
||||
show = _is_any_volume_outside();
|
||||
else
|
||||
{
|
||||
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
|
||||
show = (test_volume.radius() > 0.0) ? !test_volume.contains(m_gcode_viewer.get_bounding_box()) : false;
|
||||
}
|
||||
_set_warning_texture(warning, show);
|
||||
#else
|
||||
_set_warning_texture(warning, _is_any_volume_outside());
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
std::vector<float> GLCanvas3D::_parse_colors(const std::vector<std::string>& colors)
|
||||
|
|
|
|||
|
|
@ -846,8 +846,10 @@ private:
|
|||
#endif // !ENABLE_GCODE_VIEWER
|
||||
// Load SLA objects and support structures for objects, for which the slaposSliceSupports step has been finished.
|
||||
void _load_sla_shells();
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
// sets gcode geometry visibility according to user selection
|
||||
void _update_gcode_volumes_visibility(const GCodePreviewData& preview_data);
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
void _update_toolpath_volumes_outside_state();
|
||||
void _update_sla_shells_outside_state();
|
||||
void _show_warning_texture_if_needed(WarningTexture::Warning warning);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "libslic3r/libslic3r.h"
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#include "GUI_Preview.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI.hpp"
|
||||
|
|
@ -172,8 +174,8 @@ void View3D::render()
|
|||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
Preview::Preview(
|
||||
wxWindow * parent, Model * model, DynamicPrintConfig * config,
|
||||
BackgroundSlicingProcess * process, GCodePreviewData * gcode_preview_data, GCodeProcessor::Result * gcode_result, std::function<void()> schedule_background_process_func)
|
||||
wxWindow* parent, Model* model, DynamicPrintConfig* config,
|
||||
BackgroundSlicingProcess* process, GCodeProcessor::Result* gcode_result, std::function<void()> schedule_background_process_func)
|
||||
#else
|
||||
Preview::Preview(
|
||||
wxWindow* parent, Model* model, DynamicPrintConfig* config,
|
||||
|
|
@ -200,9 +202,10 @@ Preview::Preview(
|
|||
#endif // ENABLE_GCODE_VIEWER
|
||||
, m_config(config)
|
||||
, m_process(process)
|
||||
, m_gcode_preview_data(gcode_preview_data)
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
, m_gcode_result(gcode_result)
|
||||
#else
|
||||
, m_gcode_preview_data(gcode_preview_data)
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
, m_number_extruders(1)
|
||||
, m_preferred_color_mode("feature")
|
||||
|
|
@ -401,8 +404,13 @@ void Preview::set_number_extruders(unsigned int number_extruders)
|
|||
int tool_idx = m_choice_view_type->FindString(_(L("Tool")));
|
||||
int type = (number_extruders > 1) ? tool_idx /* color by a tool number */ : 0; // color by a feature type
|
||||
m_choice_view_type->SetSelection(type);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if ((0 <= type) && (type < static_cast<int>(GCodeViewer::EViewType::Count)))
|
||||
m_canvas->set_gcode_view_preview_type(static_cast<GCodeViewer::EViewType>(type));
|
||||
#else
|
||||
if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types))
|
||||
m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
m_preferred_color_mode = (type == tool_idx) ? "tool_or_feature" : "feature";
|
||||
}
|
||||
|
|
@ -679,8 +687,13 @@ void Preview::update_view_type(bool slice_completed)
|
|||
int type = m_choice_view_type->FindString(choice);
|
||||
if (m_choice_view_type->GetSelection() != type) {
|
||||
m_choice_view_type->SetSelection(type);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if ((0 <= type) && (type < static_cast<int>(GCodeViewer::EViewType::Count)))
|
||||
m_canvas->set_gcode_view_preview_type(static_cast<GCodeViewer::EViewType>(type));
|
||||
#else
|
||||
if (0 <= type && type < (int)GCodePreviewData::Extrusion::Num_View_Types)
|
||||
m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_preferred_color_mode = "feature";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ class Preview : public wxPanel
|
|||
|
||||
public:
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
Preview(wxWindow * parent, Model * model, DynamicPrintConfig * config,
|
||||
BackgroundSlicingProcess * process, GCodePreviewData * gcode_preview_data, GCodeProcessor::Result * gcode_result, std::function<void()> schedule_background_process = []() {});
|
||||
Preview(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
|
||||
GCodeProcessor::Result* gcode_result, std::function<void()> schedule_background_process = []() {});
|
||||
#else
|
||||
Preview(wxWindow* parent, Model* model, DynamicPrintConfig* config,
|
||||
BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process = []() {});
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@
|
|||
#include "libslic3r/Format/STL.hpp"
|
||||
#include "libslic3r/Format/AMF.hpp"
|
||||
#include "libslic3r/Format/3mf.hpp"
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
#include "libslic3r/GCode/ThumbnailData.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/SLA/Hollowing.hpp"
|
||||
|
|
@ -1528,9 +1530,10 @@ struct Plater::priv
|
|||
Slic3r::SLAPrint sla_print;
|
||||
Slic3r::Model model;
|
||||
PrinterTechnology printer_technology = ptFFF;
|
||||
Slic3r::GCodePreviewData gcode_preview_data;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
Slic3r::GCodeProcessor::Result gcode_result;
|
||||
#else
|
||||
Slic3r::GCodePreviewData gcode_preview_data;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// GUI elements
|
||||
|
|
@ -1840,9 +1843,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
|
||||
background_process.set_fff_print(&fff_print);
|
||||
background_process.set_sla_print(&sla_print);
|
||||
background_process.set_gcode_preview_data(&gcode_preview_data);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
background_process.set_gcode_result(&gcode_result);
|
||||
#else
|
||||
background_process.set_gcode_preview_data(&gcode_preview_data);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
background_process.set_thumbnail_cb([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background)
|
||||
{
|
||||
|
|
@ -1868,7 +1872,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
|
||||
view3D = new View3D(q, &model, config, &background_process);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
preview = new Preview(q, &model, config, &background_process, &gcode_preview_data, &gcode_result, [this]() { schedule_background_process(); });
|
||||
preview = new Preview(q, &model, config, &background_process, &gcode_result, [this]() { schedule_background_process(); });
|
||||
#else
|
||||
preview = new Preview(q, &model, config, &background_process, &gcode_preview_data, [this]() { schedule_background_process(); });
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue