FDM supports gizmo - use right mouse to place support blockers
This commit is contained in:
parent
55c87886fa
commit
4d8e6538e8
@ -41,7 +41,7 @@ bool GLGizmoFdmSupports::on_init()
|
||||
m_desc["cursor_size"] = _L("Cursor size") + ": ";
|
||||
m_desc["enforce_caption"] = _L("Left mouse button") + ": ";
|
||||
m_desc["enforce"] = _L("Enforce supports");
|
||||
m_desc["block_caption"] = _L("Alt + Left mouse button") + " ";
|
||||
m_desc["block_caption"] = _L("Right mouse button") + " ";
|
||||
m_desc["block"] = _L("Block supports");
|
||||
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
||||
m_desc["remove"] = _L("Remove selection");
|
||||
@ -240,8 +240,18 @@ bool GLGizmoFdmSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == SLAGizmoEventType::LeftDown || (action == SLAGizmoEventType::Dragging && m_wait_for_up_event)) {
|
||||
int8_t new_state = shift_down ? 0 : (alt_down ? -1 : 1);
|
||||
if (action == SLAGizmoEventType::LeftDown
|
||||
|| action == SLAGizmoEventType::RightDown
|
||||
|| (action == SLAGizmoEventType::Dragging && m_button_down != Button::None)) {
|
||||
|
||||
int8_t new_state = 0;
|
||||
if (! shift_down) {
|
||||
if (action == SLAGizmoEventType::Dragging)
|
||||
new_state = m_button_down == Button::Left ? 1 : -1;
|
||||
else
|
||||
new_state = action == SLAGizmoEventType::LeftDown ? 1 : -1;
|
||||
}
|
||||
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
const ModelObject* mo = m_c->selection_info()->model_object();
|
||||
@ -368,16 +378,18 @@ bool GLGizmoFdmSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
||||
|
||||
if (some_mesh_was_hit)
|
||||
{
|
||||
m_wait_for_up_event = true;
|
||||
if (m_button_down == Button::None)
|
||||
m_button_down = ((action == SLAGizmoEventType::LeftDown) ? Button::Left : Button::Right);
|
||||
m_parent.set_as_dirty();
|
||||
return true;
|
||||
}
|
||||
if (action == SLAGizmoEventType::Dragging && m_wait_for_up_event)
|
||||
if (action == SLAGizmoEventType::Dragging && m_button_down != Button::None)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == SLAGizmoEventType::LeftUp && m_wait_for_up_event) {
|
||||
m_wait_for_up_event = false;
|
||||
if ((action == SLAGizmoEventType::LeftUp || action == SLAGizmoEventType::RightUp)
|
||||
&& m_button_down != Button::None) {
|
||||
m_button_down = Button::None;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,13 @@ private:
|
||||
// etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect.
|
||||
std::map<std::string, wxString> m_desc;
|
||||
|
||||
bool m_wait_for_up_event = false;
|
||||
enum class Button {
|
||||
None,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
Button m_button_down = Button::None;
|
||||
EState m_old_state = Off; // to be able to see that the gizmo has just been closed (see on_set_state)
|
||||
|
||||
std::vector<std::vector<NeighborData>> m_neighbors; // pairs of vertex_index - facet_index for each mesh
|
||||
|
@ -21,6 +21,7 @@ enum class SLAGizmoEventType : unsigned char {
|
||||
LeftDown = 1,
|
||||
LeftUp,
|
||||
RightDown,
|
||||
RightUp,
|
||||
Dragging,
|
||||
Delete,
|
||||
SelectAll,
|
||||
|
@ -558,8 +558,8 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||
processed = true;
|
||||
m_mouse_capture.right = false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
// else
|
||||
// return false;
|
||||
}
|
||||
#if ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX
|
||||
else if (evt.Dragging() && !is_dragging())
|
||||
@ -666,13 +666,20 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
else if (evt.RightDown() && (selected_object_idx != -1) && (m_current == SlaSupports || m_current == Hollow) && gizmo_event(SLAGizmoEventType::RightDown))
|
||||
else if (evt.RightDown() && (selected_object_idx != -1) && (m_current == SlaSupports || m_current == Hollow)
|
||||
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos))
|
||||
{
|
||||
// we need to set the following right up as processed to avoid showing the context menu if the user release the mouse over the object
|
||||
pending_right_up = true;
|
||||
// event was taken care of by the SlaSupports gizmo
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.RightDown() && (selected_object_idx != -1) && m_current == FdmSupports
|
||||
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos))
|
||||
{
|
||||
// event was taken care of by the FdmSupports gizmo
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.Dragging() && (m_parent.get_move_volume_id() != -1) && (m_current == SlaSupports || m_current == Hollow))
|
||||
// don't allow dragging objects with the Sla gizmo on
|
||||
processed = true;
|
||||
@ -766,6 +773,11 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||
// to avoid to loose the selection when user clicks an the white faces of a different object while the Flatten gizmo is active
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.RightUp() && m_current == FdmSupports && !m_parent.is_mouse_dragging())
|
||||
{
|
||||
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user