mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-06 00:56:04 +08:00
ENH:add "Lock x value of bottom" checkbox
for height range jira: STUDIO-6815 Change-Id: Ia1dfde0670e61714200353b40ad8f9d50060d699 (cherry picked from commit 43b2219db6916ee6e4b102bf120222f65e772889)
This commit is contained in:
parent
98cce3b656
commit
edf8a4bdc0
@ -715,6 +715,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
||||
ImGui::PushItemWidth(1.5 * slider_icon_width);
|
||||
ImGui::BBLDragFloat("##cursor_height_input", &m_cursor_height, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||
|
||||
m_imgui->bbl_checkbox(_L("Lock x value of bottom"), m_lock_x_for_height_bottom);
|
||||
ImGui::Separator();
|
||||
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||
ImGui::AlignTextToFramePadding();
|
||||
|
@ -156,9 +156,10 @@ void GLGizmoPainterBase::render_cursor() const
|
||||
else {
|
||||
m_rr.mouse_position = m_parent.get_local_mouse_position();
|
||||
}
|
||||
if (m_rr.mesh_id == -1) {
|
||||
if (m_rr.mesh_id == -1) {
|
||||
m_is_cursor_in_imgui = false;
|
||||
return;
|
||||
m_x_for_height_input = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_tool_type == ToolType::BRUSH) {
|
||||
@ -281,7 +282,8 @@ bool GLGizmoPainterBase::is_valid_height_range_cursor(float min_z, float max_z)
|
||||
void GLGizmoPainterBase::render_cursor_height_range(const Transform3d& trafo) const
|
||||
{
|
||||
float buf_size= ImGui::CalcTextSize("-100.00").x + ImGui::GetStyle().FramePadding.x;
|
||||
|
||||
m_height_range_input_all_size[0] = buf_size+ ImGui::CalcTextSize(_L("Bottom:").c_str()).x * 2 + ImGui::GetStyle().FramePadding.x;
|
||||
m_height_range_input_all_size[1] = ImGui::CalcTextSize(_L("Bottom:").c_str()).y *2;
|
||||
const BoundingBoxf3 box = bounding_box();
|
||||
Vec3d hit_world = trafo * Vec3d(m_rr.hit(0), m_rr.hit(1), m_rr.hit(2));
|
||||
float max_z = (float)box.max.z();
|
||||
@ -454,8 +456,23 @@ void GLGizmoPainterBase::update_contours(int i, const TriangleMesh &vol_mesh, fl
|
||||
if(screen_pos_sorts.size() >= 1){
|
||||
m_height_start_pos = screen_pos_sorts[0].pos_screen;
|
||||
// make mouse to cover in a part of imgui
|
||||
m_height_start_pos[0] -= 10;
|
||||
if (m_lock_x_for_height_bottom) {
|
||||
if (m_x_for_height_input == -1) {
|
||||
m_x_for_height_input = m_rr.mouse_position.x() + 10;
|
||||
}
|
||||
m_height_start_pos[0] = m_x_for_height_input;
|
||||
} else {
|
||||
m_height_start_pos[0] -= 10;
|
||||
}
|
||||
m_height_start_pos[1] -= 10;
|
||||
const Camera &camera = wxGetApp().plater()->get_camera();
|
||||
auto viewport = camera.get_viewport();
|
||||
if (m_height_start_pos[0] + m_height_range_input_all_size[0] >= viewport[2]) {
|
||||
m_height_start_pos[0] = viewport[2] - m_height_range_input_all_size[0];
|
||||
}
|
||||
if (m_height_start_pos[1] + m_height_range_input_all_size[1] >= viewport[3]) {
|
||||
m_height_start_pos[1] = viewport[3] - m_height_range_input_all_size[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
m_cut_contours[i].contours.init_from(polys, static_cast<float>(cursor_z));
|
||||
|
@ -379,6 +379,9 @@ protected:
|
||||
mutable double m_height_start_z_in_imgui{0};
|
||||
mutable bool m_is_set_height_start_z_by_imgui{false};
|
||||
mutable Vec2i m_height_start_pos{0, 0};
|
||||
mutable float m_x_for_height_input{-1};
|
||||
mutable bool m_lock_x_for_height_bottom{false};
|
||||
mutable Vec2f m_height_range_input_all_size;
|
||||
mutable bool m_is_cursor_in_imgui{false};
|
||||
BoundingBoxf3 bounding_box() const;
|
||||
void update_contours(int i, const TriangleMesh &vol_mesh, float cursor_z, float max_z, float min_z, bool update_height_start_pos) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user