NEW: support to edit bed stl and texture for third-party printers

Jira:STUDIO-4209
some codes are referenced form PrusaSlicer,thanks enricoturri1966 for the original commit

commit cf380fb456
Author: enricoturri1966 <enricoturri@seznam.cz>
Date:   Tue Sep 21 13:51:57 2021 +0200
    Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Out of bed detection for circular printbeds
...

Change-Id: I1b1e2ff045286566d4fb9f2d8ad4faa1f135f60c
(cherry picked from commit 284bca9f1f4cdb9eb405e8205cd50666a2b0b2a0)
This commit is contained in:
zhou.xu
2023-09-14 10:41:47 +08:00
committed by Lane.Wei
parent 384b0793ff
commit 487c86e915
11 changed files with 319 additions and 228 deletions

View File

@@ -37,7 +37,7 @@ struct BedShape
bool is_custom() { return m_build_volume.type() == BuildVolume::Type::Convex || m_build_volume.type() == BuildVolume::Type::Custom; }
static void append_option_line(ConfigOptionsGroupShp optgroup, Parameter param);
static void append_option_line(ConfigOptionsGroupShp optgroup, Parameter param,bool can_edit);
static wxString get_name(PageType type);
PageType get_page_type();
@@ -59,6 +59,8 @@ class BedShapePanel : public wxPanel
std::vector<Vec2d> m_loaded_shape;
std::string m_custom_texture;
std::string m_custom_model;
bool m_is_valid{true};
bool m_can_edit{true};
public:
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY), m_custom_texture(NONE), m_custom_model(NONE) {}
@@ -69,6 +71,8 @@ public:
const std::vector<Vec2d>& get_shape() const { return m_shape; }
const std::string& get_custom_texture() const { return (m_custom_texture != NONE) ? m_custom_texture : EMPTY_STRING; }
const std::string& get_custom_model() const { return (m_custom_model != NONE) ? m_custom_model : EMPTY_STRING; }
bool get_valid() { return m_is_valid; }
void set_edit_state(bool flag) { m_can_edit = flag; }
private:
ConfigOptionsGroupShp init_shape_options_page(const wxString& title);
@@ -91,16 +95,18 @@ private:
class BedShapeDialog : public DPIDialog
{
BedShapePanel* m_panel;
public:
BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {}
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model,bool can_edit);
const std::vector<Vec2d>& get_shape() const { return m_panel->get_shape(); }
const std::string& get_custom_texture() const { return m_panel->get_custom_texture(); }
const std::string& get_custom_model() const { return m_panel->get_custom_model(); }
bool get_valid() { return m_panel->get_valid(); }
protected:
void on_dpi_changed(const wxRect &suggested_rect) override;
};