mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 04:15:52 +08:00
Fix crash when double click on wipe tower
Add option to open embos gizmo by doubleclick when move scale rotate or emboss + fix demo opening
This commit is contained in:
parent
d6add81319
commit
0e01e6af72
@ -2651,7 +2651,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||||||
|
|
||||||
#ifdef SHOW_IMGUI_DEMO_WINDOW
|
#ifdef SHOW_IMGUI_DEMO_WINDOW
|
||||||
static int cur = 0;
|
static int cur = 0;
|
||||||
if (wxString("demo")[cur] = evt.GetUnicodeKey()) ++cur; else cur = 0;
|
if (wxString("demo")[cur] == evt.GetUnicodeKey()) ++cur; else cur = 0;
|
||||||
if (cur == 4) { show_imgui_demo_window = !show_imgui_demo_window; cur = 0;}
|
if (cur == 4) { show_imgui_demo_window = !show_imgui_demo_window; cur = 0;}
|
||||||
#endif // SHOW_IMGUI_DEMO_WINDOW
|
#endif // SHOW_IMGUI_DEMO_WINDOW
|
||||||
|
|
||||||
@ -3740,20 +3740,27 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
evt.Skip();
|
evt.Skip();
|
||||||
|
|
||||||
// Detection of doubleclick on text to open emboss edit window
|
// Detection of doubleclick on text to open emboss edit window
|
||||||
if (evt.LeftDClick() && m_gizmos.get_current() == nullptr && !m_hover_volume_idxs.empty()) {
|
auto type = m_gizmos.get_current_type();
|
||||||
|
if (evt.LeftDClick() && !m_hover_volume_idxs.empty() &&
|
||||||
|
(type == GLGizmosManager::EType::Undefined ||
|
||||||
|
type == GLGizmosManager::EType::Move ||
|
||||||
|
type == GLGizmosManager::EType::Rotate ||
|
||||||
|
type == GLGizmosManager::EType::Scale ||
|
||||||
|
type == GLGizmosManager::EType::Emboss) ) {
|
||||||
for (int hover_volume_id : m_hover_volume_idxs) {
|
for (int hover_volume_id : m_hover_volume_idxs) {
|
||||||
const GLVolume &hover_gl_volume = *m_volumes.volumes[hover_volume_id];
|
const GLVolume &hover_gl_volume = *m_volumes.volumes[hover_volume_id];
|
||||||
const ModelObject* hover_object = m_model->objects[hover_gl_volume.object_idx()];
|
int object_idx = hover_gl_volume.object_idx();
|
||||||
|
if (object_idx < 0 || object_idx >= m_model->objects.size()) continue;
|
||||||
|
const ModelObject* hover_object = m_model->objects[object_idx];
|
||||||
int hover_volume_idx = hover_gl_volume.volume_idx();
|
int hover_volume_idx = hover_gl_volume.volume_idx();
|
||||||
|
if (hover_volume_idx < 0 || hover_volume_idx >= hover_object->volumes.size()) continue;
|
||||||
const ModelVolume* hover_volume = hover_object->volumes[hover_volume_idx];
|
const ModelVolume* hover_volume = hover_object->volumes[hover_volume_idx];
|
||||||
if (hover_volume->text_configuration.has_value()) {
|
if (!hover_volume->text_configuration.has_value()) continue;
|
||||||
//m_selection.set_mode(Selection::EMode::Volume);
|
m_selection.add_volumes(Selection::EMode::Volume, {(unsigned) hover_volume_id});
|
||||||
//m_selection.add(hover_volume_id); // add whole instance
|
if (type != GLGizmosManager::EType::Emboss)
|
||||||
m_selection.add_volumes(Selection::EMode::Volume, {(unsigned) hover_volume_id});
|
|
||||||
m_gizmos.open_gizmo(GLGizmosManager::EType::Emboss);
|
m_gizmos.open_gizmo(GLGizmosManager::EType::Emboss);
|
||||||
wxGetApp().obj_list()->update_selections();
|
wxGetApp().obj_list()->update_selections();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user