Removed legacy GUI Perl bindings,

replaced Print & SLAPrint pointers with BackgroundProcessing pointer
at the GLCanvas3D level, so that the Print & SLAPrint access will be
synchronized with the current printer technology.
This commit is contained in:
bubnikv 2018-11-22 15:29:59 +01:00
parent 86c11df554
commit bde4153d44
29 changed files with 121 additions and 1679 deletions

View File

@ -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

View File

@ -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<size_t, size_t>(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)

View File

@ -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);

View File

@ -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()

View File

@ -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.

View File

@ -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 <instance_idx, print_instance_idx>
std::vector<std::pair<size_t, size_t>> instances[std::tuple_size<SLASteps>::value];
@ -4092,11 +4089,12 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
float w = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_width"))->value;
float a = dynamic_cast<const ConfigOptionFloat*>(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<std::string>& 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<std::string>& 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<PrintObject*>(m_print->get_object(layer_editing_object_idx))->reset_layer_height_profile();
const_cast<PrintObject*>(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<size_t>(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<size_t>(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<float> 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<std::string>& 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<float> tool_colors = _parse_colors(str_tool_colors);
@ -6202,12 +6207,12 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector<std::string>& str_
std::vector<WipeTower::ToolChangeResult> 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<std::string>& 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

View File

@ -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<float> _parse_colors(const std::vector<std::string>& colors);
const Print* fff_print() const;
const SLAPrint* sla_print() const;
};
} // namespace GUI

View File

@ -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)

View File

@ -12,9 +12,8 @@ class wxGLContext;
namespace Slic3r {
class BackgroundSlicingProcess;
class DynamicPrintConfig;
class Print;
class SLAPrint;
class Model;
class ExPolygon;
typedef std::vector<ExPolygon> 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);

View File

@ -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*/)
{

View File

@ -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);

View File

@ -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<void()> schedule_background_process_func)
Preview::Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> 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<float> 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);

View File

@ -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<void()> schedule_background_process = [](){});
Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> 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();

View File

@ -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

View File

@ -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_

View File

@ -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);

View File

@ -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)
{

View File

@ -1,211 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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<std::string> 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); %};

View File

@ -1,839 +0,0 @@
%module{Slic3r::XS};
#include <xsinit.h>
#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<double> 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<Vec3d> 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<BoundingBoxf3> 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<int> load_object(ModelObject *object, int obj_idx, std::vector<int> 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<int> 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<int> 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<BoundingBoxf3>
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<double>
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<int>
load_model_object(canvas, model_object, obj_idx, instance_idxs)
SV *canvas;
ModelObject *model_object;
int obj_idx;
std::vector<int> 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<int>
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<std::string> 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<std::string> str_tool_colors;
CODE:
_3DScene::load_preview((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), str_tool_colors);
%}

View File

@ -1,46 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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();
};

View File

@ -1,25 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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();
};

View File

@ -1,149 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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<DynamicPrintConfig> config() %code%{ RETVAL = &THIS->config; %};
void set_num_extruders(int num_extruders);
};
%name{Slic3r::GUI::PresetCollection} class PresetCollection {
Ref<Preset> preset(size_t idx) %code%{ RETVAL = &THIS->preset(idx); %};
size_t size() const;
size_t num_visible() const;
std::string name() const;
Ref<Preset> get_selected_preset() %code%{ RETVAL = &THIS->get_selected_preset(); %};
Ref<Preset> get_current_preset() %code%{ RETVAL = &THIS->get_edited_preset(); %};
std::string get_current_preset_name() %code%{ RETVAL = THIS->get_selected_preset().name; %};
Ref<Preset> get_edited_preset() %code%{ RETVAL = &THIS->get_edited_preset(); %};
Ref<Preset> 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<PresetCollection> print() %code%{ RETVAL = &THIS->prints; %};
Ref<PresetCollection> filament() %code%{ RETVAL = &THIS->filaments; %};
Ref<PresetCollection> sla_material() %code%{ RETVAL = &THIS->sla_materials; %};
Ref<PresetCollection> printer() %code%{ RETVAL = &THIS->printers; %};
Ref<DynamicPrintConfig> project_config() %code%{ RETVAL = &THIS->project_config; %};
bool has_defauls_only();
std::vector<std::string> filament_presets() %code%{ RETVAL = THIS->filament_presets; %};
void set_filament_preset(int idx, const char *name);
Clone<DynamicPrintConfig> 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); %};
};

View File

@ -1,28 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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")); %};
};

View File

@ -1,24 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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<DynamicPrintConfig> get_config();
Ref<PresetCollection> get_presets();
std::vector<std::string> get_dependent_tabs();
};

View File

@ -1,48 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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(); %};
};

View File

@ -1,13 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#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();
};

View File

@ -1,12 +0,0 @@
%module{Slic3r::XS};
%{
#include <xsinit.h>
#include "slic3r/Utils/PrintHost.hpp"
%}
%name{Slic3r::PrintHost} class PrintHost {
bool send_gcode(std::string filename) const;
static PrintHost* get_print_host(DynamicPrintConfig *config);
};

View File

@ -215,36 +215,6 @@ PrintObjectSupportMaterial* O_OBJECT_SLIC3R
Ref<PrintObjectSupportMaterial> O_OBJECT_SLIC3R_T
Clone<PrintObjectSupportMaterial> O_OBJECT_SLIC3R_T
AppConfig* O_OBJECT_SLIC3R
Ref<AppConfig> O_OBJECT_SLIC3R_T
BackgroundSlicingProcess* O_OBJECT_SLIC3R
Ref<BackgroundSlicingProcess> O_OBJECT_SLIC3R_T
GLShader* O_OBJECT_SLIC3R
Ref<GLShader> O_OBJECT_SLIC3R_T
GLVolume* O_OBJECT_SLIC3R
Ref<GLVolume> O_OBJECT_SLIC3R_T
GLVolumeCollection* O_OBJECT_SLIC3R
Ref<GLVolumeCollection> O_OBJECT_SLIC3R_T
Preset* O_OBJECT_SLIC3R
Ref<Preset> O_OBJECT_SLIC3R_T
PresetCollection* O_OBJECT_SLIC3R
Ref<PresetCollection> O_OBJECT_SLIC3R_T
PresetBundle* O_OBJECT_SLIC3R
Ref<PresetBundle> O_OBJECT_SLIC3R_T
TabIface* O_OBJECT_SLIC3R
Ref<TabIface> O_OBJECT_SLIC3R_T
PreviewIface* O_OBJECT_SLIC3R
Ref<PreviewIface> O_OBJECT_SLIC3R_T
ProgressStatusBar* O_OBJECT_SLIC3R
Ref<ProgressStatusBar> O_OBJECT_SLIC3R_T
PresetUpdater* O_OBJECT_SLIC3R
Ref<PresetUpdater> O_OBJECT_SLIC3R_T
PrintHost* O_OBJECT_SLIC3R
Axis T_UV
ExtrusionLoopRole T_UV
ExtrusionRole T_UV

View File

@ -194,36 +194,14 @@
%typemap{ModelInstancePtrs*};
%typemap{Ref<ModelInstancePtrs>}{simple};
%typemap{Clone<ModelInstancePtrs>}{simple};
%typemap{AppConfig*};
%typemap{Ref<AppConfig>}{simple};
%typemap{BackgroundSlicingProcess*};
%typemap{Ref<BackgroundSlicingProcess>}{simple};
%typemap{GLShader*};
%typemap{Ref<GLShader>}{simple};
%typemap{GLVolume*};
%typemap{Ref<GLVolume>}{simple};
%typemap{GLVolumeCollection*};
%typemap{Ref<GLVolumeCollection>}{simple};
%typemap{Preset*};
%typemap{Ref<Preset>}{simple};
%typemap{PresetCollection*};
%typemap{Ref<PresetCollection>}{simple};
%typemap{PresetBundle*};
%typemap{Ref<PresetBundle>}{simple};
%typemap{PresetUpdater*};
%typemap{Ref<PresetUpdater>}{simple};
%typemap{PresetHints*};
%typemap{Ref<PresetHints>}{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*};