Hollowing gizmo has now its own shortcut [H], fixed a situation with supports showed in editing mode
This commit is contained in:
parent
53976de250
commit
735f82c019
5 changed files with 15 additions and 20 deletions
|
@ -1301,8 +1301,11 @@ int GLCanvas3D::check_volumes_outside_state() const
|
||||||
return (int)state;
|
return (int)state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx)
|
bool GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx)
|
||||||
{
|
{
|
||||||
|
if (m_render_sla_auxiliaries == visible)
|
||||||
|
return false;
|
||||||
|
|
||||||
for (GLVolume* vol : m_volumes.volumes) {
|
for (GLVolume* vol : m_volumes.volumes) {
|
||||||
if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
|
if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
|
||||||
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)
|
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)
|
||||||
|
@ -1311,6 +1314,7 @@ void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObje
|
||||||
}
|
}
|
||||||
|
|
||||||
m_render_sla_auxiliaries = visible;
|
m_render_sla_auxiliaries = visible;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject* mo, int instance_idx)
|
void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject* mo, int instance_idx)
|
||||||
|
|
|
@ -462,7 +462,7 @@ public:
|
||||||
void reset_volumes();
|
void reset_volumes();
|
||||||
int check_volumes_outside_state() const;
|
int check_volumes_outside_state() const;
|
||||||
|
|
||||||
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
bool toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
||||||
void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
||||||
void update_instance_printable_state_for_object(size_t obj_idx);
|
void update_instance_printable_state_for_object(size_t obj_idx);
|
||||||
void update_instance_printable_state_for_objects(std::vector<size_t>& object_idxs);
|
void update_instance_printable_state_for_objects(std::vector<size_t>& object_idxs);
|
||||||
|
|
|
@ -37,7 +37,7 @@ GLGizmoHollow::~GLGizmoHollow()
|
||||||
|
|
||||||
bool GLGizmoHollow::on_init()
|
bool GLGizmoHollow::on_init()
|
||||||
{
|
{
|
||||||
m_shortcut_key = WXK_CONTROL_L;
|
m_shortcut_key = WXK_CONTROL_H;
|
||||||
|
|
||||||
m_desc["head_diameter"] = _(L("Head diameter")) + ": ";
|
m_desc["head_diameter"] = _(L("Head diameter")) + ": ";
|
||||||
m_desc["lock_supports"] = _(L("Lock supports under new islands"));
|
m_desc["lock_supports"] = _(L("Lock supports under new islands"));
|
||||||
|
@ -595,7 +595,6 @@ void GLGizmoHollow::update_hollowed_mesh(std::unique_ptr<TriangleMesh> &&mesh)
|
||||||
m_volume_with_cavity->set_volume_transformation(volume_trafo);
|
m_volume_with_cavity->set_volume_transformation(volume_trafo);
|
||||||
m_volume_with_cavity->set_instance_transformation(m_model_object->instances[size_t(m_active_instance)]->get_transformation());
|
m_volume_with_cavity->set_instance_transformation(m_model_object->instances[size_t(m_active_instance)]->get_transformation());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent.toggle_model_objects_visibility(! m_cavity_mesh, m_model_object, m_active_instance);
|
m_parent.toggle_model_objects_visibility(! m_cavity_mesh, m_model_object, m_active_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,10 +750,9 @@ RENDER_AGAIN:
|
||||||
if (ImGui::SliderFloat(" ", &m_clipping_plane_distance, 0.f, 1.f, "%.2f"))
|
if (ImGui::SliderFloat(" ", &m_clipping_plane_distance, 0.f, 1.f, "%.2f"))
|
||||||
update_clipping_plane(true);
|
update_clipping_plane(true);
|
||||||
|
|
||||||
if (m_imgui->checkbox(m_desc["show_supports"], m_show_supports)) {
|
// make sure supports are shown/hidden as appropriate
|
||||||
m_parent.toggle_sla_auxiliaries_visibility(m_show_supports, m_model_object, m_active_instance);
|
m_imgui->checkbox(m_desc["show_supports"], m_show_supports);
|
||||||
force_refresh = true;
|
force_refresh = m_parent.toggle_sla_auxiliaries_visibility(m_show_supports, m_model_object, m_active_instance);
|
||||||
}
|
|
||||||
|
|
||||||
m_imgui->end();
|
m_imgui->end();
|
||||||
|
|
||||||
|
|
|
@ -738,11 +738,6 @@ void GLGizmoSlaSupports::on_render_input_window(float x, float y, float bottom_l
|
||||||
bool first_run = true; // This is a hack to redraw the button when all points are removed,
|
bool first_run = true; // This is a hack to redraw the button when all points are removed,
|
||||||
// so it is not delayed until the background process finishes.
|
// so it is not delayed until the background process finishes.
|
||||||
RENDER_AGAIN:
|
RENDER_AGAIN:
|
||||||
//m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
|
||||||
//const ImVec2 window_size(m_imgui->scaled(18.f, 16.f));
|
|
||||||
//ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) ));
|
|
||||||
//ImGui::SetNextWindowSize(ImVec2(window_size));
|
|
||||||
|
|
||||||
const float approx_height = m_imgui->scaled(18.0f);
|
const float approx_height = m_imgui->scaled(18.0f);
|
||||||
y = std::min(y, bottom_limit - approx_height);
|
y = std::min(y, bottom_limit - approx_height);
|
||||||
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
||||||
|
@ -761,7 +756,6 @@ RENDER_AGAIN:
|
||||||
float window_width = minimal_slider_width + std::max(std::max(settings_sliders_left, clipping_slider_left), diameter_slider_left);
|
float window_width = minimal_slider_width + std::max(std::max(settings_sliders_left, clipping_slider_left), diameter_slider_left);
|
||||||
window_width = std::max(std::max(window_width, buttons_width_approx), lock_supports_width_approx);
|
window_width = std::max(std::max(window_width, buttons_width_approx), lock_supports_width_approx);
|
||||||
|
|
||||||
|
|
||||||
bool force_refresh = false;
|
bool force_refresh = false;
|
||||||
bool remove_selected = false;
|
bool remove_selected = false;
|
||||||
bool remove_all = false;
|
bool remove_all = false;
|
||||||
|
@ -917,11 +911,11 @@ RENDER_AGAIN:
|
||||||
|
|
||||||
m_imgui->end();
|
m_imgui->end();
|
||||||
|
|
||||||
if (m_editing_mode != m_old_editing_state) { // user toggled between editing/non-editing mode
|
// Make sure that the supports are (not) visible as they should be. This
|
||||||
m_parent.toggle_sla_auxiliaries_visibility(!m_editing_mode, m_model_object, m_active_instance);
|
// is done on each refresh because the user can switch the editing mode
|
||||||
force_refresh = true;
|
// before background process finishes.
|
||||||
}
|
force_refresh = m_parent.toggle_sla_auxiliaries_visibility(
|
||||||
m_old_editing_state = m_editing_mode;
|
! m_editing_mode, m_model_object, m_active_instance);
|
||||||
|
|
||||||
if (remove_selected || remove_all) {
|
if (remove_selected || remove_all) {
|
||||||
force_refresh = false;
|
force_refresh = false;
|
||||||
|
|
|
@ -99,7 +99,6 @@ private:
|
||||||
|
|
||||||
bool m_lock_unique_islands = false;
|
bool m_lock_unique_islands = false;
|
||||||
bool m_editing_mode = false; // Is editing mode active?
|
bool m_editing_mode = false; // Is editing mode active?
|
||||||
bool m_old_editing_state = false; // To keep track of whether the user toggled between the modes (needed for imgui refreshes).
|
|
||||||
float m_new_point_head_diameter; // Size of a new point.
|
float m_new_point_head_diameter; // Size of a new point.
|
||||||
CacheEntry m_point_before_drag; // undo/redo - so we know what state was edited
|
CacheEntry m_point_before_drag; // undo/redo - so we know what state was edited
|
||||||
float m_old_point_head_diameter = 0.; // the same
|
float m_old_point_head_diameter = 0.; // the same
|
||||||
|
|
Loading…
Reference in a new issue