ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS set as default

This commit is contained in:
enricoturri1966 2020-10-22 11:01:30 +02:00
parent 0e04c84879
commit 844ec8447d
5 changed files with 0 additions and 70 deletions

View file

@ -57,11 +57,4 @@
#define ENABLE_GCODE_VIEWER_DATA_CHECKING (0 && ENABLE_GCODE_VIEWER)
//===================
// 2.3.0.alpha2 techs
//===================
#define ENABLE_2_3_0_ALPHA2 1
#define ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS (1 && ENABLE_2_3_0_ALPHA2)
#endif // _prusaslicer_technologies_h_

View file

@ -3542,9 +3542,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
return;
}
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
bool any_gizmo_active = m_gizmos.get_current() != nullptr;
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
int selected_object_idx = m_selection.get_object_idx();
int layer_editing_object_idx = is_layers_editing_enabled() ? selected_object_idx : -1;
@ -3613,19 +3611,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
}
}
else {
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
// Select volume in this 3D canvas.
// Don't deselect a volume if layer editing is enabled or any gizmo is active. We want the object to stay selected
// during the scene manipulation.
if (m_picking_enabled && (!any_gizmo_active || !evt.CmdDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) {
#else
// Select volume in this 3D canvas.
// Don't deselect a volume if layer editing is enabled. We want the object to stay selected
// during the scene manipulation.
if (m_picking_enabled && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) {
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if (evt.LeftDown() && !m_hover_volume_idxs.empty()) {
int volume_idx = get_first_hover_volume_idx();
bool already_selected = m_selection.contains_volume(volume_idx);
@ -3664,11 +3654,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
int volume_idx = get_first_hover_volume_idx();
BoundingBoxf3 volume_bbox = m_volumes.volumes[volume_idx]->transformed_bounding_box();
volume_bbox.offset(1.0);
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if ((!any_gizmo_active || !evt.CmdDown()) && volume_bbox.contains(m_mouse.scene_position)) {
#else
if (volume_bbox.contains(m_mouse.scene_position)) {
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
m_volumes.volumes[volume_idx]->hover = GLVolume::HS_None;
// The dragging operation is initiated.
m_mouse.drag.move_volume_idx = volume_idx;
@ -3739,11 +3725,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
// do not process the dragging if the left mouse was set down in another canvas
else if (evt.LeftIsDown()) {
// if dragging over blank area with left button, rotate
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
#else
if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined()) {
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.);
if (wxGetApp().app_config->get("use_free_camera") == "1")
// Virtual track ball (similar to the 3DConnexion mouse).
@ -3805,11 +3787,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
}
else if (evt.LeftUp() && !m_mouse.ignore_left_up && !m_mouse.dragging && m_hover_volume_idxs.empty() && !is_layers_editing_enabled()) {
// deselect and propagate event through callback
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if (!evt.ShiftDown() && (!any_gizmo_active || !evt.CmdDown()) && m_picking_enabled)
#else
if (!evt.ShiftDown() && m_picking_enabled)
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
deselect_all();
}
else if (evt.RightUp()) {
@ -5215,10 +5193,8 @@ void GLCanvas3D::_picking_pass() const
volume_id = color[0] + (color[1] << 8) + (color[2] << 16);
}
if (0 <= volume_id && volume_id < (int)m_volumes.volumes.size()) {
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
// do not add the volume id if any gizmo is active and CTRL is pressed
if (m_gizmos.get_current_type() == GLGizmosManager::EType::Undefined || !wxGetKeyState(WXK_CONTROL))
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
m_hover_volume_idxs.emplace_back(volume_id);
m_gizmos.set_hover_id(-1);
}

View file

@ -93,11 +93,7 @@ void GLGizmoFlatten::on_render_for_picking() const
glsafe(::glDisable(GL_DEPTH_TEST));
glsafe(::glDisable(GL_BLEND));
#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();
glsafe(::glPushMatrix());
glsafe(::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z()));

View file

@ -504,10 +504,8 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
int selected_object_idx = selection.get_object_idx();
bool processed = false;
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
// when control is down we allow scene pan and rotation even when clicking over some object
bool control_down = evt.CmdDown();
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
// mouse anywhere
if (evt.Moving())
@ -590,11 +588,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
if (evt.AltDown())
transformation_type.set_independent();
selection.scale(get_scale(), transformation_type);
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if (control_down)
#else
if (evt.ControlDown())
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
selection.translate(get_scale_offset(), true);
wxGetApp().obj_manipul()->set_dirty();
break;
@ -621,17 +615,9 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
// mouse is outside the toolbar
m_tooltip = "";
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if (evt.LeftDown() && (!control_down || grabber_contains_mouse())) {
#else
if (evt.LeftDown()) {
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
if ((m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam)
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
&& gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown()))
#else
&& gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
// the gizmo got the event and took some action, there is no need to do anything more
processed = true;
else if (!selection.is_empty() && grabber_contains_mouse()) {
@ -656,11 +642,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
// event was taken care of by the SlaSupports gizmo
processed = true;
}
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
else if (evt.RightDown() && !control_down && selected_object_idx != -1 && (m_current == FdmSupports || m_current == Seam)
#else
else if (evt.RightDown() && (selected_object_idx != -1) && (m_current == FdmSupports || m_current == Seam)
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos)) {
// event was taken care of by the FdmSupports / Seam gizmo
processed = true;
@ -669,18 +651,12 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
&& (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam))
// don't allow dragging objects with the Sla gizmo on
processed = true;
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
else if (evt.Dragging() && !control_down && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam)
&& gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown())) {
#else
else if (evt.Dragging() && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam)
&& gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown())) {
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
// the gizmo got the event and took some action, no need to do anything more here
m_parent.set_as_dirty();
processed = true;
}
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
else if (evt.Dragging() && control_down && (evt.LeftIsDown() || evt.RightIsDown())) {
// CTRL has been pressed while already dragging -> stop current action
if (evt.LeftIsDown())
@ -688,15 +664,10 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
else if (evt.RightIsDown())
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), true);
}
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
else if (evt.LeftUp() && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam) && !m_parent.is_mouse_dragging()) {
// in case SLA/FDM gizmo is selected, we just pass the LeftUp event and stop processing - neither
// object moving or selecting is suppressed in that case
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
#else
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
processed = true;
}
else if (evt.LeftUp() && m_current == Flatten && m_gizmos[m_current]->get_hover_id() != -1) {
@ -704,11 +675,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
processed = true;
}
else if (evt.RightUp() && (m_current == FdmSupports || m_current == Seam) && !m_parent.is_mouse_dragging()) {
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
#else
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
processed = true;
}
}

View file

@ -190,9 +190,7 @@ void KBShortcutsDialog::fill_shortcuts()
m_full_shortcuts.push_back(std::make_pair(_L("Plater"), plater_shortcuts));
Shortcuts gizmos_shortcuts = {
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
{ ctrl, L("All gizmos: Press to rotate view with mouse left or to pan view with mouse right") },
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
{ "Shift+", L("Gizmo move: Press to snap by 1mm") },
{ "Shift+", L("Gizmo scale: Press to snap by 5%") },
{ "F", L("Gizmo scale: Scale selection to fit print volume") },