mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-09 07:56:24 -06:00
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
|
if (keyCode != WXK_TAB
|
||||||
|
|
|
@ -128,6 +128,29 @@ void GLGizmoFdmSupports::render_painter_gizmo() const
|
||||||
glsafe(::glDisable(GL_BLEND));
|
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
|
// BBS
|
||||||
void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
|
void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,9 @@ public:
|
||||||
state_ready
|
state_ready
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//BBS
|
||||||
|
bool on_key_down_select_tool_type(int keyCode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void on_render_input_window(float x, float y, float bottom_limit) override;
|
void on_render_input_window(float x, float y, float bottom_limit) override;
|
||||||
std::string on_get_name() const override;
|
std::string on_get_name() const override;
|
||||||
|
|
|
@ -241,6 +241,34 @@ bool GLGizmoMmuSegmentation::on_number_key_down(int number)
|
||||||
return true;
|
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,
|
static void render_extruders_combo(const std::string &label,
|
||||||
const std::vector<std::string> &extruders,
|
const std::vector<std::string> &extruders,
|
||||||
const std::vector<std::array<float, 4>> &extruders_colors,
|
const std::vector<std::array<float, 4>> &extruders_colors,
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
bool on_number_key_down(int number);
|
bool on_number_key_down(int number);
|
||||||
|
bool on_key_down_select_tool_type(int keyCode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// BBS
|
// BBS
|
||||||
|
|
|
@ -78,6 +78,23 @@ void GLGizmoSeam::render_painter_gizmo() const
|
||||||
glsafe(::glDisable(GL_BLEND));
|
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
|
void GLGizmoSeam::render_triangles(const Selection& selection) const
|
||||||
{
|
{
|
||||||
ClippingPlaneDataWrapper clp_data = this->get_clipping_plane_data();
|
ClippingPlaneDataWrapper clp_data = this->get_clipping_plane_data();
|
||||||
|
|
|
@ -12,6 +12,9 @@ public:
|
||||||
|
|
||||||
void render_painter_gizmo() const override;
|
void render_painter_gizmo() const override;
|
||||||
|
|
||||||
|
//BBS
|
||||||
|
bool on_key_down_select_tool_type(int keyCode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// BBS
|
// BBS
|
||||||
void on_set_state() override;
|
void on_set_state() override;
|
||||||
|
|
|
@ -1182,11 +1182,41 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
||||||
processed = simplify->on_esc_key_down();
|
processed = simplify->on_esc_key_down();
|
||||||
}
|
}
|
||||||
// BBS
|
// BBS
|
||||||
else if (m_current == MmuSegmentation && keyCode > '0' && keyCode <= '9') {
|
else if (m_current == MmuSegmentation) {
|
||||||
GLGizmoMmuSegmentation* mmu_seg = dynamic_cast<GLGizmoMmuSegmentation*>(get_current());
|
GLGizmoMmuSegmentation* mmu_seg = dynamic_cast<GLGizmoMmuSegmentation*>(get_current());
|
||||||
if (mmu_seg != nullptr)
|
if (mmu_seg != nullptr) {
|
||||||
|
if (keyCode > '0' && keyCode <= '9') {
|
||||||
processed = mmu_seg->on_number_key_down(keyCode - '0');
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processed)
|
if (processed)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue