diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 18d48f2a5..2a88a6a8c 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -44,8 +44,6 @@ add_library(libslic3r_gui STATIC GUI/GUI.hpp GUI/GUI_Preview.cpp GUI/GUI_Preview.hpp - GUI/GUI_PreviewIface.cpp - GUI/GUI_PreviewIface.hpp GUI/GUI_App.cpp GUI/GUI_App.hpp GUI/GUI_Utils.cpp diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 193673260..a3ff45a6f 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -842,7 +842,7 @@ void GLVolumeCollection::load_object_auxiliary( // finalize_geometry() clears the vertex arrays, therefore the bounding box has to be computed before finalize_geometry(). v.bounding_box = v.indexed_vertex_array.bounding_box(); v.indexed_vertex_array.finalize_geometry(use_VBOs); - v.composite_id = GLVolume::CompositeID(obj_idx, -milestone, (int)instance_idx.first); + v.composite_id = GLVolume::CompositeID(obj_idx, - int(milestone), (int)instance_idx.first); v.geometry_id = std::pair(timestamp, model_instance.id().id); // Create a copy of the convex hull mesh for each instance. Use a move operator on the last instance. v.set_convex_hull((&instance_idx == &instances.back()) ? new TriangleMesh(std::move(convex_hull)) : new TriangleMesh(convex_hull), true); @@ -1906,14 +1906,9 @@ void _3DScene::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config) s_canvas_mgr.set_config(canvas, config); } -void _3DScene::set_print(wxGLCanvas* canvas, Print* print) +void _3DScene::set_process(wxGLCanvas* canvas, BackgroundSlicingProcess* process) { - s_canvas_mgr.set_print(canvas, print); -} - -void _3DScene::set_SLA_print(wxGLCanvas* canvas, SLAPrint* print) -{ - s_canvas_mgr.set_SLA_print(canvas, print); + s_canvas_mgr.set_process(canvas, process); } void _3DScene::set_model(wxGLCanvas* canvas, Model* model) diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index eb6bb9311..ddf98df52 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -603,8 +603,7 @@ public: static GUI::GLCanvas3D* get_canvas(wxGLCanvas* canvas); static void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config); - static void set_print(wxGLCanvas* canvas, Print* print); - static void set_SLA_print(wxGLCanvas* canvas, SLAPrint* print); + static void set_process(wxGLCanvas* canvas, BackgroundSlicingProcess* process); static void set_model(wxGLCanvas* canvas, Model* model); static void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape); diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 35dfcdf0e..d848cd1a7 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -53,6 +53,11 @@ void BackgroundSlicingProcess::select_technology(PrinterTechnology tech) assert(m_print != nullptr); } +PrinterTechnology BackgroundSlicingProcess::current_printer_technology() const +{ + return m_print->technology(); +} + // This function may one day be merged into the Print, but historically the print was separated // from the G-code generator. void BackgroundSlicingProcess::process_fff() diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp index 652d85487..fb0384385 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp @@ -56,6 +56,14 @@ public: // Activate either m_fff_print or m_sla_print. void select_technology(PrinterTechnology tech); + + // Get the currently active printer technology. + PrinterTechnology current_printer_technology() const; + // Get the current print. It is either m_fff_print or m_sla_print. + const PrintBase* current_print() const { return m_print; } + const Print* fff_print() const { return m_fff_print; } + const SLAPrint* sla_print() const { return m_sla_print; } + // Start the background processing. Returns false if the background processing was already running. bool start(); // Cancel the background processing. Returns false if the background processing was not running. diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f4fc163a0..bc7fa72b4 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3,6 +3,7 @@ #include "admesh/stl.h" #include "libslic3r/libslic3r.h" #include "slic3r/GUI/3DScene.hpp" +#include "slic3r/GUI/BackgroundSlicingProcess.hpp" #include "slic3r/GUI/GLShader.hpp" #include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/PresetBundle.hpp" @@ -3249,8 +3250,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) , m_context(nullptr) , m_toolbar(*this) , m_config(nullptr) - , m_print(nullptr) - , m_sla_print(nullptr) + , m_process(nullptr) , m_model(nullptr) , m_dirty(true) , m_initialized(false) @@ -3443,14 +3443,9 @@ void GLCanvas3D::set_config(DynamicPrintConfig* config) m_config = config; } -void GLCanvas3D::set_print(Print* print) +void GLCanvas3D::set_process(BackgroundSlicingProcess *process) { - m_print = print; -} - -void GLCanvas3D::set_SLA_print(SLAPrint* print) -{ - m_sla_print = print; + m_process = process; } void GLCanvas3D::set_model(Model* model) @@ -3875,7 +3870,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re m_reload_delayed = ! m_canvas->IsShown() && ! refresh_immediately && ! force_full_scene_refresh; - PrinterTechnology printer_technology = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology(); + PrinterTechnology printer_technology = m_process->current_printer_technology(); if (m_regenerate_volumes) { @@ -3892,12 +3887,13 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } } if (printer_technology == ptSLA) { + const SLAPrint *sla_print = this->sla_print(); #ifdef _DEBUG // Verify that the SLAPrint object is synchronized with m_model. - check_model_ids_equal(*m_model, m_sla_print->model()); + check_model_ids_equal(*m_model, sla_print->model()); #endif /* _DEBUG */ - sla_support_state.reserve(m_sla_print->objects().size()); - for (const SLAPrintObject *print_object : m_sla_print->objects()) { + sla_support_state.reserve(sla_print->objects().size()); + for (const SLAPrintObject *print_object : sla_print->objects()) { SLASupportState state; for (size_t istep = 0; istep < sla_steps.size(); ++ istep) { state.step[istep] = print_object->step_state_with_timestamp(sla_steps[istep]); @@ -4017,7 +4013,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } if (printer_technology == ptSLA) { size_t idx = 0; - for (const SLAPrintObject *print_object : m_sla_print->objects()) { + const SLAPrint *sla_print = this->sla_print(); + for (const SLAPrintObject *print_object : sla_print->objects()) { SLASupportState &state = sla_support_state[idx ++]; const ModelObject *model_object = print_object->model_object(); // Find an index of the ModelObject @@ -4026,9 +4023,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re continue; // There may be new SLA volumes added to the scene for this print_object. // Find the object index of this print_object in the Model::objects list. - auto it = std::find(m_sla_print->model().objects.begin(), m_sla_print->model().objects.end(), model_object); - assert(it != m_sla_print->model().objects.end()); - object_idx = it - m_sla_print->model().objects.begin(); + auto it = std::find(sla_print->model().objects.begin(), sla_print->model().objects.end(), model_object); + assert(it != sla_print->model().objects.end()); + object_idx = it - sla_print->model().objects.begin(); // Collect indices of this print_object's instances, for which the SLA support meshes are to be added to the scene. // pairs of std::vector> instances[std::tuple_size::value]; @@ -4092,11 +4089,12 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re float w = dynamic_cast(m_config->option("wipe_tower_width"))->value; float a = dynamic_cast(m_config->option("wipe_tower_rotation_angle"))->value; - float depth = m_print->get_wipe_tower_depth(); - if (!m_print->is_step_done(psWipeTower)) + const Print *print = m_process->fff_print(); + float depth = print->get_wipe_tower_depth(); + if (!print->is_step_done(psWipeTower)) depth = (900.f/w) * (float)(extruders_count - 1) ; - m_volumes.load_wipe_tower_preview(1000, x, y, w, depth, (float)height, a, m_use_VBOs && m_initialized, !m_print->is_step_done(psWipeTower), - m_print->config().nozzle_diameter.values[0] * 1.25f * 4.5f); + m_volumes.load_wipe_tower_preview(1000, x, y, w, depth, (float)height, a, m_use_VBOs && m_initialized, !print->is_step_done(psWipeTower), + print->config().nozzle_diameter.values[0] * 1.25f * 4.5f); } } @@ -4145,7 +4143,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const std::vector& str_tool_colors) { - if ((m_canvas != nullptr) && (m_print != nullptr)) + const Print *print = this->fff_print(); + if ((m_canvas != nullptr) && (print != nullptr)) { #if !ENABLE_USE_UNIQUE_GLCONTEXT // ensures that this canvas is current @@ -4186,12 +4185,13 @@ void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const void GLCanvas3D::load_preview(const std::vector& str_tool_colors) { - if (m_print == nullptr) + const Print *print = this->fff_print(); + if (print == nullptr) return; _load_print_toolpaths(); _load_wipe_tower_toolpaths(str_tool_colors); - for (const PrintObject* object : m_print->objects()) + for (const PrintObject* object : print->objects()) { if (object != nullptr) _load_print_object_toolpaths(*object, str_tool_colors); @@ -4472,7 +4472,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // A volume is selected and the mouse is inside the reset button. // The PrintObject::adjust_layer_height_profile() call adjusts the profile of its associated ModelObject, it does not modify the profile of the PrintObject itself, // therefore it is safe to call it while the background processing is running. - const_cast(m_print->get_object(layer_editing_object_idx))->reset_layer_height_profile(); + const_cast(this->fff_print()->get_object(layer_editing_object_idx))->reset_layer_height_profile(); // Index 2 means no editing, just wait for mouse up event. m_layers_editing.state = LayersEditing::Completed; @@ -5400,7 +5400,8 @@ float GLCanvas3D::_get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) co void GLCanvas3D::_mark_volumes_for_layer_height() const { - if (m_print == nullptr) + const Print *print = (m_process == nullptr) ? nullptr : m_process->fff_print(); + if (print == nullptr) return; for (GLVolume* vol : m_volumes.volumes) @@ -5409,10 +5410,10 @@ void GLCanvas3D::_mark_volumes_for_layer_height() const int shader_id = m_layers_editing.get_shader_program_id(); if (is_layers_editing_enabled() && (shader_id != -1) && vol->selected && - vol->has_layer_height_texture() && (object_id < (int)m_print->objects().size())) + vol->has_layer_height_texture() && (object_id < (int)print->objects().size())) { vol->set_layer_height_texture_data(m_layers_editing.get_z_texture_id(), shader_id, - m_print->get_object(object_id), _get_layers_editing_cursor_z_relative(), m_layers_editing.band_width); + print->get_object(object_id), _get_layers_editing_cursor_z_relative(), m_layers_editing.band_width); } else vol->reset_layer_height_texture_data(); @@ -5623,7 +5624,8 @@ void GLCanvas3D::_render_legend_texture() const void GLCanvas3D::_render_layer_editing_overlay() const { - if ((m_print == nullptr) || m_print->objects().empty()) + const Print *print = this->fff_print(); + if ((print == nullptr) || print->objects().empty()) return; GLVolume* volume = nullptr; @@ -5643,10 +5645,10 @@ void GLCanvas3D::_render_layer_editing_overlay() const // If the active object was not allocated at the Print, go away.This should only be a momentary case between an object addition / deletion // and an update by Platter::async_apply_config. int object_idx = volume->object_idx(); - if ((int)m_print->objects().size() <= object_idx) + if ((int)print->objects().size() <= object_idx) return; - const PrintObject* print_object = m_print->get_object(object_idx); + const PrintObject* print_object = print->get_object(object_idx); if (print_object == nullptr) return; @@ -5854,10 +5856,11 @@ void GLCanvas3D::_perform_layer_editing_action(wxMouseEvent* evt) if (object_idx_selected == -1) return; - if (m_print == nullptr) + const Print *print = this->fff_print(); + if (print == nullptr) return; - const PrintObject* selected_obj = m_print->get_object(object_idx_selected); + const PrintObject* selected_obj = print->get_object(object_idx_selected); if (selected_obj == nullptr) return; @@ -5880,7 +5883,7 @@ void GLCanvas3D::_perform_layer_editing_action(wxMouseEvent* evt) int volume_idx = 0; for (int i = 0; i < object_idx_selected; ++i) { - const PrintObject* obj = m_print->get_object(i); + const PrintObject* obj = print->get_object(i); if (obj != nullptr) { for (int j = 0; j < (int)obj->region_volumes.size(); ++j) @@ -5953,29 +5956,30 @@ void GLCanvas3D::_load_print_toolpaths() return; #endif // !ENABLE_USE_UNIQUE_GLCONTEXT - if (m_print == nullptr) + const Print *print = this->fff_print(); + if (print == nullptr) return; - if (!m_print->is_step_done(psSkirt) || !m_print->is_step_done(psBrim)) + if (!print->is_step_done(psSkirt) || !print->is_step_done(psBrim)) return; - if (!m_print->has_skirt() && (m_print->config().brim_width.value == 0)) + if (!print->has_skirt() && (print->config().brim_width.value == 0)) return; const float color[] = { 0.5f, 1.0f, 0.5f, 1.0f }; // greenish // number of skirt layers size_t total_layer_count = 0; - for (const PrintObject* print_object : m_print->objects()) + for (const PrintObject* print_object : print->objects()) { total_layer_count = std::max(total_layer_count, print_object->total_layer_count()); } - size_t skirt_height = m_print->has_infinite_skirt() ? total_layer_count : std::min(m_print->config().skirt_height.value, total_layer_count); - if ((skirt_height == 0) && (m_print->config().brim_width.value > 0)) + size_t skirt_height = print->has_infinite_skirt() ? total_layer_count : std::min(print->config().skirt_height.value, total_layer_count); + if ((skirt_height == 0) && (print->config().brim_width.value > 0)) skirt_height = 1; // get first skirt_height layers (maybe this should be moved to a PrintObject method?) - const PrintObject* object0 = m_print->objects().front(); + const PrintObject* object0 = print->objects().front(); std::vector print_zs; print_zs.reserve(skirt_height * 2); for (size_t i = 0; i < std::min(skirt_height, object0->layers().size()); ++i) @@ -5998,9 +6002,9 @@ void GLCanvas3D::_load_print_toolpaths() volume.offsets.push_back(volume.indexed_vertex_array.quad_indices.size()); volume.offsets.push_back(volume.indexed_vertex_array.triangle_indices.size()); if (i == 0) - _3DScene::extrusionentity_to_verts(m_print->brim(), print_zs[i], Point(0, 0), volume); + _3DScene::extrusionentity_to_verts(print->brim(), print_zs[i], Point(0, 0), volume); - _3DScene::extrusionentity_to_verts(m_print->skirt(), print_zs[i], Point(0, 0), volume); + _3DScene::extrusionentity_to_verts(print->skirt(), print_zs[i], Point(0, 0), volume); } volume.bounding_box = volume.indexed_vertex_array.bounding_box(); volume.indexed_vertex_array.finalize_geometry(m_use_VBOs && m_initialized); @@ -6162,10 +6166,11 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector& str_tool_colors) { - if ((m_print == nullptr) || m_print->wipe_tower_data().tool_changes.empty()) + const Print *print = this->fff_print(); + if ((print == nullptr) || print->wipe_tower_data().tool_changes.empty()) return; - if (!m_print->is_step_done(psWipeTower)) + if (!print->is_step_done(psWipeTower)) return; std::vector tool_colors = _parse_colors(str_tool_colors); @@ -6202,12 +6207,12 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector& str_ std::vector final; } ctxt; - ctxt.print = m_print; + ctxt.print = print; ctxt.tool_colors = tool_colors.empty() ? nullptr : &tool_colors; - if (m_print->wipe_tower_data().priming && m_print->config().single_extruder_multi_material_priming) - ctxt.priming.emplace_back(*m_print->wipe_tower_data().priming.get()); - if (m_print->wipe_tower_data().final_purge) - ctxt.final.emplace_back(*m_print->wipe_tower_data().final_purge.get()); + if (print->wipe_tower_data().priming && print->config().single_extruder_multi_material_priming) + ctxt.priming.emplace_back(*print->wipe_tower_data().priming.get()); + if (print->wipe_tower_data().final_purge) + ctxt.final.emplace_back(*print->wipe_tower_data().final_purge.get()); ctxt.wipe_tower_angle = ctxt.print->config().wipe_tower_rotation_angle.value/180.f * PI; ctxt.wipe_tower_pos = WipeTower::xy(ctxt.print->config().wipe_tower_x.value, ctxt.print->config().wipe_tower_y.value); @@ -6215,7 +6220,7 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector& str_ BOOST_LOG_TRIVIAL(debug) << "Loading wipe tower toolpaths in parallel - start"; //FIXME Improve the heuristics for a grain size. - size_t n_items = m_print->wipe_tower_data().tool_changes.size() + (ctxt.priming.empty() ? 0 : 1); + size_t n_items = print->wipe_tower_data().tool_changes.size() + (ctxt.priming.empty() ? 0 : 1); size_t grain_size = std::max(n_items / 128, size_t(1)); tbb::spin_mutex new_volume_mutex; auto new_volume = [this, &new_volume_mutex](const float *color) -> GLVolume* { @@ -6820,13 +6825,14 @@ void GLCanvas3D::_load_shells() size_t initial_volumes_count = m_volumes.volumes.size(); m_gcode_preview_volume_index.first_volumes.emplace_back(GCodePreviewVolumeIndex::Shell, 0, (unsigned int)initial_volumes_count); - if (m_print->objects().empty()) + const Print *print = this->fff_print(); + if (print->objects().empty()) // nothing to render, return return; // adds objects' volumes unsigned int object_id = 0; - for (const PrintObject* obj : m_print->objects()) + for (const PrintObject* obj : print->objects()) { const ModelObject* model_obj = obj->model_object(); @@ -6843,15 +6849,15 @@ void GLCanvas3D::_load_shells() if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptFFF) { // adds wipe tower's volume - double max_z = m_print->objects()[0]->model_object()->get_model()->bounding_box().max(2); - const PrintConfig& config = m_print->config(); + double max_z = print->objects()[0]->model_object()->get_model()->bounding_box().max(2); + const PrintConfig& config = print->config(); unsigned int extruders_count = config.nozzle_diameter.size(); if ((extruders_count > 1) && config.single_extruder_multi_material && config.wipe_tower && !config.complete_objects) { - float depth = m_print->get_wipe_tower_depth(); - if (!m_print->is_step_done(psWipeTower)) + float depth = print->get_wipe_tower_depth(); + if (!print->is_step_done(psWipeTower)) depth = (900.f/config.wipe_tower_width) * (float)(extruders_count - 1) ; m_volumes.load_wipe_tower_preview(1000, config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle, - m_use_VBOs && m_initialized, !m_print->is_step_done(psWipeTower), m_print->config().nozzle_diameter.values[0] * 1.25f * 4.5f); + m_use_VBOs && m_initialized, !print->is_step_done(psWipeTower), print->config().nozzle_diameter.values[0] * 1.25f * 4.5f); } } } @@ -7050,5 +7056,15 @@ void GLCanvas3D::_resize_toolbar() const } } +const Print* GLCanvas3D::fff_print() const +{ + return (m_process == nullptr) ? nullptr : m_process->fff_print(); +} + +const SLAPrint* GLCanvas3D::sla_print() const +{ + return (m_process == nullptr) ? nullptr : m_process->sla_print(); +} + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 7dac13d72..f5ae70919 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -23,7 +23,7 @@ namespace Slic3r { class GLShader; class ExPolygon; -class SLAPrint; +class BackgroundSlicingProcess; namespace GUI { @@ -704,9 +704,8 @@ private: mutable GLVolumeCollection m_volumes; Selection m_selection; DynamicPrintConfig* m_config; - Print* m_print; - SLAPrint* m_sla_print; Model* m_model; + BackgroundSlicingProcess *m_process; // Screen is only refreshed from the OnIdle handler if it is dirty. bool m_dirty; @@ -759,8 +758,7 @@ public: int check_volumes_outside_state(const DynamicPrintConfig* config) const; void set_config(DynamicPrintConfig* config); - void set_print(Print* print); - void set_SLA_print(SLAPrint* print); + void set_process(BackgroundSlicingProcess* process); void set_model(Model* model); const Selection& get_selection() const { return m_selection; } @@ -955,6 +953,9 @@ private: void _resize_toolbar() const; static std::vector _parse_colors(const std::vector& colors); + + const Print* fff_print() const; + const SLAPrint* sla_print() const; }; } // namespace GUI diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index 6038f0b62..d3f38e292 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -265,18 +265,11 @@ void GLCanvas3DManager::set_config(wxGLCanvas* canvas, DynamicPrintConfig* confi it->second->set_config(config); } -void GLCanvas3DManager::set_print(wxGLCanvas* canvas, Print* print) +void GLCanvas3DManager::set_process(wxGLCanvas* canvas, BackgroundSlicingProcess* process) { CanvasesMap::iterator it = _get_canvas(canvas); if (it != m_canvases.end()) - it->second->set_print(print); -} - -void GLCanvas3DManager::set_SLA_print(wxGLCanvas* canvas, SLAPrint* print) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->set_SLA_print(print); + it->second->set_process(process); } void GLCanvas3DManager::set_model(wxGLCanvas* canvas, Model* model) diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index e03f780c8..343250ccd 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -12,9 +12,8 @@ class wxGLContext; namespace Slic3r { +class BackgroundSlicingProcess; class DynamicPrintConfig; -class Print; -class SLAPrint; class Model; class ExPolygon; typedef std::vector ExPolygons; @@ -93,8 +92,7 @@ public: GLCanvas3D* get_canvas(wxGLCanvas* canvas); void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config); - void set_print(wxGLCanvas* canvas, Print* print); - void set_SLA_print(wxGLCanvas* canvas, SLAPrint* print); + void set_process(wxGLCanvas* canvas, BackgroundSlicingProcess* process); void set_model(wxGLCanvas* canvas, Model* model); void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape); diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 5828e9a22..164cb4a41 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -27,7 +27,6 @@ #include "wxExtensions.hpp" #include "GUI_Preview.hpp" -#include "GUI_PreviewIface.hpp" #include "AboutDialog.hpp" #include "AppConfig.hpp" #include "ConfigWizard.hpp" @@ -81,8 +80,6 @@ void break_to_debugger() #endif /* _WIN32 */ } -PreviewIface* g_preview = nullptr; - bool config_wizard_startup(bool app_config_exists) { if (!app_config_exists || wxGetApp().preset_bundle->printers.size() <= 1) { @@ -119,17 +116,6 @@ void config_wizard(int reason) wxGetApp().load_current_presets(); } -PreviewIface* create_preview_iface(wxNotebook* parent, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data) -{ - if (g_preview == nullptr) - { - Preview* panel = new Preview(parent, config, print, gcode_preview_data); - g_preview = new PreviewIface(panel); - } - - return g_preview; -} - // opt_index = 0, by the reason of zero-index in ConfigOptionVector by default (in case only one element) void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index /*= 0*/) { diff --git a/src/slic3r/GUI/GUI.hpp b/src/slic3r/GUI/GUI.hpp index cbc20c3c1..66c84f8a1 100644 --- a/src/slic3r/GUI/GUI.hpp +++ b/src/slic3r/GUI/GUI.hpp @@ -17,7 +17,6 @@ namespace Slic3r { class AppConfig; class DynamicPrintConfig; -class PreviewIface; class Print; class GCodePreviewData; class AppControllerBase; @@ -70,8 +69,6 @@ extern bool config_wizard_startup(bool app_config_exists); // The run_reason argument is actually ConfigWizard::RunReason, but int is used here because of Perl. extern void config_wizard(int run_reason); -PreviewIface* create_preview_iface(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data); - // Change option value in config void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0); diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index b7f85d1ad..bcc488e5d 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -1,11 +1,12 @@ -#include "../../libslic3r/libslic3r.h" +#include "libslic3r/libslic3r.h" +#include "libslic3r/GCode/PreviewData.hpp" #include "GUI_Preview.hpp" #include "GUI_App.hpp" #include "GUI.hpp" #include "AppConfig.hpp" #include "3DScene.hpp" +#include "BackgroundSlicingProcess.hpp" #include "GLCanvas3DManager.hpp" -#include "../../libslic3r/GCode/PreviewData.hpp" #include "PresetBundle.hpp" #include "wxExtensions.hpp" @@ -24,7 +25,7 @@ namespace Slic3r { namespace GUI { -Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data, std::function schedule_background_process_func) +Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function schedule_background_process_func) : m_canvas(nullptr) , m_double_slider_sizer(nullptr) , m_label_view_type(nullptr) @@ -36,7 +37,7 @@ Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, , m_checkbox_unretractions(nullptr) , m_checkbox_shells(nullptr) , m_config(config) - , m_print(print) + , m_process(process) , m_gcode_preview_data(gcode_preview_data) , m_number_extruders(1) , m_preferred_color_mode("feature") @@ -45,7 +46,7 @@ Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, , m_force_sliders_full_range(false) , m_schedule_background_process(schedule_background_process_func) { - if (init(notebook, config, print, gcode_preview_data)) + if (init(notebook, config, process, gcode_preview_data)) { notebook->AddPage(this, _(L("Preview"))); show_hide_ui_elements("none"); @@ -53,9 +54,9 @@ Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, } } -bool Preview::init(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data) +bool Preview::init(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data) { - if ((notebook == nullptr) || (config == nullptr) || (print == nullptr) || (gcode_preview_data == nullptr)) + if ((notebook == nullptr) || (config == nullptr) || (process == nullptr) || (gcode_preview_data == nullptr)) return false; // creates this panel add append it to the given notebook as a new page @@ -68,7 +69,7 @@ bool Preview::init(wxNotebook* notebook, DynamicPrintConfig* config, Print* prin _3DScene::allow_multisample(m_canvas, GLCanvas3DManager::can_multisample()); _3DScene::enable_shader(m_canvas, true); _3DScene::set_config(m_canvas, m_config); - _3DScene::set_print(m_canvas, m_print); + _3DScene::set_process(m_canvas, process); _3DScene::enable_legend_texture(m_canvas, true); _3DScene::enable_dynamic_background(m_canvas, true); @@ -250,10 +251,12 @@ void Preview::load_print() // is performed on all of them(this ensures that _shifted_copies was // populated and we know the number of layers) unsigned int n_layers = 0; - if (m_print->is_step_done(posSlice)) + assert(m_process->current_printer_technology() == ptFFF); + const Print *print = m_process->fff_print(); + if (print->is_step_done(posSlice)) { std::set zs; - for (const PrintObject* print_object : m_print->objects()) + for (const PrintObject* print_object : print->objects()) { const LayerPtrs& layers = print_object->layers(); const SupportLayerPtrs& support_layers = print_object->support_layers(); @@ -285,7 +288,7 @@ void Preview::load_print() { // It is left to Slic3r to decide whether the print shall be colored by the tool or by the feature. // Color by feature if it is a single extruder print. - unsigned int number_extruders = (unsigned int)m_print->extruders().size(); + unsigned int number_extruders = (unsigned int)print->extruders().size(); 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); diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index bafcba1ba..cafc94365 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -19,6 +19,7 @@ namespace Slic3r { class DynamicPrintConfig; class Print; +class BackgroundSlicingProcess; class GCodePreviewData; namespace GUI { @@ -37,7 +38,7 @@ class Preview : public wxPanel wxCheckBox* m_checkbox_shells; DynamicPrintConfig* m_config; - Print* m_print; + BackgroundSlicingProcess* m_process; GCodePreviewData* m_gcode_preview_data; // Calling this function object forces Plater::schedule_background_process. @@ -53,7 +54,7 @@ class Preview : public wxPanel PrusaDoubleSlider* m_slider {nullptr}; public: - Preview(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data, std::function schedule_background_process = [](){}); + Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function schedule_background_process = [](){}); virtual ~Preview(); wxGLCanvas* get_wxglcanvas() { return m_canvas; } @@ -73,7 +74,7 @@ public: void refresh_print(); private: - bool init(wxNotebook* notebook, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data); + bool init(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data); void bind_event_handlers(); void unbind_event_handlers(); diff --git a/src/slic3r/GUI/GUI_PreviewIface.cpp b/src/slic3r/GUI/GUI_PreviewIface.cpp deleted file mode 100644 index cbec51205..000000000 --- a/src/slic3r/GUI/GUI_PreviewIface.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "../../libslic3r/libslic3r.h" -#include "GUI_PreviewIface.hpp" -#include "GUI_Preview.hpp" - -namespace Slic3r { - -void PreviewIface::set_number_extruders(unsigned int number_extruders) -{ - m_preview->set_number_extruders(number_extruders); -} - -void PreviewIface::reset_gcode_preview_data() -{ - m_preview->reset_gcode_preview_data(); -} - -void PreviewIface::reload_print(bool force) -{ - m_preview->reload_print(force); -} - -void PreviewIface::set_canvas_as_dirty() -{ - m_preview->set_canvas_as_dirty(); -} - -void PreviewIface::set_enabled(bool enabled) -{ - m_preview->set_enabled(enabled); -} - -void PreviewIface::set_bed_shape(const Pointfs& shape) -{ - m_preview->set_bed_shape(shape); -} - -void PreviewIface::select_view(const std::string& direction) -{ - m_preview->select_view(direction); -} - -void PreviewIface::set_viewport_from_scene(wxGLCanvas* canvas) -{ - m_preview->set_viewport_from_scene(canvas); -} - -void PreviewIface::set_viewport_into_scene(wxGLCanvas* canvas) -{ - m_preview->set_viewport_into_scene(canvas); -} - -void PreviewIface::set_drop_target(wxDropTarget* target) -{ - m_preview->set_drop_target(target); -} - -} // namespace Slic3r diff --git a/src/slic3r/GUI/GUI_PreviewIface.hpp b/src/slic3r/GUI/GUI_PreviewIface.hpp deleted file mode 100644 index df5fccaaf..000000000 --- a/src/slic3r/GUI/GUI_PreviewIface.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef slic3r_GUI_PreviewIface_hpp_ -#define slic3r_GUI_PreviewIface_hpp_ - -#include "../../libslic3r/Point.hpp" - -class wxGLCanvas; -class wxDropTarget; - -namespace Slic3r { - -namespace GUI { -class Preview; -} // namespace GUI - -class PreviewIface -{ - GUI::Preview* m_preview; - -public: - explicit PreviewIface(GUI::Preview* preview) : m_preview(preview) {} - - void set_number_extruders(unsigned int number_extruders); - void reset_gcode_preview_data(); - void reload_print(bool force = false); - void set_canvas_as_dirty(); - void set_enabled(bool enabled); - void set_bed_shape(const Pointfs& shape); - void select_view(const std::string& direction); - void set_viewport_from_scene(wxGLCanvas* canvas); - void set_viewport_into_scene(wxGLCanvas* canvas); - void set_drop_target(wxDropTarget* target); -}; - -} // namespace Slic3r - -#endif // slic3r_GUI_PreviewIface_hpp_ diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 0dcc61542..76468874c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1064,7 +1064,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) panel3d->SetSizer(panel3dsizer); notebook->AddPage(panel3d, _(L("3D"))); - preview = new GUI::Preview(notebook, config, &print, &gcode_preview_data, [this](){ schedule_background_process(); }); + preview = new GUI::Preview(notebook, config, &background_process, &gcode_preview_data, [this](){ schedule_background_process(); }); _3DScene::get_canvas(canvas3D)->set_external_gizmo_widgets_parent(panel_gizmo_widgets); @@ -1073,8 +1073,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) _3DScene::enable_moving(canvas3D, true); // XXX: more config from 3D.pm _3DScene::set_model(canvas3D, &model); - _3DScene::set_print(canvas3D, &print); - _3DScene::set_SLA_print(canvas3D, &sla_print); + _3DScene::set_process(canvas3D, &background_process); _3DScene::set_config(canvas3D, config); _3DScene::enable_gizmos(canvas3D, true); _3DScene::enable_toolbar(canvas3D, true); diff --git a/xs/src/perlglue.cpp b/xs/src/perlglue.cpp index 72184be34..98a124c3f 100644 --- a/xs/src/perlglue.cpp +++ b/xs/src/perlglue.cpp @@ -54,20 +54,6 @@ REGISTER_CLASS(Surface, "Surface"); REGISTER_CLASS(SurfaceCollection, "Surface::Collection"); REGISTER_CLASS(PrintObjectSupportMaterial, "Print::SupportMaterial2"); REGISTER_CLASS(TriangleMesh, "TriangleMesh"); -REGISTER_CLASS(AppConfig, "GUI::AppConfig"); -REGISTER_CLASS(BackgroundSlicingProcess, "GUI::BackgroundSlicingProcess"); -REGISTER_CLASS(GLShader, "GUI::_3DScene::GLShader"); -REGISTER_CLASS(GLVolume, "GUI::_3DScene::GLVolume"); -REGISTER_CLASS(GLVolumeCollection, "GUI::_3DScene::GLVolume::Collection"); -REGISTER_CLASS(Preset, "GUI::Preset"); -REGISTER_CLASS(PresetCollection, "GUI::PresetCollection"); -REGISTER_CLASS(PresetBundle, "GUI::PresetBundle"); -REGISTER_CLASS(TabIface, "GUI::Tab"); -REGISTER_CLASS(PreviewIface, "GUI::Preview"); -REGISTER_CLASS(ProgressStatusBar, "GUI::ProgressStatusBar"); -REGISTER_CLASS(PresetUpdater, "PresetUpdater"); -REGISTER_CLASS(PrintController, "PrintController"); -REGISTER_CLASS(PrintHost, "PrintHost"); SV* ConfigBase__as_hash(ConfigBase* THIS) { diff --git a/xs/xsp/GUI.xsp b/xs/xsp/GUI.xsp deleted file mode 100644 index a1e3e4670..000000000 --- a/xs/xsp/GUI.xsp +++ /dev/null @@ -1,211 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/GUI.hpp" -#include "slic3r/Utils/ASCIIFolding.hpp" -#include "slic3r/Utils/FixModelByWin10.hpp" -#include "slic3r/Utils/Serial.hpp" -%} - - -%package{Slic3r::GUI}; - -void about() - %code{% Slic3r::GUI::about(); %}; - -void disable_screensaver() - %code{% Slic3r::GUI::disable_screensaver(); %}; - -void enable_screensaver() - %code{% Slic3r::GUI::enable_screensaver(); %}; - -std::vector scan_serial_ports() - %code{% RETVAL=Slic3r::Utils::scan_serial_ports(); %}; - -bool debugged() - %code{% RETVAL=Slic3r::GUI::debugged(); %}; - -void break_to_debugger() - %code{% Slic3r::GUI::break_to_debugger(); %}; - -bool is_windows10() - %code{% RETVAL=Slic3r::is_windows10(); %}; - -void set_wxapp(SV *ui) - %code%{ Slic3r::GUI::set_wxapp((wxApp*)wxPli_sv_2_object(aTHX_ ui, "Wx::App")); %}; - -void set_gui_appctl() - %code%{ Slic3r::GUI::set_gui_appctl(); %}; - -void set_cli_appctl() - %code%{ Slic3r::GUI::set_cli_appctl(); %}; - -void set_progress_status_bar(ProgressStatusBar *prs) - %code%{ Slic3r::GUI::set_progress_status_bar(prs); %}; - -void set_main_frame(SV *ui) - %code%{ Slic3r::GUI::set_main_frame((wxFrame*)wxPli_sv_2_object(aTHX_ ui, "Wx::Frame")); %}; - -void set_tab_panel(SV *ui) - %code%{ Slic3r::GUI::set_tab_panel((wxNotebook*)wxPli_sv_2_object(aTHX_ ui, "Wx::Notebook")); %}; - -void set_plater(SV *ui) - %code%{ Slic3r::GUI::set_plater((wxPanel*)wxPli_sv_2_object(aTHX_ ui, "Wx::Panel")); %}; - -void add_menus(SV *ui, int event_preferences_changed, int event_language_change) - %code%{ Slic3r::GUI::add_menus((wxMenuBar*)wxPli_sv_2_object(aTHX_ ui, "Wx::MenuBar"), event_preferences_changed, event_language_change); %}; - -void create_preset_tabs(int event_value_change, int event_presets_changed) - %code%{ Slic3r::GUI::create_preset_tabs(event_value_change, event_presets_changed); %}; - -void show_error_id(int id, std::string msg) - %code%{ Slic3r::GUI::show_error_id(id, msg); %}; - -TabIface* get_preset_tab(char *name) - %code%{ RETVAL=Slic3r::GUI::get_preset_tab_iface(name); %}; - -PreviewIface* create_preview_iface(SV *ui, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data) - %code%{ RETVAL=Slic3r::GUI::create_preview_iface((wxNotebook*)wxPli_sv_2_object(aTHX_ ui, "Wx::Notebook"), config, print, gcode_preview_data); %}; - -bool load_language() - %code%{ RETVAL=Slic3r::GUI::load_language(); %}; - -void create_combochecklist(SV *ui, std::string text, std::string items, bool initial_value) - %code%{ Slic3r::GUI::create_combochecklist((wxComboCtrl*)wxPli_sv_2_object(aTHX_ ui, "Wx::ComboCtrl"), text, items, initial_value); %}; - -int combochecklist_get_flags(SV *ui) - %code%{ RETVAL=Slic3r::GUI::combochecklist_get_flags((wxComboCtrl*)wxPli_sv_2_object(aTHX_ ui, "Wx::ComboCtrl")); %}; - -void set_app_config(AppConfig *app_config) - %code%{ Slic3r::GUI::set_app_config(app_config); %}; - -bool check_unsaved_changes() - %code%{ RETVAL=Slic3r::GUI::check_unsaved_changes(); %}; - -bool config_wizard_startup(int app_config_exists) - %code%{ - RETVAL=Slic3r::GUI::config_wizard_startup(app_config_exists != 0); - %}; - -void open_preferences_dialog(int preferences_event) - %code%{ Slic3r::GUI::open_preferences_dialog(preferences_event); %}; - -void set_preset_bundle(PresetBundle *preset_bundle) - %code%{ Slic3r::GUI::set_preset_bundle(preset_bundle); %}; - -void set_preset_updater(PresetUpdater* updater) - %code%{ Slic3r::GUI::set_preset_updater(updater); %}; - -void add_frequently_changed_parameters(SV *ui_parent, SV *ui_sizer, SV *ui_p_sizer) - %code%{ Slic3r::GUI::add_frequently_changed_parameters((wxWindow*)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"), - (wxBoxSizer*)wxPli_sv_2_object(aTHX_ ui_sizer, "Wx::BoxSizer"), - (wxFlexGridSizer*)wxPli_sv_2_object(aTHX_ ui_p_sizer, "Wx::FlexGridSizer")); %}; - -void set_print_callback_event(Print *print, int id) - %code%{ Slic3r::GUI::set_print_callback_event(print, id); %}; - -void set_model_events_from_perl(Model *model, - int event_object_selection_changed, - int event_object_settings_changed, - int event_remove_object, - int event_update_scene) - %code%{ Slic3r::GUI::set_model_events_from_perl(*model, - event_object_selection_changed, - event_object_settings_changed, - event_remove_object, - event_update_scene); %}; - -void set_objects_from_perl( SV *ui_parent, - SV *frequently_changed_parameters_sizer, - SV *info_sizer, - SV *btn_export_gcode, - SV *btn_reslice, - SV *btn_print, - SV *btn_send_gcode, - SV *manifold_warning_icon) - %code%{ Slic3r::GUI::set_objects_from_perl( - (wxWindow *)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"), - (wxBoxSizer *)wxPli_sv_2_object(aTHX_ frequently_changed_parameters_sizer, "Wx::BoxSizer"), - (wxBoxSizer *)wxPli_sv_2_object(aTHX_ info_sizer, "Wx::BoxSizer"), - (wxButton *)wxPli_sv_2_object(aTHX_ btn_export_gcode, "Wx::Button"), - (wxButton *)wxPli_sv_2_object(aTHX_ btn_reslice, "Wx::Button"), - (wxButton *)wxPli_sv_2_object(aTHX_ btn_print, "Wx::Button"), - (wxButton *)wxPli_sv_2_object(aTHX_ btn_send_gcode, "Wx::Button"), - (wxStaticBitmap *)wxPli_sv_2_object(aTHX_ manifold_warning_icon, "Wx::StaticBitmap")); %}; - -void set_show_print_info(bool show) - %code%{ Slic3r::GUI::set_show_print_info(show); %}; - -void set_show_manifold_warning_icon(bool show) - %code%{ Slic3r::GUI::set_show_manifold_warning_icon(show); %}; - -void update_mode() - %code%{ Slic3r::GUI::update_mode(); %}; - -void add_object_to_list(const char *name, SV *object_model) - %code%{ Slic3r::GUI::add_object_to_list( - name, - (ModelObject *)wxPli_sv_2_object(aTHX_ object_model, "Slic3r::Model::Object") ); %}; - -void delete_object_from_list() - %code%{ Slic3r::GUI::delete_object_from_list(); %}; - -void delete_all_objects_from_list() - %code%{ Slic3r::GUI::delete_all_objects_from_list(); %}; - -void set_object_count(int idx, int count) - %code%{ Slic3r::GUI::set_object_count(idx, count); %}; - -void unselect_objects() - %code%{ Slic3r::GUI::unselect_objects(); %}; - -void select_current_object(int idx) - %code%{ Slic3r::GUI::select_current_object(idx); %}; - -void select_current_volume(int idx, int vol_idx) - %code%{ Slic3r::GUI::select_current_volume(idx, vol_idx); %}; - -void remove_obj() - %code%{ Slic3r::GUI::remove(); %}; - -std::string fold_utf8_to_ascii(const char *src) - %code%{ RETVAL = Slic3r::fold_utf8_to_ascii(src); %}; - -void add_export_option(SV *ui, std::string format) - %code%{ Slic3r::GUI::add_export_option((wxFileDialog*)wxPli_sv_2_object(aTHX_ ui, "Wx::FileDialog"), format); %}; - -int get_export_option(SV *ui) - %code%{ RETVAL = Slic3r::GUI::get_export_option((wxFileDialog*)wxPli_sv_2_object(aTHX_ ui, "Wx::FileDialog")); %}; - -void desktop_open_datadir_folder() - %code%{ Slic3r::GUI::desktop_open_datadir_folder(); %}; - -void fix_model_by_win10_sdk_gui(ModelObject *model_object_src, Print *print, Model *model_dst) - %code%{ Slic3r::fix_model_by_win10_sdk_gui(*model_object_src, *print, *model_dst); %}; - -void register_on_request_update_callback(SV* callback) - %code%{ Slic3r::GUI::g_on_request_update_callback.register_callback(callback); %}; - -void deregister_on_request_update_callback() - %code%{ Slic3r::GUI::g_on_request_update_callback.deregister_callback(); %}; - -void create_double_slider(SV *ui_parent, SV *ui_sizer, SV *ui_canvas) - %code%{ Slic3r::GUI::create_double_slider( (wxWindow*)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"), - (wxBoxSizer*)wxPli_sv_2_object(aTHX_ ui_sizer, "Wx::BoxSizer"), - (wxGLCanvas*)wxPli_sv_2_object(aTHX_ ui_canvas, "Wx::GLCanvas")); %}; - -void update_double_slider(bool force_sliders_full_range) - %code%{ Slic3r::GUI::update_double_slider(force_sliders_full_range); %}; - -void reset_double_slider() - %code%{ Slic3r::GUI::reset_double_slider(); %}; - -void enable_action_buttons(bool enable) - %code%{ Slic3r::GUI::enable_action_buttons(enable); %}; - -void save_window_size(SV *window, std::string name) - %code%{ Slic3r::GUI::save_window_size((wxTopLevelWindow*)wxPli_sv_2_object(aTHX_ window, "Wx::TopLevelWindow"), name); %}; - -void restore_window_size(SV *window, std::string name) - %code%{ Slic3r::GUI::restore_window_size((wxTopLevelWindow*)wxPli_sv_2_object(aTHX_ window, "Wx::TopLevelWindow"), name); %}; diff --git a/xs/xsp/GUI_3DScene.xsp b/xs/xsp/GUI_3DScene.xsp deleted file mode 100644 index dc252d8bd..000000000 --- a/xs/xsp/GUI_3DScene.xsp +++ /dev/null @@ -1,839 +0,0 @@ -%module{Slic3r::XS}; - -#include -#include "slic3r/GUI/GLShader.hpp" -#include "slic3r/GUI/3DScene.hpp" - -%name{Slic3r::GUI::_3DScene::GLShader} class GLShader { - GLShader(); - ~GLShader(); - - bool load_from_text(const char *fragment_shader, const char *vertex_shader); - bool load_from_file(const char *fragment_shader, const char *vertex_shader); - void release(); - - int get_attrib_location(const char *name) const; - int get_uniform_location(const char *name) const; - - bool set_uniform(const char *name, float value) const; - - void enable() const; - void disable() const; - - int shader_program_id() const - %code%{ RETVAL = THIS->shader_program_id; %}; - - std::string last_error() const - %code%{ RETVAL = THIS->last_error; %}; -}; - -%name{Slic3r::GUI::_3DScene::GLVolume} class GLVolume { - GLVolume(); - ~GLVolume(); - - std::vector color() - %code%{ RETVAL.reserve(4); RETVAL.push_back(THIS->color[0]); RETVAL.push_back(THIS->color[1]); RETVAL.push_back(THIS->color[2]); RETVAL.push_back(THIS->color[3]); %}; - - int select_group_id() - %code%{ RETVAL = THIS->select_group_id; %}; - int drag_group_id() - %code%{ RETVAL = THIS->drag_group_id; %}; - int selected() - %code%{ RETVAL = THIS->selected; %}; - void set_selected(int i) - %code%{ THIS->selected = i; %}; - int hover() - %code%{ RETVAL = THIS->hover; %}; - void set_hover(int i) - %code%{ THIS->hover = i; %}; - int zoom_to_volumes() - %code%{ RETVAL = THIS->zoom_to_volumes; %}; - - void set_layer_height_texture_data(unsigned int texture_id, unsigned int shader_id, PrintObject* print_object, float z_cursor_relative, float edit_band_width); - void reset_layer_height_texture_data(); - - int object_idx() const; - int volume_idx() const; - int instance_idx() const; - Clone origin() const - %code%{ RETVAL = THIS->get_offset(); %}; - void translate(double x, double y, double z) - %code%{ THIS->set_offset(THIS->get_offset() + Vec3d(x, y, z)); %}; - Clone bounding_box() const - %code%{ RETVAL = THIS->bounding_box; %}; - - bool empty() const; - bool indexed() const; - - void render() const; - - bool has_layer_height_texture(); - int layer_height_texture_width(); - int layer_height_texture_height(); - int layer_height_texture_cells(); - void* layer_height_texture_data_ptr_level0(); - void* layer_height_texture_data_ptr_level1(); - double layer_height_texture_z_to_row_id() const; - void generate_layer_height_texture(PrintObject *print_object, bool force); -}; - - -%name{Slic3r::GUI::_3DScene::GLVolume::Collection} class GLVolumeCollection { - GLVolumeCollection(); - ~GLVolumeCollection(); - - std::vector load_object(ModelObject *object, int obj_idx, std::vector instance_idxs, std::string color_by, std::string select_by, std::string drag_by, bool use_VBOs); - - int load_wipe_tower_preview(int obj_idx, float pos_x, float pos_y, float width, float depth, float height, float rotation_angle, bool use_VBOs, bool size_unknown, float brim_width); - - void erase() - %code{% THIS->clear(); %}; - - int count() - %code{% RETVAL = THIS->volumes.size(); %}; - - void set_range(double low, double high); - - void render_VBOs() const; - void render_legacy() const; - void finalize_geometry(bool use_VBOs); - void release_geometry(); - - void set_print_box(float min_x, float min_y, float min_z, float max_x, float max_y, float max_z); - - void reset_outside_state(); - void update_colors_by_extruder(DynamicPrintConfig* config); - - bool move_volume_up(int idx) - %code%{ - if (idx > 0 && idx < int(THIS->volumes.size())) { - std::swap(THIS->volumes[idx-1], THIS->volumes[idx]); - std::swap(THIS->volumes[idx-1]->composite_id, THIS->volumes[idx]->composite_id); - std::swap(THIS->volumes[idx-1]->select_group_id, THIS->volumes[idx]->select_group_id); - std::swap(THIS->volumes[idx-1]->drag_group_id, THIS->volumes[idx]->drag_group_id); - RETVAL = true; - } else - RETVAL = false; - %}; - bool move_volume_down(int idx) - %code%{ - if (idx >= 0 && idx + 1 < int(THIS->volumes.size())) { - std::swap(THIS->volumes[idx+1], THIS->volumes[idx]); - std::swap(THIS->volumes[idx+1]->composite_id, THIS->volumes[idx]->composite_id); - std::swap(THIS->volumes[idx+1]->select_group_id, THIS->volumes[idx]->select_group_id); - std::swap(THIS->volumes[idx+1]->drag_group_id, THIS->volumes[idx]->drag_group_id); - RETVAL = true; - } else - RETVAL = false; - %}; - -%{ - -SV* -GLVolumeCollection::arrayref() - CODE: - AV* av = newAV(); - av_fill(av, THIS->volumes.size()-1); - int i = 0; - for (GLVolume *v : THIS->volumes) { - av_store(av, i++, perl_to_SV_ref(*v)); - } - RETVAL = newRV_noinc((SV*)av); - OUTPUT: - RETVAL - -%} -}; - -%package{Slic3r::GUI::_3DScene}; -%{ - -std::string -get_gl_info(format_as_html, extensions) - bool format_as_html; - bool extensions; - CODE: - RETVAL = _3DScene::get_gl_info(format_as_html, extensions); - OUTPUT: - RETVAL - -bool -use_VBOs() - CODE: - RETVAL = _3DScene::use_VBOs(); - OUTPUT: - RETVAL - -bool -add_canvas(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::add_canvas((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -bool -remove_canvas(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::remove_canvas((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -void -remove_all_canvases() - CODE: - _3DScene::remove_all_canvases(); - -void -set_as_dirty(canvas) - SV *canvas; - CODE: - _3DScene::set_as_dirty((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -unsigned int -get_volumes_count(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::get_volumes_count((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -void -reset_volumes(canvas) - SV *canvas; - CODE: - _3DScene::reset_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -void -deselect_volumes(canvas) - SV *canvas; - CODE: - _3DScene::deselect_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -void -select_volume(canvas, id) - SV *canvas; - unsigned int id; - CODE: - _3DScene::select_volume((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), id); - -void -update_volumes_selection(canvas, selections) - SV *canvas; - std::vector selections; - CODE: - _3DScene::update_volumes_selection((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), selections); - -int -check_volumes_outside_state(canvas, config) - SV *canvas; - DynamicPrintConfig *config; - CODE: - RETVAL = _3DScene::check_volumes_outside_state((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), config); - OUTPUT: - RETVAL - -bool -move_volume_up(canvas, id) - SV *canvas; - unsigned int id; - CODE: - RETVAL = _3DScene::move_volume_up((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), id); - OUTPUT: - RETVAL - -bool -move_volume_down(canvas, id) - SV *canvas; - unsigned int id; - CODE: - RETVAL = _3DScene::move_volume_down((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), id); - OUTPUT: - RETVAL - -void -set_objects_selections(canvas, selections) - SV *canvas; - std::vector selections; - CODE: - _3DScene::set_objects_selections((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), selections); - -void -set_config(canvas, config) - SV *canvas; - DynamicPrintConfig *config; - CODE: - _3DScene::set_config((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), config); - -void -set_print(canvas, print) - SV *canvas; - Print *print; - CODE: - _3DScene::set_print((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), print); - -void -set_model(canvas, model) - SV *canvas; - Model *model; - CODE: - _3DScene::set_model((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), model); - -void -set_bed_shape(canvas, shape) - SV *canvas; - Pointfs shape; - CODE: - _3DScene::set_bed_shape((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), shape); - -void -set_auto_bed_shape(canvas) - SV *canvas; - CODE: - _3DScene::set_auto_bed_shape((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -Clone -get_volumes_bounding_box(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::get_volumes_bounding_box((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -void -set_axes_length(canvas, length) - SV *canvas; - float length; - CODE: - _3DScene::set_axes_length((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), length); - -void -set_cutting_plane(canvas, z, polygons) - SV *canvas; - float z; - ExPolygons polygons; - CODE: - _3DScene::set_cutting_plane((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), z, polygons); - -void -set_color_by(canvas, value) - SV *canvas; - std::string value; - CODE: - _3DScene::set_color_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), value); - -void -set_select_by(canvas, value) - SV *canvas; - std::string value; - CODE: - _3DScene::set_select_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), value); - -void -set_drag_by(canvas, value) - SV *canvas; - std::string value; - CODE: - _3DScene::set_drag_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), value); - -std::string -get_select_by(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::get_select_by((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -bool -is_layers_editing_enabled(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::is_layers_editing_enabled((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -bool -is_layers_editing_allowed(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::is_layers_editing_allowed((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -bool -is_shader_enabled(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::is_shader_enabled((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -bool -is_reload_delayed(canvas) - SV *canvas; - CODE: - RETVAL = _3DScene::is_reload_delayed((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - OUTPUT: - RETVAL - -void -enable_layers_editing(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_layers_editing((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_warning_texture(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_warning_texture((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_legend_texture(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_legend_texture((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_picking(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_picking((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_moving(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_moving((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_gizmos(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_gizmos((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_shader(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_shader((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_toolbar(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_toolbar((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_force_zoom_to_bed(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_force_zoom_to_bed((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -enable_dynamic_background(canvas, enable) - SV *canvas; - bool enable; - CODE: - _3DScene::enable_dynamic_background((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable); - -void -allow_multisample(canvas, allow) - SV *canvas; - bool allow; - CODE: - _3DScene::allow_multisample((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), allow); - -void -enable_toolbar_item(canvas, item, enable) - SV *canvas; - std::string item; - bool enable; - CODE: - _3DScene::enable_toolbar_item((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), item, enable); - -bool -is_toolbar_item_pressed(canvas, item) - SV *canvas; - std::string item; - CODE: - RETVAL = _3DScene::is_toolbar_item_pressed((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), item); - OUTPUT: - RETVAL - -void -zoom_to_bed(canvas) - SV *canvas; - CODE: - _3DScene::zoom_to_bed((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -void -zoom_to_volumes(canvas) - SV *canvas; - CODE: - _3DScene::zoom_to_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -void -select_view(canvas, direction) - SV *canvas; - std::string direction; - CODE: - _3DScene::select_view((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), direction); - -void -set_viewport_from_scene(canvas, other) - SV *canvas; - SV *other; - CODE: - _3DScene::set_viewport_from_scene((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (wxGLCanvas*)wxPli_sv_2_object(aTHX_ other, "Wx::GLCanvas")); - -void -update_volumes_colors_by_extruder(canvas) - SV *canvas; - CODE: - _3DScene::update_volumes_colors_by_extruder((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -void -update_gizmos_data(canvas) - SV *canvas; - CODE: - _3DScene::update_gizmos_data((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -void -render(canvas) - SV *canvas; - CODE: - _3DScene::render((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas")); - -std::vector -get_current_print_zs(canvas, active_only) - SV *canvas; - bool active_only; - CODE: - RETVAL = _3DScene::get_current_print_zs((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), active_only); - OUTPUT: - RETVAL - -void -set_toolpaths_range(canvas, low, high) - SV *canvas; - double low; - double high; - CODE: - _3DScene::set_toolpaths_range((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), low, high); - -void -register_on_viewport_changed_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_viewport_changed_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_double_click_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_double_click_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_right_click_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_right_click_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_select_object_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_select_object_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_model_update_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_model_update_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_remove_object_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_remove_object_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_arrange_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_arrange_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_rotate_object_left_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_rotate_object_left_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_rotate_object_right_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_rotate_object_right_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_scale_object_uniformly_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_scale_object_uniformly_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_increase_objects_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_increase_objects_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_decrease_objects_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_decrease_objects_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_instance_moved_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_instance_moved_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_wipe_tower_moved_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_wipe_tower_moved_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_enable_action_buttons_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_enable_action_buttons_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_gizmo_scale_uniformly_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_gizmo_scale_uniformly_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_gizmo_scale_3D_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_gizmo_scale_3D_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_gizmo_rotate_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_gizmo_rotate_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_gizmo_rotate_3D_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_gizmo_rotate_3D_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_gizmo_flatten_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_gizmo_flatten_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_gizmo_flatten_3D_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_gizmo_flatten_3D_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_update_geometry_info_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_update_geometry_info_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_on_update_geometry_3D_info_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_on_update_geometry_3D_info_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_add_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_add_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_delete_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_delete_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_deleteall_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_deleteall_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_arrange_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_arrange_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_more_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_more_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_fewer_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_fewer_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_split_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_split_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_cut_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_cut_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_settings_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_settings_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_layersediting_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_layersediting_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -register_action_selectbyparts_callback(canvas, callback) - SV *canvas; - SV *callback; - CODE: - _3DScene::register_action_selectbyparts_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback); - -void -reset_legend_texture() - CODE: - _3DScene::reset_legend_texture(); - -std::vector -load_model_object(canvas, model_object, obj_idx, instance_idxs) - SV *canvas; - ModelObject *model_object; - int obj_idx; - std::vector instance_idxs; - CODE: - RETVAL = _3DScene::load_object((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), model_object, obj_idx, instance_idxs); - OUTPUT: - RETVAL - -int -get_first_volume_id(canvas, obj_idx) - SV *canvas; - int obj_idx; - CODE: - RETVAL = _3DScene::get_first_volume_id((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), obj_idx); - OUTPUT: - RETVAL - -int -get_in_object_volume_id(canvas, scene_vol_idx) - SV *canvas; - int scene_vol_idx; - CODE: - RETVAL = _3DScene::get_in_object_volume_id((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), scene_vol_idx); - OUTPUT: - RETVAL - -std::vector -load_model(canvas, model, obj_idx) - SV *canvas; - Model *model; - int obj_idx; - CODE: - RETVAL = _3DScene::load_object((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), model, obj_idx); - OUTPUT: - RETVAL - -void -reload_scene(canvas, force) - SV *canvas; - bool force; - CODE: - _3DScene::reload_scene((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), force); - -void -load_gcode_preview(canvas, preview_data, str_tool_colors) - SV *canvas; - GCodePreviewData *preview_data; - std::vector str_tool_colors; - CODE: - _3DScene::load_gcode_preview((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), preview_data, str_tool_colors); - -void -load_preview(canvas, str_tool_colors) - SV *canvas; - std::vector str_tool_colors; - CODE: - _3DScene::load_preview((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), str_tool_colors); - -%} diff --git a/xs/xsp/GUI_AppConfig.xsp b/xs/xsp/GUI_AppConfig.xsp deleted file mode 100644 index 08a88883d..000000000 --- a/xs/xsp/GUI_AppConfig.xsp +++ /dev/null @@ -1,46 +0,0 @@ - -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/AppConfig.hpp" -%} - -%name{Slic3r::GUI::AppConfig} class AppConfig { - AppConfig(); - ~AppConfig(); - - void reset(); - void set_defaults(); - - void load() - %code%{ - try { - THIS->load(); - } catch (std::exception& e) { - croak("Loading an application config file failed:\n%s\n", e.what()); - } - %}; - void save() - %code%{ - try { - THIS->save(); - } catch (std::exception& e) { - croak("Saving an application config file failed:\n%s\n", e.what()); - } - %}; - bool exists(); - bool dirty(); - - std::string get(char *name); - void set(char *name, char *value); - bool has(char *section); - - std::string get_last_dir(); - void update_config_dir(char *dir); - void update_skein_dir(char *dir); - std::string get_last_output_dir(const char *alt = ""); - void update_last_output_dir(char *dir); - - void reset_selections(); -}; diff --git a/xs/xsp/GUI_BackgroundSlicingProcess.xsp b/xs/xsp/GUI_BackgroundSlicingProcess.xsp deleted file mode 100644 index 8452b8c31..000000000 --- a/xs/xsp/GUI_BackgroundSlicingProcess.xsp +++ /dev/null @@ -1,25 +0,0 @@ - -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/BackgroundSlicingProcess.hpp" -%} - -%name{Slic3r::GUI::BackgroundSlicingProcess} class BackgroundSlicingProcess { - BackgroundSlicingProcess(); - ~BackgroundSlicingProcess(); - - void set_print(Print *print); - void set_gcode_preview_data(GCodePreviewData *gpd); - void set_sliced_event(int event_id); - void set_finished_event(int event_id); - - void set_output_path(const char *path); - bool start(); - bool stop(); - bool apply_config(DynamicPrintConfig *config) - %code%{ RETVAL = THIS->apply_config(*config); %}; - - bool running(); -}; diff --git a/xs/xsp/GUI_Preset.xsp b/xs/xsp/GUI_Preset.xsp deleted file mode 100644 index 99d23a142..000000000 --- a/xs/xsp/GUI_Preset.xsp +++ /dev/null @@ -1,149 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/Preset.hpp" -#include "slic3r/GUI/PresetBundle.hpp" -#include "slic3r/GUI/PresetHints.hpp" -%} - -%name{Slic3r::GUI::Preset} class Preset { - // owned by PresetCollection, no constructor/destructor - - bool default() %code%{ RETVAL = THIS->is_default; %}; - bool external() %code%{ RETVAL = THIS->is_external; %}; - bool system() %code%{ RETVAL = THIS->is_system; %}; - bool visible() %code%{ RETVAL = THIS->is_visible; %}; - bool dirty() %code%{ RETVAL = THIS->is_dirty; %}; - bool compatible() %code%{ RETVAL = THIS->is_compatible; %}; - bool is_compatible_with_printer(Preset *active_printer) - %code%{ RETVAL = THIS->is_compatible_with_printer(*active_printer); %}; - - std::string name() %code%{ RETVAL = THIS->name; %}; - std::string file() %code%{ RETVAL = THIS->file; %}; - - bool loaded() %code%{ RETVAL = THIS->loaded; %}; - - Ref config() %code%{ RETVAL = &THIS->config; %}; - - void set_num_extruders(int num_extruders); -}; - -%name{Slic3r::GUI::PresetCollection} class PresetCollection { - - Ref preset(size_t idx) %code%{ RETVAL = &THIS->preset(idx); %}; - size_t size() const; - size_t num_visible() const; - std::string name() const; - - Ref get_selected_preset() %code%{ RETVAL = &THIS->get_selected_preset(); %}; - Ref get_current_preset() %code%{ RETVAL = &THIS->get_edited_preset(); %}; - std::string get_current_preset_name() %code%{ RETVAL = THIS->get_selected_preset().name; %}; - Ref get_edited_preset() %code%{ RETVAL = &THIS->get_edited_preset(); %}; - - Ref find_preset(char *name, bool first_visible_if_not_found = false) %code%{ RETVAL = THIS->find_preset(name, first_visible_if_not_found); %}; - - void update_tab_ui(SV *ui, bool show_incompatible) - %code%{ auto cb = (wxBitmapComboBox*)wxPli_sv_2_object( aTHX_ ui, "Wx::BitmapComboBox" ); - THIS->update_tab_ui(cb, show_incompatible); %}; - - void update_platter_ui(SV *ui) - %code%{ auto cb = (wxBitmapComboBox*)wxPli_sv_2_object( aTHX_ ui, "Wx::BitmapComboBox" ); - THIS->update_platter_ui(cb); %}; - -%{ - -SV* -PresetCollection::arrayref() - CODE: - AV* av = newAV(); - av_fill(av, THIS->size()-1); - for (int i = 0; i < int(THIS->size()); ++ i) { - Preset &preset = THIS->preset(i); - av_store(av, i, perl_to_SV_ref(preset)); - } - RETVAL = newRV_noinc((SV*)av); - OUTPUT: - RETVAL - -%} -}; - -%name{Slic3r::GUI::PresetBundle} class PresetBundle { - PresetBundle(); - ~PresetBundle(); - - void reset(bool delete_files); - - void setup_directories() - %code%{ - try { - THIS->setup_directories(); - } catch (std::exception& e) { - croak("Cannot create configuration directories:\n%s\n", e.what()); - } - %}; - void load_presets(AppConfig *config) - %code%{ - try { - THIS->load_presets(*config); - } catch (std::exception& e) { - croak("Loading of Slic3r presets from %s failed.\n\n%s\n", - Slic3r::data_dir().c_str(), e.what()); - } - %}; - void load_config(const char *name, DynamicPrintConfig *config) - %code%{ - try { - THIS->load_config(name, *config); - } catch (std::exception& e) { - croak("Loading a configuration %s failed:\n%s\n", name, e.what()); - } - %}; - void load_config_file(const char *path) - %code%{ - try { - THIS->load_config_file(path); - } catch (std::exception& e) { - croak("Loading a configuration file %s failed:\n%s\n", path, e.what()); - } - %}; - size_t load_configbundle(const char *path) - %code%{ - try { - RETVAL = THIS->load_configbundle(path, PresetBundle::LOAD_CFGBNDLE_SAVE); - } catch (std::exception& e) { - croak("Loading of a config bundle %s failed:\n%s\n", path, e.what()); - } - %}; - void export_configbundle(char *path) - %code%{ - try { - THIS->export_configbundle(path); - } catch (std::exception& e) { - croak("Export of a config bundle %s failed:\n%s\n", path, e.what()); - } - %}; - - void set_default_suppressed(bool default_suppressed); - - void export_selections(AppConfig *config) %code%{ THIS->export_selections(*config); %}; - void export_selections_pp(PlaceholderParser *pp) %code%{ THIS->export_selections(*pp); %}; - - Ref print() %code%{ RETVAL = &THIS->prints; %}; - Ref filament() %code%{ RETVAL = &THIS->filaments; %}; - Ref sla_material() %code%{ RETVAL = &THIS->sla_materials; %}; - Ref printer() %code%{ RETVAL = &THIS->printers; %}; - Ref project_config() %code%{ RETVAL = &THIS->project_config; %}; - - bool has_defauls_only(); - - std::vector filament_presets() %code%{ RETVAL = THIS->filament_presets; %}; - void set_filament_preset(int idx, const char *name); - - Clone full_config() %code%{ RETVAL = THIS->full_config(); %}; - - void update_platter_filament_ui(int extruder_idx, SV *ui) - %code%{ auto cb = (wxBitmapComboBox*)wxPli_sv_2_object(aTHX_ ui, "Wx::BitmapComboBox"); - THIS->update_platter_filament_ui(extruder_idx, cb); %}; -}; diff --git a/xs/xsp/GUI_Preview.xsp b/xs/xsp/GUI_Preview.xsp deleted file mode 100644 index da50c0d21..000000000 --- a/xs/xsp/GUI_Preview.xsp +++ /dev/null @@ -1,28 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/GUI_PreviewIface.hpp" -%} - -%name{Slic3r::GUI::Preview} class PreviewIface { - - void register_on_viewport_changed_callback(SV* callback) - %code%{ THIS->register_on_viewport_changed_callback((void*)callback); %}; - - void set_number_extruders(unsigned int number_extruders); - void reset_gcode_preview_data(); - void reload_print(bool force = false); - void set_canvas_as_dirty(); - void set_enabled(bool enabled); - void set_bed_shape(Pointfs shape); - void select_view(std::string direction); - void set_viewport_from_scene(SV *ui) - %code%{ THIS->set_viewport_from_scene((wxGLCanvas*)wxPli_sv_2_object(aTHX_ ui, "Wx::GLCanvas")); %}; - - void set_viewport_into_scene(SV *ui) - %code%{ THIS->set_viewport_into_scene((wxGLCanvas*)wxPli_sv_2_object(aTHX_ ui, "Wx::GLCanvas")); %}; - - void SetDropTarget(SV *ui) - %code%{ THIS->set_drop_target((wxDropTarget*)wxPli_sv_2_object(aTHX_ ui, "Wx::DropTarget")); %}; -}; \ No newline at end of file diff --git a/xs/xsp/GUI_Tab.xsp b/xs/xsp/GUI_Tab.xsp deleted file mode 100644 index bcbdc0d9f..000000000 --- a/xs/xsp/GUI_Tab.xsp +++ /dev/null @@ -1,24 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/TabIface.hpp" -%} - -%name{Slic3r::GUI::Tab} class TabIface { - TabIface(); - ~TabIface(); - void load_current_preset(); - void update_tab_ui(); - void update_ui_from_settings(); - void select_preset(char* name); - void load_config(DynamicPrintConfig* config); - bool current_preset_is_dirty(); - void load_key_value(char* opt_key, char* value); - void OnActivate(); - size_t get_selected_preset_item(); - std::string title(); - Ref get_config(); - Ref get_presets(); - std::vector get_dependent_tabs(); -}; diff --git a/xs/xsp/ProgressStatusBar.xsp b/xs/xsp/ProgressStatusBar.xsp deleted file mode 100644 index 703a53b67..000000000 --- a/xs/xsp/ProgressStatusBar.xsp +++ /dev/null @@ -1,48 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/GUI/ProgressStatusBar.hpp" -#include "slic3r/GUI/GUI.hpp" -%} - -%name{Slic3r::GUI::ProgressStatusBar} class ProgressStatusBar { - ProgressStatusBar(); - ~ProgressStatusBar(); - - int GetProgress() const - %code%{ RETVAL=THIS->get_progress(); %}; - - void SetProgress(int val) - %code%{ THIS->set_progress(val); %}; - - void SetRange(int val = 100) - %code%{ THIS->set_range(val); %}; - - void ShowProgress(bool show) - %code%{ THIS->show_progress(show); %}; - - void StartBusy(int val = 100) - %code%{ THIS->start_busy(val); %}; - - void StopBusy() - %code%{ THIS->stop_busy(); %}; - - bool IsBusy() const - %code%{ RETVAL=THIS->is_busy(); %}; - - void Run(int rate) - %code%{ THIS->run(rate); %}; - - void Embed() - %code%{ THIS->embed(); %}; - - void SetStatusText(const char *txt) - %code%{ THIS->set_status_text(_(txt)); %}; - - void SetCancelCallback(SV* callback) - %code%{ THIS->m_perl_cancel_callback.register_callback(callback); THIS->show_cancel_button();%}; - void ResetCancelCallback() - %code%{ THIS->m_perl_cancel_callback.deregister_callback(); THIS->hide_cancel_button(); %}; - -}; \ No newline at end of file diff --git a/xs/xsp/Utils_PresetUpdater.xsp b/xs/xsp/Utils_PresetUpdater.xsp deleted file mode 100644 index dc874acab..000000000 --- a/xs/xsp/Utils_PresetUpdater.xsp +++ /dev/null @@ -1,13 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/Utils/PresetUpdater.hpp" -%} - -%name{Slic3r::PresetUpdater} class PresetUpdater { - PresetUpdater(int version_online_event); - void sync(PresetBundle* preset_bundle); - void slic3r_update_notify(); - bool config_update(); -}; diff --git a/xs/xsp/Utils_PrintHost.xsp b/xs/xsp/Utils_PrintHost.xsp deleted file mode 100644 index 59c09c431..000000000 --- a/xs/xsp/Utils_PrintHost.xsp +++ /dev/null @@ -1,12 +0,0 @@ -%module{Slic3r::XS}; - -%{ -#include -#include "slic3r/Utils/PrintHost.hpp" -%} - -%name{Slic3r::PrintHost} class PrintHost { - bool send_gcode(std::string filename) const; - - static PrintHost* get_print_host(DynamicPrintConfig *config); -}; diff --git a/xs/xsp/my.map b/xs/xsp/my.map index 90a5feaf7..07e4a3799 100644 --- a/xs/xsp/my.map +++ b/xs/xsp/my.map @@ -215,36 +215,6 @@ PrintObjectSupportMaterial* O_OBJECT_SLIC3R Ref O_OBJECT_SLIC3R_T Clone O_OBJECT_SLIC3R_T -AppConfig* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -BackgroundSlicingProcess* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T - -GLShader* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -GLVolume* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -GLVolumeCollection* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T - -Preset* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -PresetCollection* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -PresetBundle* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -TabIface* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -PreviewIface* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T -ProgressStatusBar* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T - -PresetUpdater* O_OBJECT_SLIC3R -Ref O_OBJECT_SLIC3R_T - -PrintHost* O_OBJECT_SLIC3R - Axis T_UV ExtrusionLoopRole T_UV ExtrusionRole T_UV diff --git a/xs/xsp/typemap.xspt b/xs/xsp/typemap.xspt index 0209ce92d..121033db4 100644 --- a/xs/xsp/typemap.xspt +++ b/xs/xsp/typemap.xspt @@ -194,36 +194,14 @@ %typemap{ModelInstancePtrs*}; %typemap{Ref}{simple}; %typemap{Clone}{simple}; -%typemap{AppConfig*}; -%typemap{Ref}{simple}; -%typemap{BackgroundSlicingProcess*}; -%typemap{Ref}{simple}; -%typemap{GLShader*}; -%typemap{Ref}{simple}; -%typemap{GLVolume*}; -%typemap{Ref}{simple}; -%typemap{GLVolumeCollection*}; -%typemap{Ref}{simple}; -%typemap{Preset*}; -%typemap{Ref}{simple}; -%typemap{PresetCollection*}; -%typemap{Ref}{simple}; -%typemap{PresetBundle*}; -%typemap{Ref}{simple}; -%typemap{PresetUpdater*}; -%typemap{Ref}{simple}; %typemap{PresetHints*}; %typemap{Ref}{simple}; -%typemap{TabIface*}; -%typemap{PreviewIface*}; -%typemap{ProgressStatusBar*}; %typemap{PrintRegionPtrs*}; %typemap{PrintObjectPtrs*}; %typemap{LayerPtrs*}; %typemap{SupportLayerPtrs*}; - %typemap{Axis}{parsed}{ %cpp_type{Axis}; %precall_code{% @@ -272,6 +250,3 @@ $CVar = (PrintObjectStep)SvUV($PerlVar); %}; }; -%typemap{AppController*}; -%typemap{PrintController*}; -%typemap{PrintHost*};