Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_custom_bed
This commit is contained in:
commit
e8c38a93fc
7 changed files with 23 additions and 42 deletions
|
@ -1566,9 +1566,9 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::update_opt_keys(t_config_option_keys& opt_keys)
|
void ObjectList::update_opt_keys(t_config_option_keys& opt_keys, const bool is_object)
|
||||||
{
|
{
|
||||||
auto full_current_opts = get_options(false);
|
auto full_current_opts = get_options(!is_object);
|
||||||
for (int i = opt_keys.size()-1; i >= 0; --i)
|
for (int i = opt_keys.size()-1; i >= 0; --i)
|
||||||
if (find(full_current_opts.begin(), full_current_opts.end(), opt_keys[i]) == full_current_opts.end())
|
if (find(full_current_opts.begin(), full_current_opts.end(), opt_keys[i]) == full_current_opts.end())
|
||||||
opt_keys.erase(opt_keys.begin() + i);
|
opt_keys.erase(opt_keys.begin() + i);
|
||||||
|
@ -2161,16 +2161,15 @@ void ObjectList::part_selection_changed()
|
||||||
panel.Thaw();
|
panel.Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsBundle ObjectList::get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_layers_range_settings)
|
SettingsBundle ObjectList::get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_object_settings)
|
||||||
{
|
{
|
||||||
auto opt_keys = config->keys();
|
auto opt_keys = config->keys();
|
||||||
if (opt_keys.empty())
|
if (opt_keys.empty())
|
||||||
return SettingsBundle();
|
return SettingsBundle();
|
||||||
|
|
||||||
update_opt_keys(opt_keys); // update options list according to print technology
|
update_opt_keys(opt_keys, is_object_settings); // update options list according to print technology
|
||||||
|
|
||||||
if (opt_keys.size() == 1 && opt_keys[0] == "extruder" ||
|
if (opt_keys.empty())
|
||||||
is_layers_range_settings && opt_keys.size() == 2)
|
|
||||||
return SettingsBundle();
|
return SettingsBundle();
|
||||||
|
|
||||||
const int extruders_cnt = wxGetApp().extruders_edited_cnt();
|
const int extruders_cnt = wxGetApp().extruders_edited_cnt();
|
||||||
|
@ -2201,24 +2200,15 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
|
||||||
if (!parent_item)
|
if (!parent_item)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
const bool is_layers_range_settings = m_objects_model->GetItemType(parent_item) == itLayer;
|
const bool is_object_settings = m_objects_model->GetItemType(parent_item) == itObject;
|
||||||
SettingsBundle cat_options = get_item_settings_bundle(config, is_layers_range_settings);
|
SettingsBundle cat_options = get_item_settings_bundle(config, is_object_settings);
|
||||||
if (cat_options.empty())
|
if (cat_options.empty())
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
std::vector<std::string> categories;
|
std::vector<std::string> categories;
|
||||||
categories.reserve(cat_options.size());
|
categories.reserve(cat_options.size());
|
||||||
for (auto& cat : cat_options)
|
for (auto& cat : cat_options)
|
||||||
{
|
|
||||||
if (cat.second.size() == 1 &&
|
|
||||||
(cat.second[0] == "extruder" || is_layers_range_settings && cat.second[0] == "layer_height"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
categories.push_back(cat.first);
|
categories.push_back(cat.first);
|
||||||
}
|
|
||||||
|
|
||||||
if (categories.empty())
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (m_objects_model->GetItemType(parent_item) & itInstance)
|
if (m_objects_model->GetItemType(parent_item) & itInstance)
|
||||||
parent_item = m_objects_model->GetTopParent(parent_item);
|
parent_item = m_objects_model->GetTopParent(parent_item);
|
||||||
|
|
|
@ -238,7 +238,7 @@ public:
|
||||||
wxMenu* create_settings_popupmenu(wxMenu *parent_menu);
|
wxMenu* create_settings_popupmenu(wxMenu *parent_menu);
|
||||||
void create_freq_settings_popupmenu(wxMenu *parent_menu);
|
void create_freq_settings_popupmenu(wxMenu *parent_menu);
|
||||||
|
|
||||||
void update_opt_keys(t_config_option_keys& t_optopt_keys);
|
void update_opt_keys(t_config_option_keys& t_optopt_keys, const bool is_object);
|
||||||
|
|
||||||
void load_subobject(ModelVolumeType type);
|
void load_subobject(ModelVolumeType type);
|
||||||
void load_part(ModelObject* model_object, std::vector<std::pair<wxString, bool>> &volumes_info, ModelVolumeType type);
|
void load_part(ModelObject* model_object, std::vector<std::pair<wxString, bool>> &volumes_info, ModelVolumeType type);
|
||||||
|
@ -266,7 +266,7 @@ public:
|
||||||
wxBoxSizer* get_sizer() {return m_sizer;}
|
wxBoxSizer* get_sizer() {return m_sizer;}
|
||||||
int get_selected_obj_idx() const;
|
int get_selected_obj_idx() const;
|
||||||
DynamicPrintConfig& get_item_config(const wxDataViewItem& item) const;
|
DynamicPrintConfig& get_item_config(const wxDataViewItem& item) const;
|
||||||
SettingsBundle get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_layers_range_settings);
|
SettingsBundle get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_object_settings);
|
||||||
|
|
||||||
void changed_object(const int obj_idx = -1) const;
|
void changed_object(const int obj_idx = -1) const;
|
||||||
void part_selection_changed();
|
void part_selection_changed();
|
||||||
|
|
|
@ -77,8 +77,8 @@ bool ObjectSettings::update_settings_list()
|
||||||
if (!item || !objects_model->IsSettingsItem(item) || !config || objects_ctrl->multiple_selection())
|
if (!item || !objects_model->IsSettingsItem(item) || !config || objects_ctrl->multiple_selection())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const bool is_layers_range_settings = objects_model->GetItemType(objects_model->GetParent(item)) == itLayer;
|
const bool is_object_settings = objects_model->GetItemType(objects_model->GetParent(item)) == itObject;
|
||||||
SettingsBundle cat_options = objects_ctrl->get_item_settings_bundle(config, is_layers_range_settings);
|
SettingsBundle cat_options = objects_ctrl->get_item_settings_bundle(config, is_object_settings);
|
||||||
|
|
||||||
if (!cat_options.empty())
|
if (!cat_options.empty())
|
||||||
{
|
{
|
||||||
|
@ -107,10 +107,6 @@ bool ObjectSettings::update_settings_list()
|
||||||
|
|
||||||
for (auto& cat : cat_options)
|
for (auto& cat : cat_options)
|
||||||
{
|
{
|
||||||
if (cat.second.size() == 1 &&
|
|
||||||
(cat.second[0] == "extruder" || is_layers_range_settings && cat.second[0] == "layer_height"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
categories.push_back(cat.first);
|
categories.push_back(cat.first);
|
||||||
|
|
||||||
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(cat.first), config, false, extra_column);
|
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(cat.first), config, false, extra_column);
|
||||||
|
@ -131,8 +127,6 @@ bool ObjectSettings::update_settings_list()
|
||||||
const bool is_extruders_cat = cat.first == "Extruders";
|
const bool is_extruders_cat = cat.first == "Extruders";
|
||||||
for (auto& opt : cat.second)
|
for (auto& opt : cat.second)
|
||||||
{
|
{
|
||||||
if (opt == "extruder" || is_layers_range_settings && opt == "layer_height")
|
|
||||||
continue;
|
|
||||||
Option option = optgroup->get_option(opt);
|
Option option = optgroup->get_option(opt);
|
||||||
option.opt.width = 12;
|
option.opt.width = 12;
|
||||||
if (is_extruders_cat)
|
if (is_extruders_cat)
|
||||||
|
|
|
@ -718,7 +718,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||||
p->scrolled->SetSizer(scrolled_sizer);
|
p->scrolled->SetSizer(scrolled_sizer);
|
||||||
|
|
||||||
// Sizer with buttons for mode changing
|
// Sizer with buttons for mode changing
|
||||||
p->mode_sizer = new ModeSizer(p->scrolled, 2 * wxGetApp().em_unit());
|
p->mode_sizer = new ModeSizer(p->scrolled);
|
||||||
|
|
||||||
// The preset chooser
|
// The preset chooser
|
||||||
p->sizer_presets = new wxFlexGridSizer(10, 1, 1, 2);
|
p->sizer_presets = new wxFlexGridSizer(10, 1, 1, 2);
|
||||||
|
@ -3809,6 +3809,7 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
|
||||||
model.wipe_tower.position = Vec2d(config.opt_float("wipe_tower_x"), config.opt_float("wipe_tower_y"));
|
model.wipe_tower.position = Vec2d(config.opt_float("wipe_tower_x"), config.opt_float("wipe_tower_y"));
|
||||||
model.wipe_tower.rotation = config.opt_float("wipe_tower_rotation_angle");
|
model.wipe_tower.rotation = config.opt_float("wipe_tower_rotation_angle");
|
||||||
}
|
}
|
||||||
|
const int layer_range_idx = it_snapshot->snapshot_data.layer_range_idx;
|
||||||
// Flags made of Snapshot::Flags enum values.
|
// Flags made of Snapshot::Flags enum values.
|
||||||
unsigned int new_flags = it_snapshot->snapshot_data.flags;
|
unsigned int new_flags = it_snapshot->snapshot_data.flags;
|
||||||
UndoRedo::SnapshotData top_snapshot_data;
|
UndoRedo::SnapshotData top_snapshot_data;
|
||||||
|
@ -3868,7 +3869,7 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
|
||||||
new_selected_layerroot_on_sidebar ? ObjectList::SELECTION_MODE::smLayerRoot :
|
new_selected_layerroot_on_sidebar ? ObjectList::SELECTION_MODE::smLayerRoot :
|
||||||
ObjectList::SELECTION_MODE::smUndef);
|
ObjectList::SELECTION_MODE::smUndef);
|
||||||
if (new_selected_settings_on_sidebar || new_selected_layer_on_sidebar)
|
if (new_selected_settings_on_sidebar || new_selected_layer_on_sidebar)
|
||||||
this->sidebar->obj_list()->set_selected_layers_range_idx(it_snapshot->snapshot_data.layer_range_idx);
|
this->sidebar->obj_list()->set_selected_layers_range_idx(layer_range_idx);
|
||||||
|
|
||||||
this->update_after_undo_redo(temp_snapshot_was_taken);
|
this->update_after_undo_redo(temp_snapshot_was_taken);
|
||||||
// Enable layer editing after the Undo / Redo jump.
|
// Enable layer editing after the Undo / Redo jump.
|
||||||
|
|
|
@ -198,7 +198,7 @@ void Tab::create_preset_tab()
|
||||||
// There is used just additional sizer for m_mode_sizer with right alignment
|
// There is used just additional sizer for m_mode_sizer with right alignment
|
||||||
auto mode_sizer = new wxBoxSizer(wxVERTICAL);
|
auto mode_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
|
mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
|
||||||
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 5);
|
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
|
||||||
|
|
||||||
//Horizontal sizer to hold the tree and the selected page.
|
//Horizontal sizer to hold the tree and the selected page.
|
||||||
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
|
@ -2808,11 +2808,13 @@ ModeButton::ModeButton( wxWindow * parent,
|
||||||
const wxString& mode /* = wxEmptyString*/,
|
const wxString& mode /* = wxEmptyString*/,
|
||||||
const wxSize& size /* = wxDefaultSize*/,
|
const wxSize& size /* = wxDefaultSize*/,
|
||||||
const wxPoint& pos /* = wxDefaultPosition*/) :
|
const wxPoint& pos /* = wxDefaultPosition*/) :
|
||||||
ScalableButton(parent, id, icon_name, mode, size, pos)
|
ScalableButton(parent, id, icon_name, mode, size, pos, wxBU_EXACTFIT)
|
||||||
{
|
{
|
||||||
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
|
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
|
||||||
m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode);
|
m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode);
|
||||||
|
|
||||||
|
SetBitmapMargins(3, 0);
|
||||||
|
|
||||||
//button events
|
//button events
|
||||||
Bind(wxEVT_BUTTON, &ModeButton::OnButton, this);
|
Bind(wxEVT_BUTTON, &ModeButton::OnButton, this);
|
||||||
Bind(wxEVT_ENTER_WINDOW, &ModeButton::OnEnterBtn, this);
|
Bind(wxEVT_ENTER_WINDOW, &ModeButton::OnEnterBtn, this);
|
||||||
|
@ -2841,6 +2843,7 @@ void ModeButton::focus_button(const bool focus)
|
||||||
Slic3r::GUI::wxGetApp().normal_font();
|
Slic3r::GUI::wxGetApp().normal_font();
|
||||||
|
|
||||||
SetFont(new_font);
|
SetFont(new_font);
|
||||||
|
SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT : wxSYS_COLOUR_BTNSHADOW));
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
Update();
|
Update();
|
||||||
|
@ -2851,7 +2854,7 @@ void ModeButton::focus_button(const bool focus)
|
||||||
// ModeSizer
|
// ModeSizer
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 10*/) :
|
ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 0*/) :
|
||||||
wxFlexGridSizer(3, 0, hgap)
|
wxFlexGridSizer(3, 0, hgap)
|
||||||
{
|
{
|
||||||
SetFlexibleDirection(wxHORIZONTAL);
|
SetFlexibleDirection(wxHORIZONTAL);
|
||||||
|
@ -2869,14 +2872,7 @@ ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 10*/) :
|
||||||
|
|
||||||
m_mode_btns.reserve(3);
|
m_mode_btns.reserve(3);
|
||||||
for (const auto& button : buttons) {
|
for (const auto& button : buttons) {
|
||||||
#ifdef __WXOSX__
|
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first));
|
||||||
wxSize sz = parent->GetTextExtent(button.first);
|
|
||||||
// set default width for ModeButtons to correct rendering on OnFocus under OSX
|
|
||||||
sz.x += 2 * em_unit(parent);
|
|
||||||
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first, sz));
|
|
||||||
#else
|
|
||||||
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first));;
|
|
||||||
#endif // __WXOSX__
|
|
||||||
|
|
||||||
m_mode_btns.back()->Bind(wxEVT_BUTTON, std::bind(modebtnfn, std::placeholders::_1, int(m_mode_btns.size() - 1)));
|
m_mode_btns.back()->Bind(wxEVT_BUTTON, std::bind(modebtnfn, std::placeholders::_1, int(m_mode_btns.size() - 1)));
|
||||||
Add(m_mode_btns.back());
|
Add(m_mode_btns.back());
|
||||||
|
|
|
@ -946,7 +946,7 @@ private:
|
||||||
class ModeSizer : public wxFlexGridSizer
|
class ModeSizer : public wxFlexGridSizer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ModeSizer( wxWindow *parent, int hgap = 10);
|
ModeSizer( wxWindow *parent, int hgap = 0);
|
||||||
~ModeSizer() {}
|
~ModeSizer() {}
|
||||||
|
|
||||||
void SetMode(const /*ConfigOptionMode*/int mode);
|
void SetMode(const /*ConfigOptionMode*/int mode);
|
||||||
|
|
Loading…
Reference in a new issue