Fixed cut gizmo and SLA shift

This commit is contained in:
Lukas Matena 2023-01-26 23:24:54 +01:00
parent 73eba8c930
commit fe39af7d7b
4 changed files with 20 additions and 3 deletions

View File

@ -932,7 +932,7 @@ void WipeTower::toolchange_Unload(
// this is to align ramming and future wiping extrusions, so the future y-steps can be uniform from the start:
// the perimeter_width will later be subtracted, it is there to not load while moving over just extruded material
Vec2f pos = Vec2f(end_of_ramming.x(), end_of_ramming.y() + (y_step/m_extra_spacing-m_perimeter_width) / 2.f + m_perimeter_width);
if (m_semm)
if (m_semm)
writer.travel(pos, 2400.f);
else
writer.set_position(pos);

View File

@ -85,6 +85,12 @@ void GLGizmoHollow::on_render()
return;
}
if (m_state == On) {
// This gizmo is showing the object elevated. Tell the common
// SelectionInfo object to lie about the actual shift.
m_c->selection_info()->set_use_shift(true);
}
glsafe(::glEnable(GL_BLEND));
glsafe(::glEnable(GL_DEPTH_TEST));
@ -828,6 +834,7 @@ void GLGizmoHollow::on_set_state()
// the gizmo was just turned Off
m_parent.post_event(SimpleEvent(EVT_GLCANVAS_FORCE_UPDATE));
m_c->instances_hider()->set_hide_full_scene(false);
m_c->selection_info()->set_use_shift(false); // see top of on_render for details
}
m_old_state = m_state;

View File

@ -87,6 +87,12 @@ void GLGizmoSlaSupports::data_changed()
void GLGizmoSlaSupports::on_render()
{
if (m_state == On) {
// This gizmo is showing the object elevated. Tell the common
// SelectionInfo object to lie about the actual shift.
m_c->selection_info()->set_use_shift(true);
}
if (!m_sphere.model.is_initialized()) {
indexed_triangle_set its = its_make_sphere(1.0, double(PI) / 12.0);
m_sphere.model.init_from(its);
@ -836,8 +842,10 @@ void GLGizmoSlaSupports::on_set_state()
m_old_mo_id = -1;
}
if (m_state == Off)
if (m_state == Off) {
m_c->instances_hider()->set_hide_full_scene(false);
m_c->selection_info()->set_use_shift(true); // see top of on_render for details
}
}
m_old_state = m_state;
}

View File

@ -163,7 +163,8 @@ public:
ModelVolume* model_volume() const { return m_model_volume; }
ModelInstance *model_instance() const;
int get_active_instance() const;
float get_sla_shift() const { return m_z_shift; }
float get_sla_shift() const { return m_use_shift ? m_z_shift : 0.f; }
void set_use_shift(bool use) { m_use_shift = use; }
protected:
void on_update() override;
@ -175,6 +176,7 @@ private:
ModelVolume* m_model_volume = nullptr;
// int m_active_inst = -1;
float m_z_shift = 0.f;
bool m_use_shift = false;
};