mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 21:58:03 -06:00
ENH: refine gizmo paint tools
1. support to adjust cursor size and section view by key + mouse wheel 2. display shortcut tips according to the selected tool type 3. change the left mouse behavior to object movement for color painting tool Signed-off-by: yifan.wu <yifan.wu@bambulab.com> Change-Id: I13d2a83d562d6ccd8d915158e263a90ad3c02db0
This commit is contained in:
parent
d38c5b07fa
commit
f3c65f8597
8 changed files with 129 additions and 50 deletions
|
@ -438,7 +438,7 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
|
||||||
|
|
||||||
// Rotation input box
|
// Rotation input box
|
||||||
ImGui::PushItemWidth(caption_size);
|
ImGui::PushItemWidth(caption_size);
|
||||||
m_imgui->text(_L("Rotation:"));
|
m_imgui->text(_L("Rotation") + " ");
|
||||||
ImGui::SameLine(caption_size + 1 * space_size);
|
ImGui::SameLine(caption_size + 1 * space_size);
|
||||||
ImGui::PushItemWidth(unit_size);
|
ImGui::PushItemWidth(unit_size);
|
||||||
ImGui::BBLInputDouble("##cut_rotation_x", &rotation[0], 0.0f, 0.0f, "%.2f");
|
ImGui::BBLInputDouble("##cut_rotation_x", &rotation[0], 0.0f, 0.0f, "%.2f");
|
||||||
|
@ -471,7 +471,7 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
|
||||||
double movement = m_movement;
|
double movement = m_movement;
|
||||||
ImGui::PushItemWidth(caption_size);
|
ImGui::PushItemWidth(caption_size);
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(_L("Movement:"));
|
m_imgui->text(_L("Movement") + " ");
|
||||||
ImGui::SameLine(caption_size + 1 * space_size);
|
ImGui::SameLine(caption_size + 1 * space_size);
|
||||||
ImGui::PushItemWidth(3 * unit_size + 2 * space_size);
|
ImGui::PushItemWidth(3 * unit_size + 2 * space_size);
|
||||||
ImGui::BBLInputDouble("##cut_movement", &movement, 0.0f, 0.0f, "%.2f");
|
ImGui::BBLInputDouble("##cut_movement", &movement, 0.0f, 0.0f, "%.2f");
|
||||||
|
@ -497,7 +497,7 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
|
||||||
double height = m_height;
|
double height = m_height;
|
||||||
ImGui::PushItemWidth(caption_size);
|
ImGui::PushItemWidth(caption_size);
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(_L("Height:"));
|
m_imgui->text(_L("Height") + " ");
|
||||||
ImGui::SameLine(caption_size + 1 * space_size);
|
ImGui::SameLine(caption_size + 1 * space_size);
|
||||||
ImGui::PushItemWidth(3 * unit_size + 2 * space_size);
|
ImGui::PushItemWidth(3 * unit_size + 2 * space_size);
|
||||||
ImGui::BBLInputDouble("##cut_height", &height, 0.0f, 0.0f, "%.2f");
|
ImGui::BBLInputDouble("##cut_height", &height, 0.0f, 0.0f, "%.2f");
|
||||||
|
|
|
@ -79,23 +79,25 @@ bool GLGizmoFdmSupports::on_init()
|
||||||
// BBS
|
// BBS
|
||||||
m_shortcut_key = WXK_CONTROL_L;
|
m_shortcut_key = WXK_CONTROL_L;
|
||||||
|
|
||||||
m_desc["clipping_of_view"] = _L("Section view") + ": ";
|
m_desc["clipping_of_view_caption"] = _L("Alt + Mouse wheel");
|
||||||
m_desc["cursor_size"] = _L("Pen size") + ": ";
|
m_desc["clipping_of_view"] = _L("Section view");
|
||||||
m_desc["enforce_caption"] = _L("Left mouse button") + ": ";
|
m_desc["cursor_size_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
|
m_desc["cursor_size"] = _L("Pen size");
|
||||||
|
m_desc["enforce_caption"] = _L("Left mouse button");
|
||||||
m_desc["enforce"] = _L("Enforce supports");
|
m_desc["enforce"] = _L("Enforce supports");
|
||||||
m_desc["block_caption"] = _L("Right mouse button") + ": ";
|
m_desc["block_caption"] = _L("Right mouse button");
|
||||||
m_desc["block"] = _L("Block supports");
|
m_desc["block"] = _L("Block supports");
|
||||||
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
m_desc["remove_caption"] = _L("Shift + Left mouse button");
|
||||||
m_desc["remove"] = _L("Erase painting");
|
m_desc["remove"] = _L("Erase");
|
||||||
m_desc["remove_all"] = _L("Erase all painting");
|
m_desc["remove_all"] = _L("Erase all painting");
|
||||||
m_desc["highlight_by_angle"] = _L("Highlight overhang areas") + ": ";
|
m_desc["highlight_by_angle"] = _L("Highlight overhang areas");
|
||||||
m_desc["gap_fill"] = _L("Gap fill");
|
m_desc["gap_fill"] = _L("Gap fill");
|
||||||
m_desc["perform"] = _L("Perform");
|
m_desc["perform"] = _L("Perform");
|
||||||
|
m_desc["gap_area_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
m_desc["gap_area"] = _L("Gap area");
|
m_desc["gap_area"] = _L("Gap area");
|
||||||
m_desc["brush_size"] = _L("Set pen size");
|
|
||||||
m_desc["brush_size_caption"] = _L("Ctrl + Mouse wheel") + ": ";
|
|
||||||
m_desc["tool_type"] = _L("Tool type");
|
m_desc["tool_type"] = _L("Tool type");
|
||||||
m_desc["smart_fill_angle"] = _L("Smart fill angle") + ": ";
|
m_desc["smart_fill_angle_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
|
m_desc["smart_fill_angle"] = _L("Smart fill angle");
|
||||||
|
|
||||||
memset(&m_print_instance, sizeof(m_print_instance), 0);
|
memset(&m_print_instance, sizeof(m_print_instance), 0);
|
||||||
return true;
|
return true;
|
||||||
|
@ -224,7 +226,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
||||||
|
|
||||||
float caption_max = 0.f;
|
float caption_max = 0.f;
|
||||||
float total_text_max = 0.f;
|
float total_text_max = 0.f;
|
||||||
for (const auto &t : std::array<std::string, 4>{"enforce", "block", "remove", "brush_size"}) {
|
for (const auto &t : std::array<std::string, 5>{"enforce", "block", "remove", "cursor_size", "clipping_of_view"}) {
|
||||||
caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
|
caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
|
||||||
total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
|
total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
|
||||||
}
|
}
|
||||||
|
@ -461,6 +463,8 @@ void GLGizmoFdmSupports::show_tooltip_information(float caption_max, float x, fl
|
||||||
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
||||||
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
||||||
|
|
||||||
|
caption_max += m_imgui->calc_text_size(": ").x + 15.f;
|
||||||
|
|
||||||
float font_size = ImGui::GetFontSize();
|
float font_size = ImGui::GetFontSize();
|
||||||
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
@ -475,7 +479,24 @@ void GLGizmoFdmSupports::show_tooltip_information(float caption_max, float x, fl
|
||||||
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto &t : std::array<std::string, 4>{"enforce", "block", "remove", "brush_size"}) draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
|
std::vector<std::string> tip_items;
|
||||||
|
switch (m_tool_type) {
|
||||||
|
case ToolType::BRUSH:
|
||||||
|
tip_items = {"enforce", "block", "remove", "cursor_size", "clipping_of_view"};
|
||||||
|
break;
|
||||||
|
case ToolType::BUCKET_FILL:
|
||||||
|
break;
|
||||||
|
case ToolType::SMART_FILL:
|
||||||
|
tip_items = {"enforce", "block", "remove", "smart_fill_angle", "clipping_of_view"};
|
||||||
|
break;
|
||||||
|
case ToolType::GAP_FILL:
|
||||||
|
tip_items = {"gap_area"};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (const auto &t : tip_items) draw_text_with_caption(m_desc.at(t + "_caption") + ": ", m_desc.at(t));
|
||||||
|
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
|
|
|
@ -97,18 +97,20 @@ bool GLGizmoMmuSegmentation::on_init()
|
||||||
// BBS
|
// BBS
|
||||||
m_shortcut_key = WXK_CONTROL_N;
|
m_shortcut_key = WXK_CONTROL_N;
|
||||||
|
|
||||||
m_desc["clipping_of_view"] = _L("Section view") + ": ";
|
m_desc["clipping_of_view_caption"] = _L("Alt + Mouse wheel");
|
||||||
m_desc["cursor_size"] = _L("Pen size") + ": ";
|
m_desc["clipping_of_view"] = _L("Section view");
|
||||||
|
m_desc["cursor_size_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
|
m_desc["cursor_size"] = _L("Pen size");
|
||||||
m_desc["cursor_type"] = _L("Pen shape");
|
m_desc["cursor_type"] = _L("Pen shape");
|
||||||
|
|
||||||
// BBS
|
m_desc["paint_caption"] = _L("Left mouse button");
|
||||||
m_desc["paint_caption"] = _L("Left mouse button") + ": ";
|
|
||||||
m_desc["paint"] = _L("Paint");
|
m_desc["paint"] = _L("Paint");
|
||||||
m_desc["erase_caption"] = _L("Right mouse button") + ": ";
|
m_desc["erase_caption"] = _L("Shift + Left mouse button");
|
||||||
m_desc["erase"] = _L("Erase");
|
m_desc["erase"] = _L("Erase");
|
||||||
m_desc["shortcut_key_caption"] = _L("Key 1~9") + ": ";
|
m_desc["shortcut_key_caption"] = _L("Key 1~9");
|
||||||
m_desc["shortcut_key"] = _L("Choose filament");
|
m_desc["shortcut_key"] = _L("Choose filament");
|
||||||
m_desc["edge_detection"] = _L("Edge detection");
|
m_desc["edge_detection"] = _L("Edge detection");
|
||||||
|
m_desc["gap_area_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
m_desc["gap_area"] = _L("Gap area");
|
m_desc["gap_area"] = _L("Gap area");
|
||||||
m_desc["perform"] = _L("Perform");
|
m_desc["perform"] = _L("Perform");
|
||||||
|
|
||||||
|
@ -123,12 +125,10 @@ bool GLGizmoMmuSegmentation::on_init()
|
||||||
m_desc["tool_smart_fill"] = _L("Smart fill");
|
m_desc["tool_smart_fill"] = _L("Smart fill");
|
||||||
m_desc["tool_bucket_fill"] = _L("Bucket fill");
|
m_desc["tool_bucket_fill"] = _L("Bucket fill");
|
||||||
|
|
||||||
|
m_desc["smart_fill_angle_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
m_desc["smart_fill_angle"] = _L("Smart fill angle");
|
m_desc["smart_fill_angle"] = _L("Smart fill angle");
|
||||||
|
|
||||||
m_desc["brush_size"] = _L("Set pen size");
|
m_desc["height_range_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
m_desc["brush_size_caption"] = _L("Ctrl + Mouse wheel") + ": ";
|
|
||||||
|
|
||||||
// BBS
|
|
||||||
m_desc["height_range"] = _L("Height range");
|
m_desc["height_range"] = _L("Height range");
|
||||||
|
|
||||||
init_extruders_data();
|
init_extruders_data();
|
||||||
|
@ -297,6 +297,8 @@ void GLGizmoMmuSegmentation::show_tooltip_information(float caption_max, float x
|
||||||
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
||||||
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
||||||
|
|
||||||
|
caption_max += m_imgui->calc_text_size(": ").x + 15.f;
|
||||||
|
|
||||||
float font_size = ImGui::GetFontSize();
|
float font_size = ImGui::GetFontSize();
|
||||||
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
@ -310,7 +312,24 @@ void GLGizmoMmuSegmentation::show_tooltip_information(float caption_max, float x
|
||||||
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto &t : std::array<std::string, 3>{"paint", "erase", "brush_size"}) draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
|
std::vector<std::string> tip_items;
|
||||||
|
switch (m_tool_type) {
|
||||||
|
case ToolType::BRUSH:
|
||||||
|
tip_items = {"paint", "erase", "cursor_size", "clipping_of_view"};
|
||||||
|
break;
|
||||||
|
case ToolType::BUCKET_FILL:
|
||||||
|
tip_items = {"paint", "erase", "smart_fill_angle", "clipping_of_view"};
|
||||||
|
break;
|
||||||
|
case ToolType::SMART_FILL:
|
||||||
|
// TODO:
|
||||||
|
break;
|
||||||
|
case ToolType::GAP_FILL:
|
||||||
|
tip_items = {"gap_area"};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (const auto &t : tip_items) draw_text_with_caption(m_desc.at(t + "_caption") + ": ", m_desc.at(t));
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
|
@ -347,7 +366,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
|
|
||||||
float caption_max = 0.f;
|
float caption_max = 0.f;
|
||||||
float total_text_max = 0.f;
|
float total_text_max = 0.f;
|
||||||
for (const auto &t : std::array<std::string, 3>{"paint", "erase", "brush_size"}) {
|
for (const auto &t : std::array<std::string, 6>{"paint", "erase", "cursor_size", "smart_fill_angle", "height_range", "clipping_of_view"}) {
|
||||||
caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
|
caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
|
||||||
total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
|
total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +556,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||||
|
|
||||||
if (m_detect_geometry_edge) {
|
if (m_detect_geometry_edge) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc["smart_fill_angle"] + ":");
|
m_imgui->text(m_desc["smart_fill_angle"]);
|
||||||
std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Face angle threshold,"
|
std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Face angle threshold,"
|
||||||
"placed after the number with no whitespace in between.");
|
"placed after the number with no whitespace in between.");
|
||||||
ImGui::SameLine(sliders_left_width);
|
ImGui::SameLine(sliders_left_width);
|
||||||
|
|
|
@ -90,7 +90,7 @@ protected:
|
||||||
void on_set_state() override;
|
void on_set_state() override;
|
||||||
|
|
||||||
EnforcerBlockerType get_left_button_state_type() const override { return EnforcerBlockerType(m_selected_extruder_idx + 1); }
|
EnforcerBlockerType get_left_button_state_type() const override { return EnforcerBlockerType(m_selected_extruder_idx + 1); }
|
||||||
EnforcerBlockerType get_right_button_state_type() const override { return EnforcerBlockerType::NONE; }
|
EnforcerBlockerType get_right_button_state_type() const override { return EnforcerBlockerType(-1); }
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -495,21 +495,22 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
||||||
if (action == SLAGizmoEventType::MouseWheelUp
|
if (action == SLAGizmoEventType::MouseWheelUp
|
||||||
|| action == SLAGizmoEventType::MouseWheelDown) {
|
|| action == SLAGizmoEventType::MouseWheelDown) {
|
||||||
if (control_down) {
|
if (control_down) {
|
||||||
|
//BBS
|
||||||
|
if (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::HEIGHT_RANGE) {
|
||||||
|
m_cursor_height = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_cursor_height - this->get_cursor_height_step(), this->get_cursor_height_min()) :
|
||||||
|
std::min(m_cursor_height + this->get_cursor_height_step(), this->get_cursor_height_max());
|
||||||
|
m_parent.set_as_dirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_tool_type == ToolType::BRUSH && (m_cursor_type == TriangleSelector::CursorType::SPHERE || m_cursor_type == TriangleSelector::CursorType::CIRCLE)) {
|
if (m_tool_type == ToolType::BRUSH && (m_cursor_type == TriangleSelector::CursorType::SPHERE || m_cursor_type == TriangleSelector::CursorType::CIRCLE)) {
|
||||||
m_cursor_radius = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_cursor_radius - this->get_cursor_radius_step(), this->get_cursor_radius_min()) :
|
m_cursor_radius = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_cursor_radius - this->get_cursor_radius_step(), this->get_cursor_radius_min()) :
|
||||||
std::min(m_cursor_radius + this->get_cursor_radius_step(), this->get_cursor_radius_max());
|
std::min(m_cursor_radius + this->get_cursor_radius_step(), this->get_cursor_radius_max());
|
||||||
m_parent.set_as_dirty();
|
m_parent.set_as_dirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
double pos = m_c->object_clipper()->get_position();
|
|
||||||
pos = action == SLAGizmoEventType::MouseWheelDown
|
if (m_tool_type == ToolType::BUCKET_FILL || m_tool_type == ToolType::SMART_FILL) {
|
||||||
? std::max(0., pos - 0.01)
|
|
||||||
: std::min(1., pos + 0.01);
|
|
||||||
m_c->object_clipper()->set_position(pos, true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (alt_down) {
|
|
||||||
if (m_tool_type == ToolType::SMART_FILL) {
|
|
||||||
m_smart_fill_angle = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_smart_fill_angle - SmartFillAngleStep, SmartFillAngleMin)
|
m_smart_fill_angle = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_smart_fill_angle - SmartFillAngleStep, SmartFillAngleMin)
|
||||||
: std::min(m_smart_fill_angle + SmartFillAngleStep, SmartFillAngleMax);
|
: std::min(m_smart_fill_angle + SmartFillAngleStep, SmartFillAngleMax);
|
||||||
m_parent.set_as_dirty();
|
m_parent.set_as_dirty();
|
||||||
|
@ -527,7 +528,22 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
if (m_tool_type == ToolType::GAP_FILL) {
|
||||||
|
TriangleSelectorPatch::gap_area = action == SLAGizmoEventType::MouseWheelDown ?
|
||||||
|
std::max(TriangleSelectorPatch::gap_area - TriangleSelectorPatch::GapAreaStep, TriangleSelectorPatch::GapAreaMin) :
|
||||||
|
std::min(TriangleSelectorPatch::gap_area + TriangleSelectorPatch::GapAreaStep, TriangleSelectorPatch::GapAreaMax);
|
||||||
|
m_parent.set_as_dirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (alt_down) {
|
||||||
|
// BBS
|
||||||
|
double pos = m_c->object_clipper()->get_position();
|
||||||
|
pos = action == SLAGizmoEventType::MouseWheelDown
|
||||||
|
? std::max(0., pos - 0.01)
|
||||||
|
: std::min(1., pos + 0.01);
|
||||||
|
m_c->object_clipper()->set_position(pos, true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,6 +560,16 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
EnforcerBlockerType new_state = EnforcerBlockerType::NONE;
|
EnforcerBlockerType new_state = EnforcerBlockerType::NONE;
|
||||||
|
// BBS
|
||||||
|
if (action == SLAGizmoEventType::Dragging) {
|
||||||
|
if (m_button_down == Button::Right && this->get_right_button_state_type() == EnforcerBlockerType(-1))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (action == SLAGizmoEventType::RightDown && this->get_right_button_state_type() == EnforcerBlockerType(-1))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (! shift_down) {
|
if (! shift_down) {
|
||||||
if (action == SLAGizmoEventType::Dragging)
|
if (action == SLAGizmoEventType::Dragging)
|
||||||
new_state = m_button_down == Button::Left ? this->get_left_button_state_type() : this->get_right_button_state_type();
|
new_state = m_button_down == Button::Left ? this->get_left_button_state_type() : this->get_right_button_state_type();
|
||||||
|
|
|
@ -142,6 +142,7 @@ public:
|
||||||
|
|
||||||
constexpr static float GapAreaMin = 0.f;
|
constexpr static float GapAreaMin = 0.f;
|
||||||
constexpr static float GapAreaMax = 5.f;
|
constexpr static float GapAreaMax = 5.f;
|
||||||
|
constexpr static float GapAreaStep = 0.2f;
|
||||||
|
|
||||||
// BBS: fix me
|
// BBS: fix me
|
||||||
static float gap_area;
|
static float gap_area;
|
||||||
|
|
|
@ -29,16 +29,18 @@ bool GLGizmoSeam::on_init()
|
||||||
{
|
{
|
||||||
m_shortcut_key = WXK_CONTROL_P;
|
m_shortcut_key = WXK_CONTROL_P;
|
||||||
|
|
||||||
m_desc["clipping_of_view"] = _L("Section view") + ": ";
|
m_desc["clipping_of_view_caption"] = _L("Alt + Mouse wheel");
|
||||||
|
m_desc["clipping_of_view"] = _L("Section view");
|
||||||
m_desc["reset_direction"] = _L("Reset direction");
|
m_desc["reset_direction"] = _L("Reset direction");
|
||||||
m_desc["cursor_size"] = _L("Brush size") + ": ";
|
m_desc["cursor_size_caption"] = _L("Ctrl + Mouse wheel");
|
||||||
m_desc["cursor_type"] = _L("Brush shape") + ": ";
|
m_desc["cursor_size"] = _L("Brush size");
|
||||||
m_desc["enforce_caption"] = _L("Left mouse button") + ": ";
|
m_desc["cursor_type"] = _L("Brush shape");
|
||||||
|
m_desc["enforce_caption"] = _L("Left mouse button");
|
||||||
m_desc["enforce"] = _L("Enforce seam");
|
m_desc["enforce"] = _L("Enforce seam");
|
||||||
m_desc["block_caption"] = _L("Right mouse button") + ": ";
|
m_desc["block_caption"] = _L("Right mouse button");
|
||||||
m_desc["block"] = _L("Block seam");
|
m_desc["block"] = _L("Block seam");
|
||||||
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
m_desc["remove_caption"] = _L("Shift + Left mouse button");
|
||||||
m_desc["remove"] = _L("Remove selection");
|
m_desc["remove"] = _L("Erase");
|
||||||
m_desc["remove_all"] = _L("Erase all painting");
|
m_desc["remove_all"] = _L("Erase all painting");
|
||||||
m_desc["circle"] = _L("Circle");
|
m_desc["circle"] = _L("Circle");
|
||||||
m_desc["sphere"] = _L("Sphere");
|
m_desc["sphere"] = _L("Sphere");
|
||||||
|
@ -125,6 +127,8 @@ void GLGizmoSeam::show_tooltip_information(float caption_max, float x, float y)
|
||||||
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
|
||||||
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
|
||||||
|
|
||||||
|
caption_max += m_imgui->calc_text_size(": ").x + 35.f;
|
||||||
|
|
||||||
float font_size = ImGui::GetFontSize();
|
float font_size = ImGui::GetFontSize();
|
||||||
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
@ -138,7 +142,7 @@ void GLGizmoSeam::show_tooltip_information(float caption_max, float x, float y)
|
||||||
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto &t : std::array<std::string, 3>{"enforce", "block", "remove"}) draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
|
for (const auto &t : std::array<std::string, 5>{"enforce", "block", "remove", "cursor_size", "clipping_of_view"}) draw_text_with_caption(m_desc.at(t + "_caption") + ": ", m_desc.at(t));
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
|
@ -187,7 +191,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
|
|
||||||
float caption_max = 0.f;
|
float caption_max = 0.f;
|
||||||
float total_text_max = 0.f;
|
float total_text_max = 0.f;
|
||||||
for (const auto &t : std::array<std::string, 3>{"enforce", "block", "remove"}) {
|
for (const auto &t : std::array<std::string, 6>{"enforce", "block", "remove", "cursor_size", "clipping_of_view"}) {
|
||||||
caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
|
caption_max = std::max(caption_max, m_imgui->calc_text_size(m_desc[t + "_caption"]).x);
|
||||||
total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
|
total_text_max = std::max(total_text_max, m_imgui->calc_text_size(m_desc[t]).x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,7 +679,14 @@ bool GLGizmosManager::on_mouse_wheel(wxMouseEvent& evt)
|
||||||
|
|
||||||
if (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation) {
|
if (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation) {
|
||||||
float rot = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta();
|
float rot = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta();
|
||||||
if (gizmo_event((rot > 0.f ? SLAGizmoEventType::MouseWheelUp : SLAGizmoEventType::MouseWheelDown), Vec2d::Zero(), evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
if (gizmo_event((rot > 0.f ? SLAGizmoEventType::MouseWheelUp : SLAGizmoEventType::MouseWheelDown), Vec2d::Zero(), evt.ShiftDown(), evt.AltDown()
|
||||||
|
// BBS
|
||||||
|
#ifdef __WXOSX_MAC__
|
||||||
|
, evt.RawControlDown()
|
||||||
|
#else
|
||||||
|
, evt.ControlDown()
|
||||||
|
#endif
|
||||||
|
))
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +712,8 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||||
if (evt.Moving()) {
|
if (evt.Moving()) {
|
||||||
m_tooltip = update_hover_state(mouse_pos);
|
m_tooltip = update_hover_state(mouse_pos);
|
||||||
if (m_current == MmuSegmentation || m_current == FdmSupports)
|
if (m_current == MmuSegmentation || m_current == FdmSupports)
|
||||||
gizmo_event(SLAGizmoEventType::Moving, mouse_pos, evt.ShiftDown(), evt.AltDown());
|
// BBS
|
||||||
|
gizmo_event(SLAGizmoEventType::Moving, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
|
||||||
} else if (evt.LeftUp()) {
|
} else if (evt.LeftUp()) {
|
||||||
if (m_mouse_capture.left) {
|
if (m_mouse_capture.left) {
|
||||||
processed = true;
|
processed = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue