Fixed updates of the variable layer height texture on config change
and when the reset button on the variable layer height bar is pressed.
This commit is contained in:
parent
a7c876a9bb
commit
6937c21f4b
2 changed files with 20 additions and 3 deletions
|
@ -859,6 +859,14 @@ bool GLCanvas3D::LayersEditing::init(const std::string& vertex_shader_filename,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::LayersEditing::set_config(const DynamicPrintConfig* config)
|
||||||
|
{
|
||||||
|
m_config = config;
|
||||||
|
delete m_slicing_parameters;
|
||||||
|
m_slicing_parameters = nullptr;
|
||||||
|
m_layers_texture.valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::LayersEditing::select_object(const Model &model, int object_id)
|
void GLCanvas3D::LayersEditing::select_object(const Model &model, int object_id)
|
||||||
{
|
{
|
||||||
const ModelObject *model_object_new = (object_id >= 0) ? model.objects[object_id] : nullptr;
|
const ModelObject *model_object_new = (object_id >= 0) ? model.objects[object_id] : nullptr;
|
||||||
|
@ -867,6 +875,7 @@ void GLCanvas3D::LayersEditing::select_object(const Model &model, int object_id)
|
||||||
m_layer_height_profile_modified = false;
|
m_layer_height_profile_modified = false;
|
||||||
delete m_slicing_parameters;
|
delete m_slicing_parameters;
|
||||||
m_slicing_parameters = nullptr;
|
m_slicing_parameters = nullptr;
|
||||||
|
m_layers_texture.valid = false;
|
||||||
}
|
}
|
||||||
this->last_object_id = object_id;
|
this->last_object_id = object_id;
|
||||||
m_model_object = model_object_new;
|
m_model_object = model_object_new;
|
||||||
|
@ -1170,6 +1179,13 @@ void GLCanvas3D::LayersEditing::adjust_layer_height_profile()
|
||||||
m_layers_texture.valid = false;
|
m_layers_texture.valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::LayersEditing::reset_layer_height_profile()
|
||||||
|
{
|
||||||
|
const_cast<ModelObject*>(m_model_object)->layer_height_profile.clear();
|
||||||
|
m_layer_height_profile.clear();
|
||||||
|
m_layers_texture.valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::LayersEditing::generate_layer_height_texture()
|
void GLCanvas3D::LayersEditing::generate_layer_height_texture()
|
||||||
{
|
{
|
||||||
this->update_slicing_parameters();
|
this->update_slicing_parameters();
|
||||||
|
@ -5101,7 +5117,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
if (evt.LeftDown())
|
if (evt.LeftDown())
|
||||||
{
|
{
|
||||||
// A volume is selected and the mouse is inside the reset button. Reset the ModelObject's layer height profile.
|
// A volume is selected and the mouse is inside the reset button. Reset the ModelObject's layer height profile.
|
||||||
m_model->objects[layer_editing_object_idx]->layer_height_profile.clear();
|
m_layers_editing.reset_layer_height_profile();
|
||||||
// Index 2 means no editing, just wait for mouse up event.
|
// Index 2 means no editing, just wait for mouse up event.
|
||||||
m_layers_editing.state = LayersEditing::Completed;
|
m_layers_editing.state = LayersEditing::Completed;
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ class GLCanvas3D
|
||||||
~LayersEditing();
|
~LayersEditing();
|
||||||
|
|
||||||
bool init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename);
|
bool init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename);
|
||||||
void set_config(const DynamicPrintConfig* config) { m_config = config; delete m_slicing_parameters; m_slicing_parameters = nullptr; }
|
void set_config(const DynamicPrintConfig* config);
|
||||||
void select_object(const Model &model, int object_id);
|
void select_object(const Model &model, int object_id);
|
||||||
|
|
||||||
bool is_allowed() const;
|
bool is_allowed() const;
|
||||||
|
@ -358,9 +358,9 @@ class GLCanvas3D
|
||||||
void render_overlay(const GLCanvas3D& canvas) const;
|
void render_overlay(const GLCanvas3D& canvas) const;
|
||||||
void render_volumes(const GLCanvas3D& canvas, const GLVolumeCollection& volumes) const;
|
void render_volumes(const GLCanvas3D& canvas, const GLVolumeCollection& volumes) const;
|
||||||
|
|
||||||
void generate_layer_height_texture();
|
|
||||||
void adjust_layer_height_profile();
|
void adjust_layer_height_profile();
|
||||||
void accept_changes(GLCanvas3D& canvas);
|
void accept_changes(GLCanvas3D& canvas);
|
||||||
|
void reset_layer_height_profile();
|
||||||
|
|
||||||
static float get_cursor_z_relative(const GLCanvas3D& canvas);
|
static float get_cursor_z_relative(const GLCanvas3D& canvas);
|
||||||
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
||||||
|
@ -374,6 +374,7 @@ class GLCanvas3D
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _is_initialized() const;
|
bool _is_initialized() const;
|
||||||
|
void generate_layer_height_texture();
|
||||||
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
|
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
|
||||||
void _render_reset_texture(const Rect& reset_rect) const;
|
void _render_reset_texture(const Rect& reset_rect) const;
|
||||||
void _render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
|
void _render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue