Conflict checker: automatically set the gcode preview at the layer shown in the notification when hitting the action text in it
This commit is contained in:
parent
9a1e85c1f4
commit
cc55bcbf5e
@ -7493,12 +7493,14 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
|
||||
const PrintObject* obj2 = reinterpret_cast<const PrintObject*>(conflict_result->_obj2);
|
||||
auto mo = obj2->model_object();
|
||||
ObjectID id = mo->id();
|
||||
auto action_fn = [id](wxEvtHandler*) {
|
||||
int layer_id = conflict_result->layer;
|
||||
auto action_fn = [id, layer_id](wxEvtHandler*) {
|
||||
auto& objects = wxGetApp().model().objects;
|
||||
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
|
||||
if (iter != objects.end()) {
|
||||
const unsigned int obj_idx = std::distance(objects.begin(), iter);
|
||||
wxGetApp().CallAfter([obj_idx]() {
|
||||
wxGetApp().CallAfter([obj_idx, layer_id]() {
|
||||
wxGetApp().plater()->set_preview_layers_slider_values_range(0, layer_id - 1);
|
||||
wxGetApp().plater()->select_view_3D("3D");
|
||||
wxGetApp().plater()->canvas3D()->get_selection().add_object(obj_idx, true);
|
||||
wxGetApp().obj_list()->update_selections();
|
||||
|
@ -181,6 +181,12 @@ Preview::Preview(
|
||||
load_print();
|
||||
}
|
||||
|
||||
void Preview::set_layers_slider_values_range(int bottom, int top)
|
||||
{
|
||||
m_layers_slider->SetHigherValue(std::min(top, m_layers_slider->GetMaxValue()));
|
||||
m_layers_slider->SetLowerValue(std::max(bottom, m_layers_slider->GetMinValue()));
|
||||
}
|
||||
|
||||
bool Preview::init(wxWindow* parent, Bed3D& bed, Model* model)
|
||||
{
|
||||
if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* disable wxTAB_TRAVERSAL */))
|
||||
|
@ -151,6 +151,8 @@ public:
|
||||
|
||||
void set_keep_current_preview_type(bool value) { m_keep_current_preview_type = value; }
|
||||
|
||||
void set_layers_slider_values_range(int bottom, int top);
|
||||
|
||||
private:
|
||||
bool init(wxWindow* parent, Bed3D& bed, Model* model);
|
||||
|
||||
|
@ -1794,6 +1794,8 @@ struct Plater::priv
|
||||
bool init_view_toolbar();
|
||||
bool init_collapse_toolbar();
|
||||
|
||||
void set_preview_layers_slider_values_range(int bottom, int top);
|
||||
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
@ -4632,6 +4634,11 @@ bool Plater::priv::init_collapse_toolbar()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Plater::priv::set_preview_layers_slider_values_range(int bottom, int top)
|
||||
{
|
||||
preview->set_layers_slider_values_range(bottom, top);
|
||||
}
|
||||
|
||||
void Plater::priv::update_preview_moves_slider()
|
||||
{
|
||||
preview->update_moves_slider();
|
||||
@ -7506,6 +7513,11 @@ GLToolbar& Plater::get_collapse_toolbar()
|
||||
return p->collapse_toolbar;
|
||||
}
|
||||
|
||||
void Plater::set_preview_layers_slider_values_range(int bottom, int top)
|
||||
{
|
||||
p->set_preview_layers_slider_values_range(bottom, top);
|
||||
}
|
||||
|
||||
void Plater::update_preview_moves_slider()
|
||||
{
|
||||
p->update_preview_moves_slider();
|
||||
|
@ -399,6 +399,8 @@ public:
|
||||
const GLToolbar& get_collapse_toolbar() const;
|
||||
GLToolbar& get_collapse_toolbar();
|
||||
|
||||
void set_preview_layers_slider_values_range(int bottom, int top);
|
||||
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user