Merge with master

This commit is contained in:
Lukas Matena 2018-02-21 13:22:51 +01:00
commit de92f45eaf
125 changed files with 38665 additions and 4069 deletions

View file

@ -25,10 +25,10 @@
double radius();
Clone<Point> min_point() %code{% RETVAL = THIS->min; %};
Clone<Point> max_point() %code{% RETVAL = THIS->max; %};
long x_min() %code{% RETVAL = THIS->min.x; %};
long x_max() %code{% RETVAL = THIS->max.x; %};
long y_min() %code{% RETVAL = THIS->min.y; %};
long y_max() %code{% RETVAL = THIS->max.y; %};
int x_min() %code{% RETVAL = THIS->min.x; %};
int x_max() %code{% RETVAL = THIS->max.x; %};
int y_min() %code{% RETVAL = THIS->min.y; %};
int y_max() %code{% RETVAL = THIS->max.y; %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%ld,%ld;%ld,%ld", THIS->min.x, THIS->min.y, THIS->max.x, THIS->max.y); RETVAL = buf; %};
bool defined() %code{% RETVAL = THIS->defined; %};

View file

@ -23,7 +23,7 @@ BridgeDetector*
BridgeDetector::new(expolygon, lower_slices, extrusion_width)
ExPolygon* expolygon;
ExPolygonCollection* lower_slices;
long extrusion_width;
int extrusion_width;
CODE:
RETVAL = new BridgeDetector(*expolygon, *lower_slices, extrusion_width);
OUTPUT:
@ -33,7 +33,7 @@ BridgeDetector*
BridgeDetector::new_expolygons(expolygons, lower_slices, extrusion_width)
ExPolygonCollection* expolygons;
ExPolygonCollection* lower_slices;
long extrusion_width;
int extrusion_width;
CODE:
RETVAL = new BridgeDetector(expolygons->expolygons, *lower_slices, extrusion_width);
OUTPUT:

View file

@ -26,8 +26,8 @@
float spacing();
float spacing_to(Flow* other)
%code{% RETVAL = THIS->spacing(*other); %};
long scaled_width();
long scaled_spacing();
int scaled_width();
int scaled_spacing();
double mm3_per_mm();
%{

View file

@ -4,6 +4,7 @@
#include <xsinit.h>
#include "libslic3r/GCode.hpp"
#include "libslic3r/GCode/CoolingBuffer.hpp"
#include "libslic3r/GCode/PreviewData.hpp"
%}
%name{Slic3r::GCode::CoolingBuffer} class CoolingBuffer {
@ -25,6 +26,14 @@
croak(e.what());
}
%};
void do_export_w_preview(Print *print, const char *path, GCodePreviewData *preview_data)
%code%{
try {
THIS->do_export(print, path, preview_data);
} catch (std::exception& e) {
croak(e.what());
}
%};
Ref<Pointf> origin()
%code{% RETVAL = &(THIS->origin()); %};
@ -50,3 +59,27 @@
Ref<StaticPrintConfig> config()
%code{% RETVAL = const_cast<StaticPrintConfig*>(static_cast<const StaticPrintConfig*>(static_cast<const PrintObjectConfig*>(&THIS->config()))); %};
};
%name{Slic3r::GCode::PreviewData} class GCodePreviewData {
GCodePreviewData();
~GCodePreviewData();
void reset();
bool empty() const;
void set_type(int type)
%code%{
if ((0 <= type) && (type < GCodePreviewData::Extrusion::Num_View_Types))
THIS->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
%};
int type() %code%{ RETVAL = (int)THIS->extrusion.view_type; %};
void set_extrusion_flags(int flags)
%code%{ THIS->extrusion.role_flags = (unsigned int)flags; %};
void set_travel_visible(bool visible)
%code%{ THIS->travel.is_visible = visible; %};
void set_retractions_visible(bool visible)
%code%{ THIS->retraction.is_visible = visible; %};
void set_unretractions_visible(bool visible)
%code%{ THIS->unretraction.is_visible = visible; %};
void set_shells_visible(bool visible)
%code%{ THIS->shell.is_visible = visible; %};
void set_extrusion_paths_colors(std::vector<std::string> colors);
};

View file

@ -31,9 +31,27 @@ void set_main_frame(SV *ui)
void set_tab_panel(SV *ui)
%code%{ Slic3r::GUI::set_tab_panel((wxNotebook*)wxPli_sv_2_object(aTHX_ ui, "Wx::Notebook")); %};
void add_debug_menu(SV *ui, int event_language_change)
%code%{ Slic3r::GUI::add_debug_menu((wxMenuBar*)wxPli_sv_2_object(aTHX_ ui, "Wx::MenuBar"), event_language_change); %};
void add_debug_menu(SV *ui)
%code%{ Slic3r::GUI::add_debug_menu((wxMenuBar*)wxPli_sv_2_object(aTHX_ ui, "Wx::MenuBar")); %};
void create_preset_tabs(PresetBundle *preset_bundle, AppConfig *app_config,
bool no_controller, bool is_disabled_button_browse, bool is_user_agent,
int event_value_change, int event_presets_changed,
int event_button_browse, int event_button_test)
%code%{ Slic3r::GUI::create_preset_tabs(preset_bundle, app_config, no_controller,
is_disabled_button_browse, is_user_agent,
event_value_change, event_presets_changed,
event_button_browse, event_button_test); %};
void create_preset_tab(const char *name)
%code%{ Slic3r::GUI::create_preset_tab(name); %};
Ref<TabIface> get_preset_tab(char *name)
%code%{ RETVAL=Slic3r::GUI::get_preset_tab_iface(name); %};
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")); %};

View file

@ -42,6 +42,8 @@
%code%{ RETVAL = THIS->hover; %};
void set_hover(int i)
%code%{ THIS->hover = i; %};
int zoom_to_volumes()
%code%{ RETVAL = THIS->zoom_to_volumes; %};
int object_idx() const;
int volume_idx() const;
@ -141,6 +143,39 @@ _glew_init()
CODE:
_3DScene::_glew_init();
unsigned int
finalize_legend_texture()
CODE:
RETVAL = _3DScene::finalize_legend_texture();
OUTPUT:
RETVAL
unsigned int
get_legend_texture_id()
CODE:
RETVAL = _3DScene::get_legend_texture_id();
OUTPUT:
RETVAL
unsigned int
get_legend_texture_width()
CODE:
RETVAL = _3DScene::get_legend_texture_width();
OUTPUT:
RETVAL
unsigned int
get_legend_texture_height()
CODE:
RETVAL = _3DScene::get_legend_texture_height();
OUTPUT:
RETVAL
void
reset_legend_texture()
CODE:
_3DScene::reset_legend_texture();
void
_load_print_toolpaths(print, volumes, tool_colors, use_VBOs)
Print *print;
@ -168,4 +203,14 @@ _load_wipe_tower_toolpaths(print, volumes, tool_colors, use_VBOs)
CODE:
_3DScene::_load_wipe_tower_toolpaths(print, volumes, tool_colors, use_VBOs != 0);
void
load_gcode_preview(print, preview_data, volumes, str_tool_colors, use_VBOs)
Print *print;
GCodePreviewData *preview_data;
GLVolumeCollection *volumes;
std::vector<std::string> str_tool_colors;
int use_VBOs;
CODE:
_3DScene::load_gcode_preview(print, preview_data, volumes, str_tool_colors, use_VBOs != 0);
%}

View file

@ -18,8 +18,8 @@
bool is_compatible_with_printer(Preset *active_printer)
%code%{ RETVAL = THIS->is_compatible_with_printer(*active_printer); %};
const char* name() %code%{ RETVAL = THIS->name.c_str(); %};
const char* file() %code%{ RETVAL = THIS->file.c_str(); %};
std::string name() %code%{ RETVAL = THIS->name; %};
std::string file() %code%{ RETVAL = THIS->file; %};
bool loaded() %code%{ RETVAL = THIS->loaded; %};
@ -184,4 +184,6 @@ PresetCollection::arrayref()
%code%{ RETVAL = PresetHints::cooling_description(*preset); %};
static std::string maximum_volumetric_flow_description(PresetBundle *preset)
%code%{ RETVAL = PresetHints::maximum_volumetric_flow_description(*preset); %};
static std::string recommended_thin_wall_thickness(PresetBundle *preset)
%code%{ RETVAL = PresetHints::recommended_thin_wall_thickness(*preset); %};
};

23
xs/xsp/GUI_Tab.xsp Normal file
View file

@ -0,0 +1,23 @@
%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();
std::string title();
Ref<DynamicPrintConfig> get_config();
Ref<PresetCollection> get_presets();
std::vector<std::string> get_dependent_tabs();
};

View file

@ -3,12 +3,15 @@
%{
#include <xsinit.h>
#include "libslic3r/Model.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Slicing.hpp"
#include "libslic3r/Format/AMF.hpp"
#include "libslic3r/Format/3mf.hpp"
#include "libslic3r/Format/OBJ.hpp"
#include "libslic3r/Format/PRUS.hpp"
#include "libslic3r/Format/STL.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
%}
%name{Slic3r::Model} class Model {
@ -24,6 +27,15 @@
}
%};
%name{read_from_archive} Model(std::string input_file, PresetBundle* bundle, bool add_default_instances = true)
%code%{
try {
RETVAL = new Model(Model::read_from_archive(input_file, bundle, add_default_instances));
} catch (std::exception& e) {
croak("Error while opening %s: %s\n", input_file.c_str(), e.what());
}
%};
Clone<Model> clone()
%code%{ RETVAL = THIS; %};
@ -89,8 +101,10 @@
bool store_stl(char *path, bool binary)
%code%{ TriangleMesh mesh = THIS->mesh(); RETVAL = Slic3r::store_stl(path, &mesh, binary); %};
bool store_amf(char *path)
%code%{ RETVAL = Slic3r::store_amf(path, THIS); %};
bool store_amf(char *path, Print* print)
%code%{ RETVAL = Slic3r::store_amf(path, THIS, print); %};
bool store_3mf(char *path, Print* print)
%code%{ RETVAL = Slic3r::store_3mf(path, THIS, print); %};
%{
@ -123,18 +137,33 @@ load_obj(CLASS, path, object_name)
RETVAL
Model*
load_amf(CLASS, path)
load_amf(CLASS, bundle, path)
char* CLASS;
PresetBundle* bundle;
char* path;
CODE:
RETVAL = new Model();
if (! load_amf(path, RETVAL)) {
if (! load_amf(path, bundle, RETVAL)) {
delete RETVAL;
RETVAL = NULL;
}
OUTPUT:
RETVAL
Model*
load_3mf(CLASS, bundle, path)
char* CLASS;
PresetBundle* bundle;
char* path;
CODE:
RETVAL = new Model();
if (! load_3mf(path, bundle, RETVAL)) {
delete RETVAL;
RETVAL = NULL;
}
OUTPUT:
RETVAL
Model*
load_prus(CLASS, path)
char* CLASS;

View file

@ -8,7 +8,7 @@
%}
%name{Slic3r::Point} class Point {
Point(long _x = 0, long _y = 0);
Point(int _x = 0, int _y = 0);
~Point();
Clone<Point> clone()
%code{% RETVAL=THIS; %};
@ -18,13 +18,13 @@
%code{% RETVAL = to_SV_pureperl(THIS); %};
SV* pp()
%code{% RETVAL = to_SV_pureperl(THIS); %};
long x()
int x()
%code{% RETVAL = THIS->x; %};
long y()
int y()
%code{% RETVAL = THIS->y; %};
void set_x(long val)
void set_x(int val)
%code{% THIS->x = val; %};
void set_y(long val)
void set_y(int val)
%code{% THIS->y = val; %};
int nearest_point_index(Points points);
Clone<Point> nearest_point(Points points)
@ -77,15 +77,15 @@ Point::coincides_with(point_sv)
};
%name{Slic3r::Point3} class Point3 {
Point3(long _x = 0, long _y = 0, long _z = 0);
Point3(int _x = 0, int _y = 0, int _z = 0);
~Point3();
Clone<Point3> clone()
%code{% RETVAL = THIS; %};
long x()
int x()
%code{% RETVAL = THIS->x; %};
long y()
int y()
%code{% RETVAL = THIS->y; %};
long z()
int z()
%code{% RETVAL = THIS->z; %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%ld,%ld,%ld", THIS->x, THIS->y, THIS->z); RETVAL = buf; %};
};

View file

@ -152,6 +152,8 @@ _constant()
%code%{ RETVAL = &THIS->skirt; %};
Ref<ExtrusionEntityCollection> brim()
%code%{ RETVAL = &THIS->brim; %};
std::string estimated_print_time()
%code%{ RETVAL = THIS->estimated_print_time; %};
PrintObjectPtrs* objects()
%code%{ RETVAL = &THIS->objects; %};
@ -280,7 +282,6 @@ Print::total_cost(...)
}
RETVAL = THIS->total_cost;
OUTPUT:
RETVAL
RETVAL
%}
};

View file

@ -54,6 +54,12 @@ set_var_dir(dir)
CODE:
Slic3r::set_var_dir(dir);
void
set_local_dir(dir)
char *dir;
CODE:
Slic3r::set_local_dir(dir);
char*
var_dir()
CODE:
@ -91,7 +97,7 @@ data_dir()
RETVAL = const_cast<char*>(Slic3r::data_dir().c_str());
OUTPUT: RETVAL
std::string
local_encoded_string
encode_path(src)
const char *src;
CODE:
@ -112,6 +118,41 @@ normalize_utf8_nfc(src)
RETVAL = Slic3r::normalize_utf8_nfc(src);
OUTPUT: RETVAL
std::string
path_to_filename(src)
const char *src;
CODE:
RETVAL = Slic3r::PerlUtils::path_to_filename(src);
OUTPUT: RETVAL
local_encoded_string
path_to_filename_raw(src)
const char *src;
CODE:
RETVAL = Slic3r::PerlUtils::path_to_filename(src);
OUTPUT: RETVAL
std::string
path_to_stem(src)
const char *src;
CODE:
RETVAL = Slic3r::PerlUtils::path_to_stem(src);
OUTPUT: RETVAL
std::string
path_to_extension(src)
const char *src;
CODE:
RETVAL = Slic3r::PerlUtils::path_to_extension(src);
OUTPUT: RETVAL
std::string
path_to_parent_path(src)
const char *src;
CODE:
RETVAL = Slic3r::PerlUtils::path_to_parent_path(src);
OUTPUT: RETVAL
void
xspp_test_croak_hangs_on_strawberry()
CODE:

View file

@ -1,6 +1,7 @@
coordf_t T_NV
std::string T_STD_STRING
local_encoded_string T_STD_STRING_LOCAL_ENCODING
t_config_option_key T_STD_STRING
t_model_material_id T_STD_STRING
@ -190,6 +191,10 @@ GCode* O_OBJECT_SLIC3R
Ref<GCode> O_OBJECT_SLIC3R_T
Clone<GCode> O_OBJECT_SLIC3R_T
GCodePreviewData* O_OBJECT_SLIC3R
Ref<GCodePreviewData> O_OBJECT_SLIC3R_T
Clone<GCodePreviewData> O_OBJECT_SLIC3R_T
MotionPlanner* O_OBJECT_SLIC3R
Ref<MotionPlanner> O_OBJECT_SLIC3R_T
Clone<MotionPlanner> O_OBJECT_SLIC3R_T
@ -228,6 +233,8 @@ PresetBundle* O_OBJECT_SLIC3R
Ref<PresetBundle> O_OBJECT_SLIC3R_T
PresetHints* O_OBJECT_SLIC3R
Ref<PresetHints> O_OBJECT_SLIC3R_T
TabIface* O_OBJECT_SLIC3R
Ref<TabIface> O_OBJECT_SLIC3R_T
Axis T_UV
ExtrusionLoopRole T_UV
@ -279,6 +286,14 @@ T_STD_STRING
$var = std::string(c, len);
}
INPUT
T_STD_STRING_LOCAL_ENCODING
{
size_t len;
const char * c = SvPV($arg, len);
$var = std::string(c, len);
}
T_STD_VECTOR_STD_STRING
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
AV* av = (AV*)SvRV($arg);
@ -438,6 +453,9 @@ OUTPUT
T_STD_STRING
$arg = newSVpvn_utf8( $var.c_str(), $var.length(), true );
T_STD_STRING_LOCAL_ENCODING
$arg = newSVpvn( $var.c_str(), $var.length() );
T_STD_VECTOR_STD_STRING
AV* av = newAV();
$arg = newRV_noinc((SV*)av);

View file

@ -155,6 +155,9 @@
%typemap{Ref<GCode>}{simple};
%typemap{Clone<GCode>}{simple};
%typemap{GCodePreviewData*};
%typemap{Ref<GCodePreviewData>}{simple};
%typemap{Clone<GCodePreviewData>}{simple};
%typemap{Points};
%typemap{Pointfs};
@ -207,6 +210,8 @@
%typemap{Ref<PresetBundle>}{simple};
%typemap{PresetHints*};
%typemap{Ref<PresetHints>}{simple};
%typemap{TabIface*};
%typemap{Ref<TabIface>}{simple};
%typemap{PrintRegionPtrs*};
%typemap{PrintObjectPtrs*};