Merge branch 'master' of https://github.com/prusa3d/Slic3r into sidebar_fixes
This commit is contained in:
commit
3deeab90f3
@ -86,9 +86,8 @@ set(CMAKE_C_STANDARD 11)
|
|||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(NOT WIN32)
|
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>:-DDEBUG>")
|
||||||
add_compile_options("$<$<CONFIG:DEBUG>:-D_DEBUG>")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# To be able to link libslic3r with the Perl XS module.
|
# To be able to link libslic3r with the Perl XS module.
|
||||||
|
@ -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));
|
Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to));
|
||||||
Vec3d axis = angle_axis.axis();
|
Vec3d axis = angle_axis.axis();
|
||||||
double angle = angle_axis.angle();
|
double angle = angle_axis.angle();
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
if (std::abs(angle) > 1e-8) {
|
if (std::abs(angle) > 1e-8) {
|
||||||
assert(std::abs(axis.x()) < 1e-8);
|
assert(std::abs(axis.x()) < 1e-8);
|
||||||
assert(std::abs(axis.y()) < 1e-8);
|
assert(std::abs(axis.y()) < 1e-8);
|
||||||
}
|
}
|
||||||
#endif /* _DEBUG */
|
#endif /* NDEBUG */
|
||||||
return (axis.z() < 0) ? -angle : angle;
|
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)
|
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));
|
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)
|
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);
|
verify_instances_rotation_synchronized(*m_model, *m_volumes);
|
||||||
#endif /* _DEBUG */
|
#endif /* NDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::Selection::_synchronize_unselected_volumes()
|
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)
|
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 std::vector<double>& color_print_values = config.option<ConfigOptionFloats>("colorprint_heights")->values;
|
||||||
const int values_cnt = color_print_values.size();
|
const int values_cnt = color_print_values.size();
|
||||||
if (values_cnt > 0) {
|
if (values_cnt > 0) {
|
||||||
@ -4682,10 +4682,10 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
}
|
}
|
||||||
if (printer_technology == ptSLA) {
|
if (printer_technology == ptSLA) {
|
||||||
const SLAPrint *sla_print = this->sla_print();
|
const SLAPrint *sla_print = this->sla_print();
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
// Verify that the SLAPrint object is synchronized with m_model.
|
// Verify that the SLAPrint object is synchronized with m_model.
|
||||||
check_model_ids_equal(*m_model, sla_print->model());
|
check_model_ids_equal(*m_model, sla_print->model());
|
||||||
#endif /* _DEBUG */
|
#endif /* NDEBUG */
|
||||||
sla_support_state.reserve(sla_print->objects().size());
|
sla_support_state.reserve(sla_print->objects().size());
|
||||||
for (const SLAPrintObject *print_object : sla_print->objects()) {
|
for (const SLAPrintObject *print_object : sla_print->objects()) {
|
||||||
SLASupportState state;
|
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; }
|
bool color_by_color_print() const { return color_print_values!=nullptr; }
|
||||||
const float* color_print_by_layer_idx(const size_t layer_idx) const
|
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());
|
return color_tool((it - color_print_values->begin()) % number_tools());
|
||||||
}
|
}
|
||||||
} ctxt;
|
} ctxt;
|
||||||
|
@ -103,8 +103,6 @@ ObjectList::ObjectList(wxWindow* parent) :
|
|||||||
|
|
||||||
ObjectList::~ObjectList()
|
ObjectList::~ObjectList()
|
||||||
{
|
{
|
||||||
if (m_default_config)
|
|
||||||
delete m_default_config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::create_objects_ctrl()
|
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);
|
const ConfigOption* option = from_config.option(opt_key);
|
||||||
if (!option) {
|
if (!option) {
|
||||||
// if current option doesn't exist in prints.get_edited_preset(),
|
// if current option doesn't exist in prints.get_edited_preset(),
|
||||||
// get it from m_default_config
|
// get it from default config values
|
||||||
if (m_default_config) delete m_default_config;
|
option = DynamicPrintConfig::new_from_defaults_keys({ opt_key })->option(opt_key);
|
||||||
m_default_config = DynamicPrintConfig::new_from_defaults_keys(get_options(false));
|
|
||||||
option = m_default_config->option(opt_key);
|
|
||||||
}
|
}
|
||||||
m_config->set_key_value(opt_key, option->clone());
|
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);
|
const ConfigOption* option = from_config.option(opt_key);
|
||||||
if (!option) {
|
if (!option) {
|
||||||
// if current option doesn't exist in prints.get_edited_preset(),
|
// if current option doesn't exist in prints.get_edited_preset(),
|
||||||
// get it from m_default_config
|
// get it from default config values
|
||||||
if (m_default_config) delete m_default_config;
|
option = DynamicPrintConfig::new_from_defaults_keys({ opt_key })->option(opt_key);
|
||||||
m_default_config = DynamicPrintConfig::new_from_defaults_keys(get_options(false));
|
|
||||||
option = m_default_config->option(opt_key);
|
|
||||||
}
|
}
|
||||||
m_config->set_key_value(opt_key, option->clone());
|
m_config->set_key_value(opt_key, option->clone());
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,6 @@ class ObjectList : public wxDataViewCtrl
|
|||||||
} m_dragged_data;
|
} m_dragged_data;
|
||||||
|
|
||||||
wxBoxSizer *m_sizer {nullptr};
|
wxBoxSizer *m_sizer {nullptr};
|
||||||
|
|
||||||
DynamicPrintConfig *m_default_config {nullptr};
|
|
||||||
|
|
||||||
wxWindow *m_parent {nullptr};
|
wxWindow *m_parent {nullptr};
|
||||||
|
|
||||||
wxBitmap m_bmp_modifiermesh;
|
wxBitmap m_bmp_modifiermesh;
|
||||||
|
@ -740,7 +740,7 @@ void Preview::load_print_as_fff()
|
|||||||
if (! gcode_preview_data_valid) {
|
if (! gcode_preview_data_valid) {
|
||||||
//FIXME accessing full_config() is pretty expensive.
|
//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.
|
// 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;
|
color_print_values = config.option<ConfigOptionFloats>("colorprint_heights")->values;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1668,7 +1668,7 @@ void PrusaDoubleSlider::render()
|
|||||||
|
|
||||||
// draw colored band on the background of a scroll line
|
// draw colored band on the background of a scroll line
|
||||||
// and only in a case of no-empty m_values
|
// and only in a case of no-empty m_values
|
||||||
// draw_colored_band(dc);
|
draw_colored_band(dc);
|
||||||
|
|
||||||
// draw line
|
// draw line
|
||||||
draw_scroll_line(dc, lower_pos, higher_pos);
|
draw_scroll_line(dc, lower_pos, higher_pos);
|
||||||
@ -1867,8 +1867,10 @@ void PrusaDoubleSlider::draw_colored_band(wxDC& dc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<unsigned char>& clr_bytes = Slic3r::GCodePreviewData::Range::Default_Colors[0].as_bytes();
|
const std::vector<std::string>& colors = Slic3r::GCodePreviewData::ColorPrintColors();
|
||||||
wxColour clr = wxColour(clr_bytes[0], clr_bytes[1], clr_bytes[2], clr_bytes[3]);
|
const size_t colors_cnt = colors.size();
|
||||||
|
|
||||||
|
wxColour clr(colors[0]);
|
||||||
dc.SetPen(clr);
|
dc.SetPen(clr);
|
||||||
dc.SetBrush(clr);
|
dc.SetBrush(clr);
|
||||||
dc.DrawRectangle(main_band);
|
dc.DrawRectangle(main_band);
|
||||||
@ -1876,15 +1878,13 @@ void PrusaDoubleSlider::draw_colored_band(wxDC& dc)
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
for (auto tick : m_ticks)
|
for (auto tick : m_ticks)
|
||||||
{
|
{
|
||||||
if (i == Slic3r::GCodePreviewData::Range::Colors_Count)
|
if (i == colors_cnt)
|
||||||
i = 0;
|
i = 0;
|
||||||
const wxCoord pos = get_position_from_value(tick);
|
const wxCoord pos = get_position_from_value(tick);
|
||||||
is_horizontal() ? main_band.SetLeft(SLIDER_MARGIN + pos) :
|
is_horizontal() ? main_band.SetLeft(SLIDER_MARGIN + pos) :
|
||||||
main_band.SetBottom(pos-1);
|
main_band.SetBottom(pos-1);
|
||||||
|
|
||||||
const std::vector<unsigned char>& clr_b = Slic3r::GCodePreviewData::Range::Default_Colors[i].as_bytes();
|
clr = wxColour(colors[i]);
|
||||||
|
|
||||||
clr = wxColour(clr_b[0], clr_b[1], clr_b[2], clr_b[3]);
|
|
||||||
dc.SetPen(clr);
|
dc.SetPen(clr);
|
||||||
dc.SetBrush(clr);
|
dc.SetBrush(clr);
|
||||||
dc.DrawRectangle(main_band);
|
dc.DrawRectangle(main_band);
|
||||||
|
Loading…
Reference in New Issue
Block a user