Follow-up of 68a7e5ce41
-> Disable GLGizmoFlatten markers when CTRL is pressed
This commit is contained in:
parent
7cf350d0bc
commit
d31da5bbe0
@ -28,7 +28,6 @@ bool GLGizmoFlatten::on_init()
|
|||||||
|
|
||||||
void GLGizmoFlatten::on_set_state()
|
void GLGizmoFlatten::on_set_state()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonGizmosDataID GLGizmoFlatten::on_get_requirements() const
|
CommonGizmosDataID GLGizmoFlatten::on_get_requirements() const
|
||||||
@ -38,7 +37,7 @@ CommonGizmosDataID GLGizmoFlatten::on_get_requirements() const
|
|||||||
|
|
||||||
std::string GLGizmoFlatten::on_get_name() const
|
std::string GLGizmoFlatten::on_get_name() const
|
||||||
{
|
{
|
||||||
return (_(L("Place on face")) + " [F]").ToUTF8().data();
|
return (_L("Place on face") + " [F]").ToUTF8().data();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLGizmoFlatten::on_is_activable() const
|
bool GLGizmoFlatten::on_is_activable() const
|
||||||
@ -48,8 +47,7 @@ bool GLGizmoFlatten::on_is_activable() const
|
|||||||
|
|
||||||
void GLGizmoFlatten::on_start_dragging()
|
void GLGizmoFlatten::on_start_dragging()
|
||||||
{
|
{
|
||||||
if (m_hover_id != -1)
|
if (m_hover_id != -1) {
|
||||||
{
|
|
||||||
assert(m_planes_valid);
|
assert(m_planes_valid);
|
||||||
m_normal = m_planes[m_hover_id].normal;
|
m_normal = m_planes[m_hover_id].normal;
|
||||||
m_starting_center = m_parent.get_selection().get_bounding_box().center();
|
m_starting_center = m_parent.get_selection().get_bounding_box().center();
|
||||||
@ -65,16 +63,14 @@ void GLGizmoFlatten::on_render() const
|
|||||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||||
glsafe(::glEnable(GL_BLEND));
|
glsafe(::glEnable(GL_BLEND));
|
||||||
|
|
||||||
if (selection.is_single_full_instance())
|
if (selection.is_single_full_instance()) {
|
||||||
{
|
|
||||||
const Transform3d& m = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix();
|
const Transform3d& m = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix();
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z()));
|
glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z()));
|
||||||
glsafe(::glMultMatrixd(m.data()));
|
glsafe(::glMultMatrixd(m.data()));
|
||||||
if (this->is_plane_update_necessary())
|
if (this->is_plane_update_necessary())
|
||||||
const_cast<GLGizmoFlatten*>(this)->update_planes();
|
const_cast<GLGizmoFlatten*>(this)->update_planes();
|
||||||
for (int i = 0; i < (int)m_planes.size(); ++i)
|
for (int i = 0; i < (int)m_planes.size(); ++i) {
|
||||||
{
|
|
||||||
if (i == m_hover_id)
|
if (i == m_hover_id)
|
||||||
glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.75f));
|
glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.75f));
|
||||||
else
|
else
|
||||||
@ -97,16 +93,18 @@ void GLGizmoFlatten::on_render_for_picking() const
|
|||||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||||
glsafe(::glDisable(GL_BLEND));
|
glsafe(::glDisable(GL_BLEND));
|
||||||
|
|
||||||
if (selection.is_single_full_instance())
|
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||||
{
|
if (selection.is_single_full_instance() && !wxGetKeyState(WXK_CONTROL)) {
|
||||||
|
#else
|
||||||
|
if (selection.is_single_full_instance()) {
|
||||||
|
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||||
const Transform3d& m = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix();
|
const Transform3d& m = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix();
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z()));
|
glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z()));
|
||||||
glsafe(::glMultMatrixd(m.data()));
|
glsafe(::glMultMatrixd(m.data()));
|
||||||
if (this->is_plane_update_necessary())
|
if (this->is_plane_update_necessary())
|
||||||
const_cast<GLGizmoFlatten*>(this)->update_planes();
|
const_cast<GLGizmoFlatten*>(this)->update_planes();
|
||||||
for (int i = 0; i < (int)m_planes.size(); ++i)
|
for (int i = 0; i < (int)m_planes.size(); ++i) {
|
||||||
{
|
|
||||||
glsafe(::glColor4fv(picking_color_component(i).data()));
|
glsafe(::glColor4fv(picking_color_component(i).data()));
|
||||||
m_planes[i].vbo.render();
|
m_planes[i].vbo.render();
|
||||||
}
|
}
|
||||||
@ -129,8 +127,7 @@ void GLGizmoFlatten::update_planes()
|
|||||||
{
|
{
|
||||||
const ModelObject* mo = m_c->selection_info()->model_object();
|
const ModelObject* mo = m_c->selection_info()->model_object();
|
||||||
TriangleMesh ch;
|
TriangleMesh ch;
|
||||||
for (const ModelVolume* vol : mo->volumes)
|
for (const ModelVolume* vol : mo->volumes) {
|
||||||
{
|
|
||||||
if (vol->type() != ModelVolumeType::MODEL_PART)
|
if (vol->type() != ModelVolumeType::MODEL_PART)
|
||||||
continue;
|
continue;
|
||||||
TriangleMesh vol_ch = vol->get_convex_hull();
|
TriangleMesh vol_ch = vol->get_convex_hull();
|
||||||
|
Loading…
Reference in New Issue
Block a user