mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
ENABLE_GCODE_VIEWER set as default in:
MainFrame hpp/cpp Plater hpp/cpp
This commit is contained in:
parent
ef9cea76c2
commit
a1905d9b9e
4 changed files with 5 additions and 392 deletions
|
@ -1169,7 +1169,6 @@ void Sidebar::update_sliced_info_sizer()
|
|||
wxString::Format("%.2f", ps.total_cost);
|
||||
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
||||
else {
|
||||
|
@ -1191,56 +1190,6 @@ void Sidebar::update_sliced_info_sizer()
|
|||
}
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
|
||||
}
|
||||
#else
|
||||
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
||||
else {
|
||||
new_label = _L("Estimated printing time") + ":";
|
||||
info_text = "";
|
||||
wxString str_color = _L("Color");
|
||||
wxString str_pause = _L("Pause");
|
||||
|
||||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::string>>& times,
|
||||
wxString& new_label, wxString& info_text)
|
||||
{
|
||||
int color_change_count = 0;
|
||||
for (auto time : times)
|
||||
if (time.first == CustomGCode::ColorChange)
|
||||
color_change_count++;
|
||||
|
||||
for (int i = (int)times.size() - 1; i >= 0; --i)
|
||||
{
|
||||
if (i == 0 || times[i - 1].first == CustomGCode::PausePrint)
|
||||
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count);
|
||||
else if (times[i - 1].first == CustomGCode::ColorChange)
|
||||
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count--);
|
||||
|
||||
if (i != (int)times.size() - 1 && times[i].first == CustomGCode::PausePrint)
|
||||
new_label += format_wxstr(" -> %1%", str_pause);
|
||||
|
||||
info_text += format_wxstr("\n%1%", times[i].second);
|
||||
}
|
||||
};
|
||||
|
||||
if (ps.estimated_normal_print_time != "N/A") {
|
||||
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
||||
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time);
|
||||
fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
|
||||
|
||||
// uncomment next line to not disappear slicing finished notif when colapsing sidebar before time estimate
|
||||
//if (p->plater->is_sidebar_collapsed())
|
||||
p->plater->get_notification_manager()->set_slicing_complete_large(p->plater->is_sidebar_collapsed());
|
||||
p->plater->get_notification_manager()->set_slicing_complete_print_time("Estimated printing time: " + ps.estimated_normal_print_time);
|
||||
|
||||
}
|
||||
if (ps.estimated_silent_print_time != "N/A") {
|
||||
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
||||
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time);
|
||||
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
||||
}
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
|
||||
}
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
|
||||
// if there is a wipe tower, insert number of toolchanges info into the array:
|
||||
p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", ps.total_toolchanges) : "N/A");
|
||||
|
@ -1333,9 +1282,7 @@ void Sidebar::collapse(bool collapse)
|
|||
p->plater->Layout();
|
||||
|
||||
// save collapsing state to the AppConfig
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_editor())
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
wxGetApp().app_config->set("collapsed_sidebar", collapse ? "1" : "0");
|
||||
}
|
||||
|
||||
|
@ -1375,15 +1322,11 @@ private:
|
|||
Plater *plater;
|
||||
|
||||
static const std::regex pattern_drop;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
static const std::regex pattern_gcode_drop;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
};
|
||||
|
||||
const std::regex PlaterDropTarget::pattern_drop(".*[.](stl|obj|amf|3mf|prusa)", std::regex::icase);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
const std::regex PlaterDropTarget::pattern_gcode_drop(".*[.](gcode|g)", std::regex::icase);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
enum class LoadType : unsigned char
|
||||
{
|
||||
|
@ -1453,7 +1396,6 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
|||
{
|
||||
std::vector<fs::path> paths;
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#ifdef WIN32
|
||||
// hides the system icon
|
||||
this->MSWUpdateDragImageOnLeave();
|
||||
|
@ -1478,17 +1420,14 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// editor section
|
||||
for (const auto &filename : filenames) {
|
||||
fs::path path(into_path(filename));
|
||||
if (std::regex_match(path.string(), pattern_drop))
|
||||
paths.push_back(std::move(path));
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
else if (std::regex_match(path.string(), pattern_gcode_drop))
|
||||
start_new_gcodeviewer(&filename);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
@ -1605,11 +1544,7 @@ struct Plater::priv
|
|||
Slic3r::SLAPrint sla_print;
|
||||
Slic3r::Model model;
|
||||
PrinterTechnology printer_technology = ptFFF;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
Slic3r::GCodeProcessor::Result gcode_result;
|
||||
#else
|
||||
Slic3r::GCodePreviewData gcode_preview_data;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// GUI elements
|
||||
wxSizer* panel_sizer{ nullptr };
|
||||
|
@ -1717,13 +1652,11 @@ struct Plater::priv
|
|||
bool init_view_toolbar();
|
||||
bool init_collapse_toolbar();
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void update_preview_bottom_toolbar();
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
void reset_gcode_toolpaths();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void reset_all_gizmos();
|
||||
void update_ui_from_settings(bool apply_free_camera_correction = true);
|
||||
|
@ -1945,11 +1878,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
|
||||
background_process.set_fff_print(&fff_print);
|
||||
background_process.set_sla_print(&sla_print);
|
||||
#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)
|
||||
{
|
||||
std::packaged_task<void(ThumbnailsList&, const Vec2ds&, bool, bool, bool, bool)> task([this](ThumbnailsList& thumbnails, const Vec2ds& sizes, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) {
|
||||
|
@ -1974,11 +1903,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
this->q->Bind(EVT_SLICING_UPDATE, &priv::on_slicing_update, this);
|
||||
|
||||
view3D = new View3D(q, &model, config, &background_process);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
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
|
||||
|
||||
#ifdef __APPLE__
|
||||
// set default view_toolbar icons size equal to GLGizmosManager::Default_Icons_Size
|
||||
|
@ -2009,22 +1934,16 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
|
||||
// Events:
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_editor()) {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Preset change event
|
||||
sidebar->Bind(wxEVT_COMBOBOX, &priv::on_select_preset, this);
|
||||
sidebar->Bind(EVT_OBJ_LIST_OBJECT_SELECT, [this](wxEvent&) { priv::selection_changed(); });
|
||||
sidebar->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_editor()) {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// 3DScene events:
|
||||
view3D_canvas->Bind(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
|
||||
view3D_canvas->Bind(EVT_GLCANVAS_OBJECT_SELECT, &priv::on_object_select, this);
|
||||
|
@ -2066,10 +1985,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this);
|
||||
view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this);
|
||||
view3D_canvas->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
|
||||
}
|
||||
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
|
||||
|
||||
// Preview events:
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
|
||||
|
@ -2077,37 +1994,24 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); });
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_JUMP_TO, [this](wxKeyEvent& evt) { preview->jump_layers_slider(evt); });
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_LAYERS_SLIDER, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); });
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); });
|
||||
#else
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, [this](wxKeyEvent& evt) { preview->move_double_slider(evt); });
|
||||
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_double_slider(evt); });
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_editor()) {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
q->Bind(EVT_SLICING_COMPLETED, &priv::on_slicing_completed, this);
|
||||
q->Bind(EVT_PROCESS_COMPLETED, &priv::on_process_completed, this);
|
||||
q->Bind(EVT_EXPORT_BEGAN, &priv::on_export_began, this);
|
||||
q->Bind(EVT_GLVIEWTOOLBAR_3D, [q](SimpleEvent&) { q->select_view_3D("3D"); });
|
||||
q->Bind(EVT_GLVIEWTOOLBAR_PREVIEW, [q](SimpleEvent&) { q->select_view_3D("Preview"); });
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// Drop target:
|
||||
q->SetDropTarget(new PlaterDropTarget(q)); // if my understanding is right, wxWindow takes the owenership
|
||||
q->Layout();
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
set_current_panel(wxGetApp().is_editor() ? (wxPanel*)view3D : (wxPanel*)preview);
|
||||
if (wxGetApp().is_gcode_viewer())
|
||||
preview->hide_layers_slider();
|
||||
#else
|
||||
set_current_panel(view3D);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// updates camera type from .ini file
|
||||
camera.enable_update_config_on_type_change(true);
|
||||
|
@ -2133,9 +2037,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
#endif /* _WIN32 */
|
||||
|
||||
notification_manager = new NotificationManager(this->q);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_editor()) {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); });
|
||||
this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); });
|
||||
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
|
||||
|
@ -2161,9 +2063,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
this->q->Bind(EVT_VOLUME_ATTACHED, [this](VolumeAttachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
|
||||
this->q->Bind(EVT_VOLUME_DETACHED, [this](VolumeDetachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
|
||||
#endif /* _WIN32 */
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// Initialize the Undo / Redo stack with a first snapshot.
|
||||
this->take_snapshot(_L("New Project"));
|
||||
|
@ -2178,14 +2078,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
wxGetApp().other_instance_message_handler()->init(this->q);
|
||||
|
||||
// collapse sidebar according to saved value
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_editor()) {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
bool is_collapsed = wxGetApp().app_config->get("collapsed_sidebar") == "1";
|
||||
sidebar->collapse(is_collapsed);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
Plater::priv::~priv()
|
||||
|
@ -2234,9 +2130,7 @@ void Plater::priv::select_view_3D(const std::string& name)
|
|||
else if (name == "Preview")
|
||||
set_current_panel(preview);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
wxGetApp().update_ui_from_settings(false);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void Plater::priv::select_next_view_3D()
|
||||
|
@ -2765,11 +2659,6 @@ void Plater::priv::deselect_all()
|
|||
|
||||
void Plater::priv::remove(size_t obj_idx)
|
||||
{
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
// Prevent toolpaths preview from rendering while we modify the Print object
|
||||
preview->set_enabled(false);
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
|
||||
if (view3D->is_layers_editing_enabled())
|
||||
view3D->enable_layers_editing(false);
|
||||
|
||||
|
@ -2800,18 +2689,11 @@ void Plater::priv::reset()
|
|||
|
||||
set_project_filename(wxEmptyString);
|
||||
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
// Prevent toolpaths preview from rendering while we modify the Print object
|
||||
preview->set_enabled(false);
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
|
||||
if (view3D->is_layers_editing_enabled())
|
||||
view3D->enable_layers_editing(false);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
reset_gcode_toolpaths();
|
||||
gcode_result.reset();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// Stop and reset the Print content.
|
||||
this->background_process.reset();
|
||||
|
@ -2958,19 +2840,12 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||
this->sidebar->show_sliced_info_sizer(false);
|
||||
// Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
|
||||
// Otherwise they will be just refreshed.
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (this->preview != nullptr) {
|
||||
// If the preview is not visible, the following line just invalidates the preview,
|
||||
// but the G-code paths or SLA preview are calculated first once the preview is made visible.
|
||||
reset_gcode_toolpaths();
|
||||
this->preview->reload_print();
|
||||
}
|
||||
#else
|
||||
if (this->preview != nullptr)
|
||||
// If the preview is not visible, the following line just invalidates the preview,
|
||||
// but the G-code paths or SLA preview are calculated first once the preview is made visible.
|
||||
this->preview->reload_print();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// In FDM mode, we need to reload the 3D scene because of the wipe tower preview box.
|
||||
// In SLA mode, we need to reload the 3D scene every time to show the support structures.
|
||||
if (this->printer_technology == ptSLA || (this->printer_technology == ptFFF && this->config->opt_bool("wipe_tower")))
|
||||
|
@ -4136,10 +4011,8 @@ void Plater::priv::reset_canvas_volumes()
|
|||
|
||||
bool Plater::priv::init_view_toolbar()
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_gcode_viewer())
|
||||
return true;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
if (view_toolbar.get_items_count() > 0)
|
||||
// already initialized
|
||||
|
@ -4186,10 +4059,8 @@ bool Plater::priv::init_view_toolbar()
|
|||
|
||||
bool Plater::priv::init_collapse_toolbar()
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_gcode_viewer())
|
||||
return true;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
if (collapse_toolbar.get_items_count() > 0)
|
||||
// already initialized
|
||||
|
@ -4230,7 +4101,6 @@ bool Plater::priv::init_collapse_toolbar()
|
|||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::priv::update_preview_bottom_toolbar()
|
||||
{
|
||||
preview->update_bottom_toolbar();
|
||||
|
@ -4250,7 +4120,6 @@ void Plater::priv::reset_gcode_toolpaths()
|
|||
{
|
||||
preview->get_canvas3d()->reset_gcode_toolpaths();
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
bool Plater::priv::can_set_instance_to_object() const
|
||||
{
|
||||
|
@ -4807,7 +4676,6 @@ void Plater::extract_config_from_project()
|
|||
load_files(input_paths, false, true);
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::load_gcode()
|
||||
{
|
||||
// Ask user for a gcode file name.
|
||||
|
@ -4858,7 +4726,6 @@ void Plater::refresh_print()
|
|||
{
|
||||
p->preview->refresh_print();
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
std::vector<size_t> Plater::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units /*= false*/) { return p->load_files(input_files, load_model, load_config, imperial_units); }
|
||||
|
||||
|
@ -5363,9 +5230,7 @@ void Plater::reslice()
|
|||
if ((state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) != 0)
|
||||
return;
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool clean_gcode_toolpaths = true;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
if (p->background_process.running())
|
||||
{
|
||||
if (wxGetApp().get_mode() == comSimple)
|
||||
|
@ -5378,7 +5243,6 @@ void Plater::reslice()
|
|||
}
|
||||
else if (!p->background_process.empty() && !p->background_process.idle())
|
||||
p->show_action_buttons(true);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
else
|
||||
clean_gcode_toolpaths = false;
|
||||
|
||||
|
@ -5387,10 +5251,6 @@ void Plater::reslice()
|
|||
|
||||
// update type of preview
|
||||
p->preview->update_view_type(!clean_gcode_toolpaths);
|
||||
#else
|
||||
// update type of preview
|
||||
p->preview->update_view_type(true);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void Plater::reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages)
|
||||
|
@ -5607,9 +5467,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
|||
// print technology is changed, so we should to update a search list
|
||||
p->sidebar->update_searcher();
|
||||
p->sidebar->show_sliced_info_sizer(false);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
p->reset_gcode_toolpaths();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
else if (opt_key == "bed_shape" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model") {
|
||||
bed_shape_changed = true;
|
||||
|
@ -5652,23 +5510,15 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
|||
|
||||
void Plater::set_bed_shape() const
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values,
|
||||
p->config->option<ConfigOptionString>("bed_custom_texture")->value,
|
||||
p->config->option<ConfigOptionString>("bed_custom_model")->value);
|
||||
#else
|
||||
p->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values,
|
||||
p->config->option<ConfigOptionString>("bed_custom_texture")->value,
|
||||
p->config->option<ConfigOptionString>("bed_custom_model")->value);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::set_bed_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const
|
||||
{
|
||||
p->set_bed_shape(shape, custom_texture, custom_model, force_as_custom);
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void Plater::force_filament_colors_update()
|
||||
{
|
||||
|
@ -5724,17 +5574,11 @@ void Plater::on_activate()
|
|||
}
|
||||
|
||||
// Get vector of extruder colors considering filament color, if extruder color is undefined.
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::vector<std::string> Plater::get_extruder_colors_from_plater_config(const GCodeProcessor::Result* const result) const
|
||||
#else
|
||||
std::vector<std::string> Plater::get_extruder_colors_from_plater_config() const
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (wxGetApp().is_gcode_viewer() && result != nullptr)
|
||||
return result->extruder_colors;
|
||||
else {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
const Slic3r::DynamicPrintConfig* config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
std::vector<std::string> extruder_colors;
|
||||
if (!config->has("extruder_colour")) // in case of a SLA print
|
||||
|
@ -5750,23 +5594,15 @@ std::vector<std::string> Plater::get_extruder_colors_from_plater_config() const
|
|||
extruder_colors[i] = filament_colours[i];
|
||||
|
||||
return extruder_colors;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
/* Get vector of colors used for rendering of a Preview scene in "Color print" mode
|
||||
* It consists of extruder colors and colors, saved in model.custom_gcode_per_print_z
|
||||
*/
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::vector<std::string> Plater::get_colors_for_color_print(const GCodeProcessor::Result* const result) const
|
||||
{
|
||||
std::vector<std::string> colors = get_extruder_colors_from_plater_config(result);
|
||||
#else
|
||||
std::vector<std::string> Plater::get_colors_for_color_print() const
|
||||
{
|
||||
std::vector<std::string> colors = get_extruder_colors_from_plater_config();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
colors.reserve(colors.size() + p->model.custom_gcode_per_print_z.gcodes.size());
|
||||
|
||||
for (const CustomGCode::Item& code : p->model.custom_gcode_per_print_z.gcodes)
|
||||
|
@ -5848,23 +5684,13 @@ PrinterTechnology Plater::printer_technology() const
|
|||
|
||||
const DynamicPrintConfig * Plater::config() const { return p->config; }
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool Plater::set_printer_technology(PrinterTechnology printer_technology)
|
||||
#else
|
||||
void Plater::set_printer_technology(PrinterTechnology printer_technology)
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
{
|
||||
p->printer_technology = printer_technology;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool ret = p->background_process.select_technology(printer_technology);
|
||||
if (ret) {
|
||||
// Update the active presets.
|
||||
}
|
||||
#else
|
||||
if (p->background_process.select_technology(printer_technology)) {
|
||||
// Update the active presets.
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
//FIXME for SLA synchronize
|
||||
//p->background_process.apply(Model)!
|
||||
|
||||
|
@ -5878,9 +5704,7 @@ void Plater::set_printer_technology(PrinterTechnology printer_technology)
|
|||
|
||||
p->sidebar->get_searcher().set_printer_technology(printer_technology);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
return ret;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void Plater::changed_object(int obj_idx)
|
||||
|
@ -6028,24 +5852,20 @@ bool Plater::init_view_toolbar()
|
|||
return p->init_view_toolbar();
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::enable_view_toolbar(bool enable)
|
||||
{
|
||||
p->view_toolbar.set_enabled(enable);
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
bool Plater::init_collapse_toolbar()
|
||||
{
|
||||
return p->init_collapse_toolbar();
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::enable_collapse_toolbar(bool enable)
|
||||
{
|
||||
p->collapse_toolbar.set_enabled(enable);
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
const Camera& Plater::get_camera() const
|
||||
{
|
||||
|
@ -6100,7 +5920,6 @@ GLToolbar& Plater::get_collapse_toolbar()
|
|||
return p->collapse_toolbar;
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::update_preview_bottom_toolbar()
|
||||
{
|
||||
p->update_preview_bottom_toolbar();
|
||||
|
@ -6120,7 +5939,6 @@ void Plater::reset_gcode_toolpaths()
|
|||
{
|
||||
p->reset_gcode_toolpaths();
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
const Mouse3DController& Plater::get_mouse3d_controller() const
|
||||
{
|
||||
|
@ -6189,9 +6007,7 @@ bool Plater::can_undo() const { return p->undo_redo_stack().has_undo_snapshot();
|
|||
bool Plater::can_redo() const { return p->undo_redo_stack().has_redo_snapshot(); }
|
||||
bool Plater::can_reload_from_disk() const { return p->can_reload_from_disk(); }
|
||||
const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_redo_stack_main(); }
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
void Plater::clear_undo_redo_stack_main() { p->undo_redo_stack_main().clear(); }
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); }
|
||||
void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); }
|
||||
bool Plater::inside_snapshot_capture() { return p->inside_snapshot_capture(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue