Merge branch 'master' of https://github.com/prusa3d/Slic3r into sidebar_fixes

This commit is contained in:
Enrico Turri 2019-01-30 16:19:59 +01:00
commit 3deeab90f3
6 changed files with 23 additions and 33 deletions

View File

@ -86,9 +86,8 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
if(NOT WIN32)
# Add DEBUG flags for the debug builds in a way the Visual Studio adds these flags.
# Add DEBUG flags to debug builds.
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
add_compile_options("$<$<CONFIG:DEBUG>:-D_DEBUG>")
endif()
# To be able to link libslic3r with the Perl XS module.

View File

@ -1796,12 +1796,12 @@ static double rotation_diff_z(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to
Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to));
Vec3d axis = angle_axis.axis();
double angle = angle_axis.angle();
#ifdef _DEBUG
#ifndef NDEBUG
if (std::abs(angle) > 1e-8) {
assert(std::abs(axis.x()) < 1e-8);
assert(std::abs(axis.y()) < 1e-8);
}
#endif /* _DEBUG */
#endif /* NDEBUG */
return (axis.z() < 0) ? -angle : angle;
}
@ -2789,7 +2789,7 @@ void GLCanvas3D::Selection::_render_sidebar_size_hint(Axis axis, double length)
{
}
#ifdef _DEBUG
#ifndef NDEBUG
static bool is_rotation_xy_synchronized(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to)
{
Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to));
@ -2823,7 +2823,7 @@ static void verify_instances_rotation_synchronized(const Model &model, const GLV
}
}
}
#endif /* _DEBUG */
#endif /* NDEBUG */
void GLCanvas3D::Selection::_synchronize_unselected_instances(SyncRotationType sync_rotation_type)
{
@ -2883,9 +2883,9 @@ void GLCanvas3D::Selection::_synchronize_unselected_instances(SyncRotationType s
}
}
#ifdef _DEBUG
#ifndef NDEBUG
verify_instances_rotation_synchronized(*m_model, *m_volumes);
#endif /* _DEBUG */
#endif /* NDEBUG */
}
void GLCanvas3D::Selection::_synchronize_unselected_volumes()
@ -3756,7 +3756,7 @@ void GLCanvas3D::LegendTexture::fill_color_print_legend_values(const GCodePrevie
{
if (preview_data.extrusion.view_type == GCodePreviewData::Extrusion::ColorPrint)
{
const auto& config = wxGetApp().preset_bundle->full_config();
auto& config = wxGetApp().preset_bundle->project_config;
const std::vector<double>& color_print_values = config.option<ConfigOptionFloats>("colorprint_heights")->values;
const int values_cnt = color_print_values.size();
if (values_cnt > 0) {
@ -4682,10 +4682,10 @@ 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
#ifndef NDEBUG
// Verify that the SLAPrint object is synchronized with m_model.
check_model_ids_equal(*m_model, sla_print->model());
#endif /* _DEBUG */
#endif /* NDEBUG */
sla_support_state.reserve(sla_print->objects().size());
for (const SLAPrintObject *print_object : sla_print->objects()) {
SLASupportState state;
@ -7264,7 +7264,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
bool color_by_color_print() const { return color_print_values!=nullptr; }
const float* color_print_by_layer_idx(const size_t layer_idx) const
{
auto it = std::lower_bound(color_print_values->begin(), color_print_values->end(), layers[layer_idx]->print_z - EPSILON);
auto it = std::lower_bound(color_print_values->begin(), color_print_values->end(), layers[layer_idx]->print_z + EPSILON);
return color_tool((it - color_print_values->begin()) % number_tools());
}
} ctxt;

View File

@ -103,8 +103,6 @@ ObjectList::ObjectList(wxWindow* parent) :
ObjectList::~ObjectList()
{
if (m_default_config)
delete m_default_config;
}
void ObjectList::create_objects_ctrl()
@ -752,10 +750,8 @@ void ObjectList::get_settings_choice(const wxString& category_name)
const ConfigOption* option = from_config.option(opt_key);
if (!option) {
// if current option doesn't exist in prints.get_edited_preset(),
// get it from m_default_config
if (m_default_config) delete m_default_config;
m_default_config = DynamicPrintConfig::new_from_defaults_keys(get_options(false));
option = m_default_config->option(opt_key);
// get it from default config values
option = DynamicPrintConfig::new_from_defaults_keys({ opt_key })->option(opt_key);
}
m_config->set_key_value(opt_key, option->clone());
}
@ -779,10 +775,8 @@ void ObjectList::get_freq_settings_choice(const wxString& bundle_name)
const ConfigOption* option = from_config.option(opt_key);
if (!option) {
// if current option doesn't exist in prints.get_edited_preset(),
// get it from m_default_config
if (m_default_config) delete m_default_config;
m_default_config = DynamicPrintConfig::new_from_defaults_keys(get_options(false));
option = m_default_config->option(opt_key);
// get it from default config values
option = DynamicPrintConfig::new_from_defaults_keys({ opt_key })->option(opt_key);
}
m_config->set_key_value(opt_key, option->clone());
}

View File

@ -97,9 +97,6 @@ class ObjectList : public wxDataViewCtrl
} m_dragged_data;
wxBoxSizer *m_sizer {nullptr};
DynamicPrintConfig *m_default_config {nullptr};
wxWindow *m_parent {nullptr};
wxBitmap m_bmp_modifiermesh;

View File

@ -740,7 +740,7 @@ void Preview::load_print_as_fff()
if (! gcode_preview_data_valid) {
//FIXME accessing full_config() is pretty expensive.
// Only initialize color_print_values for the initial preview, not for the full preview where the color_print_values is extracted from the G-code.
const auto& config = wxGetApp().preset_bundle->full_config();
const auto& config = wxGetApp().preset_bundle->project_config;
color_print_values = config.option<ConfigOptionFloats>("colorprint_heights")->values;
}
}

View File

@ -1668,7 +1668,7 @@ void PrusaDoubleSlider::render()
// draw colored band on the background of a scroll line
// and only in a case of no-empty m_values
// draw_colored_band(dc);
draw_colored_band(dc);
// draw line
draw_scroll_line(dc, lower_pos, higher_pos);
@ -1867,8 +1867,10 @@ void PrusaDoubleSlider::draw_colored_band(wxDC& dc)
return;
}
const std::vector<unsigned char>& clr_bytes = Slic3r::GCodePreviewData::Range::Default_Colors[0].as_bytes();
wxColour clr = wxColour(clr_bytes[0], clr_bytes[1], clr_bytes[2], clr_bytes[3]);
const std::vector<std::string>& colors = Slic3r::GCodePreviewData::ColorPrintColors();
const size_t colors_cnt = colors.size();
wxColour clr(colors[0]);
dc.SetPen(clr);
dc.SetBrush(clr);
dc.DrawRectangle(main_band);
@ -1876,15 +1878,13 @@ void PrusaDoubleSlider::draw_colored_band(wxDC& dc)
int i = 1;
for (auto tick : m_ticks)
{
if (i == Slic3r::GCodePreviewData::Range::Colors_Count)
if (i == colors_cnt)
i = 0;
const wxCoord pos = get_position_from_value(tick);
is_horizontal() ? main_band.SetLeft(SLIDER_MARGIN + pos) :
main_band.SetBottom(pos-1);
const std::vector<unsigned char>& clr_b = Slic3r::GCodePreviewData::Range::Default_Colors[i].as_bytes();
clr = wxColour(clr_b[0], clr_b[1], clr_b[2], clr_b[3]);
clr = wxColour(colors[i]);
dc.SetPen(clr);
dc.SetBrush(clr);
dc.DrawRectangle(main_band);