From 4b3fc0f821026214640d7cc15d28b83e3b958220 Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Thu, 8 Dec 2022 14:10:17 +0100 Subject: [PATCH] fix: ../src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp:2675:15: warning: unused variable 'font_prop' [-Wunused-variable] ../src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp:3463:13: warning: 'Slic3r::Transform3d priv::create_transformation_on_bed(const Vec2d&, const Slic3r::GUI::Camera&, const std::vector >&, double)' defined but not used [-Wunused-function] --- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 45 +++---------------------- 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index daaef32255..9c8a6acfbd 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -204,19 +204,6 @@ static void find_closest_volume(const Selection &selection, /// Define params of text /// Screen coordinat, where to create new object laying on bed static void start_create_object_job(DataBase &emboss_data, const Vec2d &coor); - -/// -/// Create transformation for new created emboss object by mouse position -/// -/// Define where to add object -/// Actual camera view -/// Define shape of bed for its center and check that coor is on bed center -/// Emboss size / 2 -/// Transformation for create text on bed -static Transform3d create_transformation_on_bed(const Vec2d &screen_coor, - const Camera &camera, - const std::vector &bed_shape, - double z); } // namespace priv bool priv::is_valid(ModelVolumeType volume_type){ @@ -698,7 +685,7 @@ static void draw_mouse_offset(const std::optional &offset) draw_list->AddLine(p1, p2, color, thickness); } #endif // SHOW_OFFSET_DURING_DRAGGING - +namespace priv { static void draw_origin_ball(const GLCanvas3D& canvas) { auto draw_list = ImGui::GetOverlayDrawList(); const Selection &selection = canvas.get_selection(); @@ -713,6 +700,8 @@ static void draw_origin_ball(const GLCanvas3D& canvas) { draw_list->AddCircleFilled(center, radius, color); } +} // namespace priv + void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit) { if (!m_gui_cfg.has_value()) initialize(); @@ -728,7 +717,7 @@ void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit) const ImVec2 &min_window_size = get_minimal_window_size(); ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, min_window_size); - draw_origin_ball(m_parent); + priv::draw_origin_ball(m_parent); #ifdef SHOW_FINE_POSITION draw_fine_position(m_parent.get_selection(), m_parent.get_canvas_size(), min_window_size); @@ -2672,8 +2661,7 @@ void GLGizmoEmboss::draw_style_edit() { } bool use_inch = wxGetApp().app_config->get("use_inches") == "1"; - FontProp &font_prop = style.prop; - + // IMPROVE: calc scale only when neccessary not each frame Transform3d to_world = priv::world_matrix(m_parent.get_selection()); Vec3d up_world = to_world.linear() * Vec3d(0., 1., 0.); @@ -3459,29 +3447,6 @@ DataBase priv::create_emboss_data_base(const std::string &text, StyleManager& st return Slic3r::GUI::Emboss::DataBase{style_manager.get_font_file_with_cache(), create_configuration(), create_volume_name()}; } - -Transform3d priv::create_transformation_on_bed(const Vec2d &screen_coor, const Camera &camera, const std::vector &bed_shape, double z) -{ - // Create new object - // calculate X,Y offset position for lay on platter in place of - // mouse click - Vec2d bed_coor = CameraUtils::get_z0_position(camera, screen_coor); - - // check point is on build plate: - Points bed_shape_; - bed_shape_.reserve(bed_shape.size()); - for (const Vec2d &p : bed_shape) bed_shape_.emplace_back(p.cast()); - Slic3r::Polygon bed(bed_shape_); - if (!bed.contains(bed_coor.cast())) - // mouse pose is out of build plate so create object in center of plate - bed_coor = bed.centroid().cast(); - - Vec3d offset(bed_coor.x(), bed_coor.y(), z); - // offset -= m_result.center(); - Transform3d::TranslationType tt(offset.x(), offset.y(), offset.z()); - return Transform3d(tt); -} - void priv::start_create_object_job(DataBase &emboss_data, const Vec2d &coor) { // start creation of new object