mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
parent
9671cdfc68
commit
7f12c18a4a
7 changed files with 36 additions and 20 deletions
|
@ -1308,7 +1308,7 @@ void ConfigBase::save_to_json(const std::string &file, const std::string &name,
|
|||
{
|
||||
const ConfigOption* opt = this->option(opt_key);
|
||||
if ( opt->is_scalar() ) {
|
||||
if (opt->type() == coString)
|
||||
if (opt->type() == coString && (opt_key != "bed_custom_texture" && opt_key != "bed_custom_model"))
|
||||
//keep \n, \r, \t
|
||||
j[opt_key] = (dynamic_cast<const ConfigOptionString *>(opt))->value;
|
||||
else
|
||||
|
|
|
@ -169,12 +169,12 @@ void BedShapeDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
const std::string BedShapePanel::NONE = "None";
|
||||
const std::string BedShapePanel::EMPTY_STRING = "";
|
||||
|
||||
void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model)
|
||||
void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std::string& custom_texture, const std::string& custom_model)
|
||||
{
|
||||
wxGetApp().UpdateDarkUI(this);
|
||||
m_shape = default_pt.values;
|
||||
m_custom_texture = custom_texture.value.empty() ? NONE : custom_texture.value;
|
||||
m_custom_model = custom_model.value.empty() ? NONE : custom_model.value;
|
||||
m_custom_texture = custom_texture.empty() ? NONE : custom_texture;
|
||||
m_custom_model = custom_model.empty() ? NONE : custom_model;
|
||||
|
||||
auto sbsizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Shape"));
|
||||
sbsizer->GetStaticBox()->SetFont(wxGetApp().bold_font());
|
||||
|
|
|
@ -63,7 +63,7 @@ class BedShapePanel : public wxPanel
|
|||
public:
|
||||
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY), m_custom_texture(NONE), m_custom_model(NONE) {}
|
||||
|
||||
void build_panel(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);
|
||||
void build_panel(const ConfigOptionPoints& default_pt, const std::string& custom_texture, const std::string& custom_model);
|
||||
|
||||
// Returns the resulting bed shape polygon. This value will be stored to the ini file.
|
||||
const std::vector<Vec2d>& get_shape() const { return m_shape; }
|
||||
|
|
|
@ -671,14 +671,12 @@ void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config,
|
|||
#endif
|
||||
else if (m_opt_map.find(opt_key) == m_opt_map.end() ||
|
||||
// This option don't have corresponded field
|
||||
opt_key == "printable_area" ||
|
||||
opt_key == "compatible_printers" || opt_key == "compatible_prints" || opt_key == "thumbnails" ) {
|
||||
opt_key == "printable_area" || opt_key == "compatible_printers" || opt_key == "compatible_prints" ||
|
||||
opt_key == "thumbnails" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model") {
|
||||
value = get_config_value(config, opt_key);
|
||||
this->change_opt_value(opt_key, value);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
auto opt_id = m_opt_map.find(opt_key)->first;
|
||||
std::string opt_short_key = m_opt_map.at(opt_id).first;
|
||||
int opt_index = m_opt_map.at(opt_id).second;
|
||||
|
|
|
@ -638,6 +638,11 @@ public:
|
|||
m_height_limit_mode = mode;
|
||||
}
|
||||
|
||||
// SoftFever
|
||||
const std::string& get_logo_texture_filename() const {
|
||||
return m_logo_texture_filename;
|
||||
}
|
||||
|
||||
int get_curr_plate_index() const { return m_current_plate; }
|
||||
PartPlate* get_curr_plate() { return m_plate_list[m_current_plate]; }
|
||||
const PartPlate* get_curr_plate() const { return m_plate_list[m_current_plate]; }
|
||||
|
|
|
@ -6981,11 +6981,13 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
|
|||
|
||||
float prev_height_lid, prev_height_rod;
|
||||
partplate_list.get_height_limits(prev_height_lid, prev_height_rod);
|
||||
auto prev_logo = partplate_list.get_logo_texture_filename();
|
||||
double height_to_lid = config->opt_float("extruder_clearance_height_to_lid");
|
||||
double height_to_rod = config->opt_float("extruder_clearance_height_to_rod");
|
||||
auto custom_bed_texture = config->opt_string("bed_custom_texture");
|
||||
|
||||
Pointfs prev_exclude_areas = partplate_list.get_exclude_area();
|
||||
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas);
|
||||
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas) || (prev_logo != custom_bed_texture);
|
||||
if (new_shape) {
|
||||
if (view3D) view3D->bed_shape_changed();
|
||||
if (preview) preview->bed_shape_changed();
|
||||
|
@ -10581,6 +10583,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
|||
}
|
||||
//BBS: add bed_exclude_area
|
||||
else if (opt_key == "printable_area" || opt_key == "bed_exclude_area"
|
||||
|| opt_key == "bed_custom_texture" || opt_key == "bed_custom_model"
|
||||
|| opt_key == "extruder_clearance_height_to_lid"
|
||||
|| opt_key == "extruder_clearance_height_to_rod") {
|
||||
bed_shape_changed = true;
|
||||
|
|
|
@ -4860,20 +4860,30 @@ wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
|
|||
btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e)
|
||||
{
|
||||
BedShapeDialog dlg(this);
|
||||
dlg.build_dialog(*m_config->option<ConfigOptionPoints>("printable_area"), {}, {});
|
||||
dlg.build_dialog(*m_config->option<ConfigOptionPoints>("printable_area"),
|
||||
*m_config->option<ConfigOptionString>("bed_custom_texture"),
|
||||
*m_config->option<ConfigOptionString>("bed_custom_model"));
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
const std::vector<Vec2d>& shape = dlg.get_shape();
|
||||
const std::string& custom_texture = dlg.get_custom_texture();
|
||||
const std::string& custom_model = dlg.get_custom_model();
|
||||
if (!shape.empty())
|
||||
{
|
||||
load_key_value("printable_area", shape);
|
||||
load_key_value("bed_custom_texture", custom_texture);
|
||||
load_key_value("bed_custom_model", custom_model);
|
||||
update_changed_ui();
|
||||
}
|
||||
on_presets_changed();
|
||||
|
||||
}
|
||||
}));
|
||||
|
||||
{
|
||||
Search::OptionsSearcher& searcher = wxGetApp().sidebar().get_searcher();
|
||||
const Search::GroupAndCategory& gc = searcher.get_group_and_category("printable_area");
|
||||
searcher.add_key("bed_custom_texture", m_type, gc.group, gc.category);
|
||||
searcher.add_key("bed_custom_model", m_type, gc.group, gc.category);
|
||||
}
|
||||
|
||||
return sizer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue