ENH:Gizmo click on blank space without exit
Jira: STUDIO-6350 Change-Id: Iad8cfaca1b90fd64f7fa6b1aa5632f6eaecabbdc
This commit is contained in:
parent
d9d95294d3
commit
c3d50c362a
|
@ -4353,6 +4353,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
// Let the plater know that the dragging finished, so a delayed refresh
|
||||
// of the scene with the background processing data should be performed.
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED));
|
||||
} else if (evt.LeftUp() && m_hover_volume_idxs.empty() && m_gizmos.is_gizmo_click_empty_not_exit()) {
|
||||
// Click on blank and not exit the gizmo tool
|
||||
}
|
||||
else if (evt.LeftUp() && m_picking_enabled && m_rectangle_selection.is_dragging() && m_layers_editing.state != LayersEditing::Editing) {
|
||||
//BBS: don't use alt as de-select
|
||||
|
@ -7840,7 +7842,7 @@ void GLCanvas3D::_render_assemble_view_toolbar() const
|
|||
m_assemble_view_toolbar.render(*this);
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_return_toolbar() const
|
||||
void GLCanvas3D::_render_return_toolbar()
|
||||
{
|
||||
if (!m_return_toolbar.is_enabled())
|
||||
return;
|
||||
|
@ -7884,33 +7886,34 @@ void GLCanvas3D::_render_return_toolbar() const
|
|||
ImVec2 margin = ImVec2(10.0f, 5.0f);
|
||||
|
||||
if (ImGui::ImageTextButton(real_size,_utf8(L("return")).c_str(), m_return_toolbar.get_return_texture_id(), button_icon_size, uv0, uv1, -1, bg_col, tint_col, margin)) {
|
||||
if (m_canvas != nullptr)
|
||||
wxPostEvent(m_canvas, SimpleEvent(EVT_GLVIEWTOOLBAR_3D));
|
||||
const_cast<GLGizmosManager*>(&m_gizmos)->reset_all_states();
|
||||
wxGetApp().plater()->get_view3D_canvas3D()->get_gizmos_manager().reset_all_states();
|
||||
{
|
||||
GLCanvas3D* view_3d = wxGetApp().plater()->get_view3D_canvas3D();
|
||||
GLToolbarItem* assembly_item = view_3d->m_assemble_view_toolbar.get_item("assembly_view");
|
||||
std::chrono::system_clock::time_point end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<int> duration = std::chrono::duration_cast<std::chrono::duration<int>>(end - assembly_item->get_start_time_point());
|
||||
int times = duration.count();
|
||||
if (m_canvas_type == ECanvasType::CanvasView3D) {
|
||||
deselect_all();
|
||||
} else if (m_canvas_type == ECanvasType::CanvasAssembleView) {
|
||||
if (m_canvas != nullptr)
|
||||
wxPostEvent(m_canvas, SimpleEvent(EVT_GLVIEWTOOLBAR_3D));
|
||||
const_cast<GLGizmosManager *>(&m_gizmos)->reset_all_states();
|
||||
wxGetApp().plater()->get_view3D_canvas3D()->get_gizmos_manager().reset_all_states();
|
||||
{
|
||||
GLCanvas3D * view_3d = wxGetApp().plater()->get_view3D_canvas3D();
|
||||
GLToolbarItem * assembly_item = view_3d->m_assemble_view_toolbar.get_item("assembly_view");
|
||||
std::chrono::system_clock::time_point end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<int> duration = std::chrono::duration_cast<std::chrono::duration<int>>(end - assembly_item->get_start_time_point());
|
||||
int times = duration.count();
|
||||
|
||||
NetworkAgent* agent = GUI::wxGetApp().getAgent();
|
||||
if (agent) {
|
||||
std::string name = assembly_item->get_name() + "_duration";
|
||||
std::string value = "";
|
||||
int existing_time = 0;
|
||||
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||
if (agent) {
|
||||
std::string name = assembly_item->get_name() + "_duration";
|
||||
std::string value = "";
|
||||
int existing_time = 0;
|
||||
|
||||
agent->track_get_property(name, value);
|
||||
try {
|
||||
if (value != "") {
|
||||
existing_time = std::stoi(value);
|
||||
}
|
||||
agent->track_get_property(name, value);
|
||||
try {
|
||||
if (value != "") { existing_time = std::stoi(value); }
|
||||
} catch (...) {}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " tool name:" << name << " duration: " << times + existing_time;
|
||||
agent->track_update_property(name, std::to_string(times + existing_time));
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " tool name:" << name << " duration: " << times + existing_time;
|
||||
agent->track_update_property(name, std::to_string(times + existing_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1115,7 +1115,7 @@ private:
|
|||
void _render_main_toolbar();
|
||||
void _render_imgui_select_plate_toolbar();
|
||||
void _render_assemble_view_toolbar() const;
|
||||
void _render_return_toolbar() const;
|
||||
void _render_return_toolbar();
|
||||
void _render_separator_toolbar_right() const;
|
||||
void _render_separator_toolbar_left() const;
|
||||
void _render_collapse_toolbar() const;
|
||||
|
|
|
@ -75,6 +75,7 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig
|
|||
m_canvas->enable_gizmos(true);
|
||||
m_canvas->enable_selection(true);
|
||||
m_canvas->enable_main_toolbar(true);
|
||||
m_canvas->enable_return_toolbar(true);
|
||||
//BBS: GUI refactor: GLToolbar
|
||||
m_canvas->enable_select_plate_toolbar(false);
|
||||
m_canvas->enable_assemble_view_toolbar(true);
|
||||
|
|
|
@ -242,7 +242,7 @@ void GLGizmoBase::set_state(EState state)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_parent.enable_return_toolbar(state == On);
|
||||
m_state = state;
|
||||
on_set_state();
|
||||
}
|
||||
|
|
|
@ -647,6 +647,19 @@ bool GLGizmosManager::is_gizmo_activable_when_single_full_instance() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GLGizmosManager::is_gizmo_click_empty_not_exit()
|
||||
{
|
||||
if (get_current_type() == GLGizmosManager::EType::Cut ||
|
||||
get_current_type() == GLGizmosManager::EType::MeshBoolean ||
|
||||
get_current_type() == GLGizmosManager::EType::Seam ||
|
||||
get_current_type() == GLGizmosManager::EType::FdmSupports ||
|
||||
get_current_type() == GLGizmosManager::EType::MmuSegmentation ||
|
||||
get_current_type() == GLGizmosManager::EType::Measure) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true if the gizmo used the event to do something, false otherwise.
|
||||
bool GLGizmosManager::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down)
|
||||
{
|
||||
|
|
|
@ -76,6 +76,7 @@ public:
|
|||
// BBS
|
||||
Text,
|
||||
MmuSegmentation,
|
||||
Measure,
|
||||
Simplify,
|
||||
SlaSupports,
|
||||
// BBS
|
||||
|
@ -281,6 +282,7 @@ public:
|
|||
void set_painter_gizmo_data();
|
||||
|
||||
bool is_gizmo_activable_when_single_full_instance();
|
||||
bool is_gizmo_click_empty_not_exit();
|
||||
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position = Vec2d::Zero(), bool shift_down = false, bool alt_down = false, bool control_down = false);
|
||||
ClippingPlane get_clipping_plane() const;
|
||||
ClippingPlane get_assemble_view_clipping_plane() const;
|
||||
|
|
Loading…
Reference in New Issue