Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_canvas_gui_refactoring
This commit is contained in:
commit
5bb89f4da2
@ -1696,8 +1696,11 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
|
||||
}
|
||||
else if (is_single_volume() || is_single_modifier())
|
||||
{
|
||||
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true) * (*m_volumes)[*m_list.begin()]->get_volume_transformation().get_matrix(true, false, true, true);
|
||||
::glTranslated(center(0), center(1), center(2));
|
||||
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||
if (!boost::starts_with(sidebar_field, "position"))
|
||||
orient_matrix = orient_matrix * (*m_volumes)[*m_list.begin()]->get_volume_transformation().get_matrix(true, false, true, true);
|
||||
|
||||
::glMultMatrixd(orient_matrix.data());
|
||||
}
|
||||
else
|
||||
|
@ -357,11 +357,11 @@ void Preview::set_drop_target(wxDropTarget* target)
|
||||
SetDropTarget(target);
|
||||
}
|
||||
|
||||
void Preview::load_print()
|
||||
void Preview::load_print(bool keep_z_range)
|
||||
{
|
||||
PrinterTechnology tech = m_process->current_printer_technology();
|
||||
if (tech == ptFFF)
|
||||
load_print_as_fff();
|
||||
load_print_as_fff(keep_z_range);
|
||||
else if (tech == ptSLA)
|
||||
load_print_as_sla();
|
||||
}
|
||||
@ -392,7 +392,7 @@ void Preview::refresh_print()
|
||||
if (!IsShown())
|
||||
return;
|
||||
|
||||
load_print();
|
||||
load_print(true);
|
||||
}
|
||||
|
||||
void Preview::bind_event_handlers()
|
||||
@ -449,10 +449,10 @@ void Preview::reset_sliders()
|
||||
m_double_slider_sizer->Hide((size_t)0);
|
||||
}
|
||||
|
||||
void Preview::update_sliders(const std::vector<double>& layers_z)
|
||||
void Preview::update_sliders(const std::vector<double>& layers_z, bool keep_z_range)
|
||||
{
|
||||
m_enabled = true;
|
||||
update_double_slider(layers_z);
|
||||
update_double_slider(layers_z, keep_z_range);
|
||||
m_double_slider_sizer->Show((size_t)0);
|
||||
Layout();
|
||||
}
|
||||
@ -561,13 +561,18 @@ static int find_close_layer_idx(const std::vector<double>& zs, double &z, double
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Preview::update_double_slider(const std::vector<double>& layers_z)
|
||||
void Preview::update_double_slider(const std::vector<double>& layers_z, bool keep_z_range)
|
||||
{
|
||||
// Save the initial slider span.
|
||||
double z_low = m_slider->GetLowerValueD();
|
||||
double z_high = m_slider->GetHigherValueD();
|
||||
bool was_empty = m_slider->GetMaxValue() == 0;
|
||||
bool force_sliders_full_range = was_empty;
|
||||
if (!keep_z_range)
|
||||
{
|
||||
bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > 1e-6;
|
||||
force_sliders_full_range |= span_changed;
|
||||
}
|
||||
bool snap_to_min = force_sliders_full_range || m_slider->is_lower_at_min();
|
||||
bool snap_to_max = force_sliders_full_range || m_slider->is_higher_at_max();
|
||||
|
||||
@ -654,7 +659,7 @@ void Preview::update_double_slider_from_canvas(wxKeyEvent& event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void Preview::load_print_as_fff()
|
||||
void Preview::load_print_as_fff(bool keep_z_range)
|
||||
{
|
||||
if (m_loaded || m_process->current_printer_technology() != ptFFF)
|
||||
return;
|
||||
@ -755,7 +760,7 @@ void Preview::load_print_as_fff()
|
||||
reset_sliders();
|
||||
m_canvas_widget->Refresh();
|
||||
} else
|
||||
update_sliders(zs);
|
||||
update_sliders(zs, keep_z_range);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
void select_view(const std::string& direction);
|
||||
void set_drop_target(wxDropTarget* target);
|
||||
|
||||
void load_print();
|
||||
void load_print(bool keep_z_range = false);
|
||||
void reload_print(bool keep_volumes = false);
|
||||
void refresh_print();
|
||||
|
||||
@ -128,7 +128,7 @@ private:
|
||||
void show_hide_ui_elements(const std::string& what);
|
||||
|
||||
void reset_sliders();
|
||||
void update_sliders(const std::vector<double>& layers_z);
|
||||
void update_sliders(const std::vector<double>& layers_z, bool keep_z_range = false);
|
||||
|
||||
void on_size(wxSizeEvent& evt);
|
||||
void on_choice_view_type(wxCommandEvent& evt);
|
||||
@ -140,14 +140,14 @@ private:
|
||||
|
||||
// Create/Update/Reset double slider on 3dPreview
|
||||
void create_double_slider();
|
||||
void update_double_slider(const std::vector<double>& layers_z);
|
||||
void update_double_slider(const std::vector<double>& layers_z, bool keep_z_range = false);
|
||||
void fill_slider_values(std::vector<std::pair<int, double>> &values,
|
||||
const std::vector<double> &layers_z);
|
||||
void reset_double_slider();
|
||||
// update DoubleSlider after keyDown in canvas
|
||||
void update_double_slider_from_canvas(wxKeyEvent& event);
|
||||
|
||||
void load_print_as_fff();
|
||||
void load_print_as_fff(bool keep_z_range = false);
|
||||
void load_print_as_sla();
|
||||
|
||||
void on_sliders_scroll_changed(wxEvent& event);
|
||||
|
Loading…
Reference in New Issue
Block a user