ENH:add some shortcut of gizmo
Change-Id: Ie639483663f5fa9fe3cd597fb279d95474969408
This commit is contained in:
parent
e9c443fcd7
commit
aac9bfd593
8 changed files with 109 additions and 3 deletions
|
@ -3475,6 +3475,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
|||
}
|
||||
}
|
||||
}
|
||||
else return;
|
||||
}
|
||||
|
||||
if (keyCode != WXK_TAB
|
||||
|
|
|
@ -128,6 +128,29 @@ void GLGizmoFdmSupports::render_painter_gizmo() const
|
|||
glsafe(::glDisable(GL_BLEND));
|
||||
}
|
||||
|
||||
// BBS
|
||||
bool GLGizmoFdmSupports::on_key_down_select_tool_type(int keyCode) {
|
||||
switch (keyCode)
|
||||
{
|
||||
case 'F':
|
||||
m_current_tool = ImGui::FillButtonIcon;
|
||||
break;
|
||||
case 'S':
|
||||
m_current_tool = ImGui::SphereButtonIcon;
|
||||
break;
|
||||
case 'C':
|
||||
m_current_tool = ImGui::CircleButtonIcon;
|
||||
break;
|
||||
case 'G':
|
||||
m_current_tool = ImGui::GapFillIcon;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// BBS
|
||||
void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
|
||||
{
|
||||
|
|
|
@ -24,6 +24,9 @@ public:
|
|||
state_ready
|
||||
};
|
||||
|
||||
//BBS
|
||||
bool on_key_down_select_tool_type(int keyCode);
|
||||
|
||||
protected:
|
||||
void on_render_input_window(float x, float y, float bottom_limit) override;
|
||||
std::string on_get_name() const override;
|
||||
|
|
|
@ -241,6 +241,34 @@ bool GLGizmoMmuSegmentation::on_number_key_down(int number)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GLGizmoMmuSegmentation::on_key_down_select_tool_type(int keyCode) {
|
||||
switch (keyCode)
|
||||
{
|
||||
case 'F':
|
||||
m_current_tool = ImGui::FillButtonIcon;
|
||||
break;
|
||||
case 'T':
|
||||
m_current_tool = ImGui::TriangleButtonIcon;
|
||||
break;
|
||||
case 'S':
|
||||
m_current_tool = ImGui::SphereButtonIcon;
|
||||
break;
|
||||
case 'C':
|
||||
m_current_tool = ImGui::CircleButtonIcon;
|
||||
break;
|
||||
case 'H':
|
||||
m_current_tool = ImGui::HeightRangeIcon;
|
||||
break;
|
||||
case 'G':
|
||||
m_current_tool = ImGui::GapFillIcon;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void render_extruders_combo(const std::string &label,
|
||||
const std::vector<std::string> &extruders,
|
||||
const std::vector<std::array<float, 4>> &extruders_colors,
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
|
||||
// BBS
|
||||
bool on_number_key_down(int number);
|
||||
bool on_key_down_select_tool_type(int keyCode);
|
||||
|
||||
protected:
|
||||
// BBS
|
||||
|
|
|
@ -78,6 +78,23 @@ void GLGizmoSeam::render_painter_gizmo() const
|
|||
glsafe(::glDisable(GL_BLEND));
|
||||
}
|
||||
|
||||
// BBS
|
||||
bool GLGizmoSeam::on_key_down_select_tool_type(int keyCode) {
|
||||
switch (keyCode)
|
||||
{
|
||||
case 'S':
|
||||
m_current_tool = ImGui::SphereButtonIcon;
|
||||
break;
|
||||
case 'C':
|
||||
m_current_tool = ImGui::CircleButtonIcon;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void GLGizmoSeam::render_triangles(const Selection& selection) const
|
||||
{
|
||||
ClippingPlaneDataWrapper clp_data = this->get_clipping_plane_data();
|
||||
|
|
|
@ -12,6 +12,9 @@ public:
|
|||
|
||||
void render_painter_gizmo() const override;
|
||||
|
||||
//BBS
|
||||
bool on_key_down_select_tool_type(int keyCode);
|
||||
|
||||
protected:
|
||||
// BBS
|
||||
void on_set_state() override;
|
||||
|
|
|
@ -1182,10 +1182,40 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
|||
processed = simplify->on_esc_key_down();
|
||||
}
|
||||
// BBS
|
||||
else if (m_current == MmuSegmentation && keyCode > '0' && keyCode <= '9') {
|
||||
else if (m_current == MmuSegmentation) {
|
||||
GLGizmoMmuSegmentation* mmu_seg = dynamic_cast<GLGizmoMmuSegmentation*>(get_current());
|
||||
if (mmu_seg != nullptr)
|
||||
processed = mmu_seg->on_number_key_down(keyCode - '0');
|
||||
if (mmu_seg != nullptr) {
|
||||
if (keyCode > '0' && keyCode <= '9') {
|
||||
processed = mmu_seg->on_number_key_down(keyCode - '0');
|
||||
}
|
||||
else if (keyCode == 'F' || keyCode == 'T' || keyCode == 'S' || keyCode == 'C' || keyCode == 'H' || keyCode == 'G') {
|
||||
processed = mmu_seg->on_key_down_select_tool_type(keyCode);
|
||||
if (processed) {
|
||||
// force extra frame to automatically update window size
|
||||
wxGetApp().imgui()->set_requires_extra_frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_current == FdmSupports) {
|
||||
GLGizmoFdmSupports* fdm_support = dynamic_cast<GLGizmoFdmSupports*>(get_current());
|
||||
if (fdm_support != nullptr && keyCode == 'F' || keyCode == 'S' || keyCode == 'C' || keyCode == 'G') {
|
||||
processed = fdm_support->on_key_down_select_tool_type(keyCode);
|
||||
}
|
||||
if (processed) {
|
||||
// force extra frame to automatically update window size
|
||||
wxGetApp().imgui()->set_requires_extra_frame();
|
||||
}
|
||||
}
|
||||
else if (m_current == Seam) {
|
||||
GLGizmoSeam* seam = dynamic_cast<GLGizmoSeam*>(get_current());
|
||||
if (seam != nullptr && keyCode == 'S' || keyCode == 'C') {
|
||||
processed = seam->on_key_down_select_tool_type(keyCode);
|
||||
}
|
||||
if (processed) {
|
||||
// force extra frame to automatically update window size
|
||||
wxGetApp().imgui()->set_requires_extra_frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue