mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
InstancesHider allows to show/hide supports on demand
This commit is contained in:
parent
5d4014a4a5
commit
e82ead0335
4 changed files with 33 additions and 6 deletions
|
@ -54,6 +54,9 @@ bool GLGizmoHollow::on_init()
|
||||||
|
|
||||||
void GLGizmoHollow::set_sla_support_data(ModelObject*, const Selection&)
|
void GLGizmoHollow::set_sla_support_data(ModelObject*, const Selection&)
|
||||||
{
|
{
|
||||||
|
if (! m_c->selection_info())
|
||||||
|
return;
|
||||||
|
|
||||||
const ModelObject* mo = m_c->selection_info()->model_object();
|
const ModelObject* mo = m_c->selection_info()->model_object();
|
||||||
if (mo) {
|
if (mo) {
|
||||||
reload_cache();
|
reload_cache();
|
||||||
|
@ -857,11 +860,12 @@ RENDER_AGAIN:
|
||||||
m_c->object_clipper()->set_position(clp_dist, true);
|
m_c->object_clipper()->set_position(clp_dist, true);
|
||||||
|
|
||||||
// make sure supports are shown/hidden as appropriate
|
// make sure supports are shown/hidden as appropriate
|
||||||
// DODELAT
|
bool show_sups = m_c->instances_hider()->are_supports_shown();
|
||||||
//if (m_imgui->checkbox(m_desc["show_supports"], m_show_supports)) {
|
if (m_imgui->checkbox(m_desc["show_supports"], show_sups)) {
|
||||||
// m_parent.toggle_sla_auxiliaries_visibility(m_show_supports, mo, m_c->m_active_instance);
|
// m_parent.toggle_sla_auxiliaries_visibility(m_show_supports, mo, m_c->m_active_instance);
|
||||||
// force_refresh = true;
|
m_c->instances_hider()->show_supports(show_sups);
|
||||||
//}
|
force_refresh = true;
|
||||||
|
}
|
||||||
|
|
||||||
m_imgui->end();
|
m_imgui->end();
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ private:
|
||||||
void hollow_mesh(bool postpone_error_messages = false);
|
void hollow_mesh(bool postpone_error_messages = false);
|
||||||
bool unsaved_changes() const;
|
bool unsaved_changes() const;
|
||||||
|
|
||||||
bool m_show_supports = true;
|
// bool m_show_supports = true;
|
||||||
float m_new_hole_radius = 2.f; // Size of a new hole.
|
float m_new_hole_radius = 2.f; // Size of a new hole.
|
||||||
float m_new_hole_height = 6.f;
|
float m_new_hole_height = 6.f;
|
||||||
mutable std::vector<bool> m_selected; // which holes are currently selected
|
mutable std::vector<bool> m_selected; // which holes are currently selected
|
||||||
|
|
|
@ -48,6 +48,14 @@ SelectionInfo* CommonGizmosDataPool::selection_info() const
|
||||||
return sel_info->is_valid() ? sel_info : nullptr;
|
return sel_info->is_valid() ? sel_info : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InstancesHider* CommonGizmosDataPool::instances_hider() const
|
||||||
|
{
|
||||||
|
InstancesHider* inst_hider = dynamic_cast<InstancesHider*>(m_data.at(CommonGizmosDataID::InstancesHider).get());
|
||||||
|
assert(inst_hider);
|
||||||
|
return inst_hider->is_valid() ? inst_hider : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
HollowedMesh* CommonGizmosDataPool::hollowed_mesh() const
|
HollowedMesh* CommonGizmosDataPool::hollowed_mesh() const
|
||||||
{
|
{
|
||||||
HollowedMesh* hol_mesh = dynamic_cast<HollowedMesh*>(m_data.at(CommonGizmosDataID::HollowedMesh).get());
|
HollowedMesh* hol_mesh = dynamic_cast<HollowedMesh*>(m_data.at(CommonGizmosDataID::HollowedMesh).get());
|
||||||
|
@ -130,6 +138,7 @@ void InstancesHider::on_update()
|
||||||
if (mo && active_inst != -1) {
|
if (mo && active_inst != -1) {
|
||||||
canvas->toggle_model_objects_visibility(false);
|
canvas->toggle_model_objects_visibility(false);
|
||||||
canvas->toggle_model_objects_visibility(true, mo, active_inst);
|
canvas->toggle_model_objects_visibility(true, mo, active_inst);
|
||||||
|
canvas->toggle_sla_auxiliaries_visibility(m_show_supports, mo, active_inst);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
canvas->toggle_model_objects_visibility(true);
|
canvas->toggle_model_objects_visibility(true);
|
||||||
|
@ -140,6 +149,13 @@ void InstancesHider::on_release()
|
||||||
get_pool()->get_canvas()->toggle_model_objects_visibility(true);
|
get_pool()->get_canvas()->toggle_model_objects_visibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InstancesHider::show_supports(bool show) {
|
||||||
|
if (m_show_supports != show) {
|
||||||
|
m_show_supports = show;
|
||||||
|
on_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HollowedMesh::on_update()
|
void HollowedMesh::on_update()
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
|
|
||||||
// Getters for the data that need to be accessed from the gizmos directly.
|
// Getters for the data that need to be accessed from the gizmos directly.
|
||||||
CommonGizmosDataObjects::SelectionInfo* selection_info() const;
|
CommonGizmosDataObjects::SelectionInfo* selection_info() const;
|
||||||
|
CommonGizmosDataObjects::InstancesHider* instances_hider() const;
|
||||||
CommonGizmosDataObjects::HollowedMesh* hollowed_mesh() const;
|
CommonGizmosDataObjects::HollowedMesh* hollowed_mesh() const;
|
||||||
CommonGizmosDataObjects::Raycaster* raycaster() const;
|
CommonGizmosDataObjects::Raycaster* raycaster() const;
|
||||||
CommonGizmosDataObjects::ObjectClipper* object_clipper() const;
|
CommonGizmosDataObjects::ObjectClipper* object_clipper() const;
|
||||||
|
@ -156,9 +157,15 @@ public:
|
||||||
CommonGizmosDataID get_dependencies() const override { return CommonGizmosDataID::SelectionInfo; }
|
CommonGizmosDataID get_dependencies() const override { return CommonGizmosDataID::SelectionInfo; }
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
|
|
||||||
|
void show_supports(bool show);
|
||||||
|
bool are_supports_shown() const { return m_show_supports; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void on_update() override;
|
void on_update() override;
|
||||||
void on_release() override;
|
void on_release() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_show_supports = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue