mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
Merge branch 'master' into dev
This commit is contained in:
commit
570bec299f
20 changed files with 1033 additions and 1093 deletions
|
|
@ -179,8 +179,7 @@ bool GUI_App::on_init_inner()
|
|||
wxCHECK_MSG(wxDirExists(resources_dir), false,
|
||||
wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
|
||||
|
||||
//SetAppName(SLIC3R_APP_KEY);
|
||||
SetAppName(SLIC3R_APP_KEY "-beta");
|
||||
SetAppName(SLIC3R_APP_KEY);
|
||||
SetAppDisplayName(SLIC3R_APP_NAME);
|
||||
|
||||
// Enable this to get the default Win32 COMCTRL32 behavior of static boxes.
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range)
|
|||
auto temp = new wxStaticText(m_parent, wxID_ANY, _(L("mm")));
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
temp->SetFont(wxGetApp().normal_font());
|
||||
sizer->Add(temp, 0, wxLEFT|wxRIGHT, wxGetApp().em_unit());
|
||||
sizer->Add(temp, 0, wxLEFT, wxGetApp().em_unit());
|
||||
|
||||
m_grid_sizer->Add(sizer);
|
||||
|
||||
|
|
@ -154,16 +154,16 @@ void ObjectLayers::create_layers_list()
|
|||
|
||||
sizer->Add(del_btn, 0, wxRIGHT | wxLEFT, em_unit(m_parent));
|
||||
|
||||
del_btn->Bind(wxEVT_BUTTON, [this, range](wxEvent &event) {
|
||||
del_btn->Bind(wxEVT_BUTTON, [range](wxEvent &) {
|
||||
wxGetApp().obj_list()->del_layer_range(range);
|
||||
});
|
||||
|
||||
auto add_btn = new ScalableButton(m_parent, wxID_ANY, m_bmp_add);
|
||||
add_btn->SetToolTip(_(L("Add layer range")));
|
||||
|
||||
sizer->Add(add_btn, 0, wxRIGHT, em_unit(m_parent));
|
||||
sizer->Add(add_btn);
|
||||
|
||||
add_btn->Bind(wxEVT_BUTTON, [this, range](wxEvent &event) {
|
||||
add_btn->Bind(wxEVT_BUTTON, [range](wxEvent &) {
|
||||
wxGetApp().obj_list()->add_layer_range_after_current(range);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2500,15 +2500,18 @@ void ObjectList::remove()
|
|||
auto delete_item = [this](wxDataViewItem item)
|
||||
{
|
||||
wxDataViewItem parent = m_objects_model->GetParent(item);
|
||||
if (m_objects_model->GetItemType(item) & itObject)
|
||||
ItemType type = m_objects_model->GetItemType(item);
|
||||
if (type & itObject)
|
||||
delete_from_model_and_list(itObject, m_objects_model->GetIdByItem(item), -1);
|
||||
else {
|
||||
if (m_objects_model->GetItemType(item) & itLayer) {
|
||||
if (type & (itLayer | itInstance)) {
|
||||
// In case there is just one layer or two instances and we delete it, del_subobject_item will
|
||||
// also remove the parent item. Selection should therefore pass to the top parent (object).
|
||||
wxDataViewItemArray children;
|
||||
if (m_objects_model->GetChildren(parent, children) == 1)
|
||||
if (m_objects_model->GetChildren(parent, children) == (type & itLayer ? 1 : 2))
|
||||
parent = m_objects_model->GetTopParent(item);
|
||||
}
|
||||
|
||||
|
||||
del_subobject_item(item);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -625,6 +625,14 @@ void ObjectManipulation::update_reset_buttons_visibility()
|
|||
m_reset_rotation_button->Show(show_rotation);
|
||||
m_reset_scale_button->Show(show_scale);
|
||||
m_drop_to_bed_button->Show(show_drop_to_bed);
|
||||
|
||||
// Because of CallAfter we need to layout sidebar after Show/hide of reset buttons one more time
|
||||
Sidebar& panel = wxGetApp().sidebar();
|
||||
if (!panel.IsFrozen()) {
|
||||
panel.Freeze();
|
||||
panel.Layout();
|
||||
panel.Thaw();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool kee
|
|||
bool force_sliders_full_range = was_empty;
|
||||
if (!keep_z_range)
|
||||
{
|
||||
bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > 1e-6;
|
||||
bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > DoubleSlider::epsilon()/*1e-6*/;
|
||||
force_sliders_full_range |= span_changed;
|
||||
}
|
||||
bool snap_to_min = force_sliders_full_range || m_slider->is_lower_at_min();
|
||||
|
|
@ -650,12 +650,12 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool kee
|
|||
int idx_high = m_slider->GetMaxValue();
|
||||
if (! layers_z.empty()) {
|
||||
if (! snap_to_min) {
|
||||
int idx_new = find_close_layer_idx(layers_z, z_low, 1e-6);
|
||||
int idx_new = find_close_layer_idx(layers_z, z_low, DoubleSlider::epsilon()/*1e-6*/);
|
||||
if (idx_new != -1)
|
||||
idx_low = idx_new;
|
||||
}
|
||||
if (! snap_to_max) {
|
||||
int idx_new = find_close_layer_idx(layers_z, z_high, 1e-6);
|
||||
int idx_new = find_close_layer_idx(layers_z, z_high, DoubleSlider::epsilon()/*1e-6*/);
|
||||
if (idx_new != -1)
|
||||
idx_high = idx_new;
|
||||
}
|
||||
|
|
@ -691,7 +691,12 @@ void Preview::fill_slider_values(std::vector<std::pair<int, double>> &values,
|
|||
std::vector<double> &ticks_from_config = (wxGetApp().preset_bundle->project_config.option<ConfigOptionFloats>("colorprint_heights"))->values;
|
||||
unsigned int old_size = ticks_from_config.size();
|
||||
ticks_from_config.erase(std::remove_if(ticks_from_config.begin(), ticks_from_config.end(),
|
||||
[values](double val) { return values.back().second < val; }),
|
||||
[values](double val)
|
||||
{
|
||||
return (values.back().second < val &&
|
||||
// we can't ignore tick on last layer
|
||||
fabs(values.back().second - val) > DoubleSlider::epsilon());
|
||||
}),
|
||||
ticks_from_config.end());
|
||||
if (ticks_from_config.size() != old_size)
|
||||
m_schedule_background_process();
|
||||
|
|
|
|||
|
|
@ -1495,13 +1495,16 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr
|
|||
// To avoid the errors of number rounding for different combination of monitor configuration,
|
||||
// let use scaled 8px, as a smallest icon unit
|
||||
const int icon_unit = 8 * scale_f + 0.5f;
|
||||
const int icon_height = 2 * icon_unit; //16 * scale_f + 0.5f;
|
||||
const int normal_icon_width = 2 * icon_unit; //16 * scale_f + 0.5f;
|
||||
const int thin_icon_width = icon_unit; //8 * scale_f + 0.5f;
|
||||
const int wide_icon_width = 3 * icon_unit; //24 * scale_f + 0.5f;
|
||||
|
||||
const int space_icon_width = 2 * scale_f + 0.5f;
|
||||
|
||||
// To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size, so
|
||||
// set a bitmap height to m_bitmapLock->GetHeight()
|
||||
const int icon_height = m_bitmapLock->GetHeight();//2 * icon_unit; //16 * scale_f + 0.5f;
|
||||
|
||||
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
|
||||
const Preset &preset = this->filaments.preset(i);
|
||||
bool selected = this->filament_presets[idx_extruder] == preset.name;
|
||||
|
|
|
|||
|
|
@ -545,6 +545,9 @@ void TabSLAMaterial::init_options_list()
|
|||
void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page)
|
||||
{
|
||||
auto opt = m_options_list.find(opt_key);
|
||||
if (opt == m_options_list.end())
|
||||
return;
|
||||
|
||||
if (sys_page) sys_page = (opt->second & osSystemValue) != 0;
|
||||
modified_page |= (opt->second & osInitValue) == 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2201,9 +2201,10 @@ std::vector<double> DoubleSlider::GetTicksValues() const
|
|||
{
|
||||
std::vector<double> values;
|
||||
|
||||
const int val_size = m_values.size();
|
||||
if (!m_values.empty())
|
||||
for (auto tick : m_ticks) {
|
||||
if (tick > m_values.size())
|
||||
for (int tick : m_ticks) {
|
||||
if (tick > val_size)
|
||||
break;
|
||||
values.push_back(m_values[tick].second);
|
||||
}
|
||||
|
|
@ -2221,9 +2222,10 @@ void DoubleSlider::SetTicksValues(const std::vector<double>& heights)
|
|||
m_ticks.clear();
|
||||
unsigned int i = 0;
|
||||
for (auto h : heights) {
|
||||
while (i < m_values.size() && m_values[i].second - 1e-6 < h)
|
||||
while (i < m_values.size() && m_values[i].second - epsilon()/*1e-6*/ < h)
|
||||
++i;
|
||||
if (i == m_values.size())
|
||||
// don't miss last layer if it is
|
||||
if (i == m_values.size() && fabs(m_values[i-1].second - h) > epsilon())
|
||||
return;
|
||||
m_ticks.insert(i-1);
|
||||
}
|
||||
|
|
@ -2298,6 +2300,10 @@ void DoubleSlider::draw_action_icon(wxDC& dc, const wxPoint pt_beg, const wxPoin
|
|||
{
|
||||
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
|
||||
|
||||
// suppress add tick on first layer
|
||||
if (tick == 0)
|
||||
return;
|
||||
|
||||
wxBitmap* icon = m_is_action_icon_focesed ? &m_bmp_add_tick_off.bmp() : &m_bmp_add_tick_on.bmp();
|
||||
if (m_ticks.find(tick) != m_ticks.end())
|
||||
icon = m_is_action_icon_focesed ? &m_bmp_del_tick_off.bmp() : &m_bmp_del_tick_on.bmp();
|
||||
|
|
|
|||
|
|
@ -720,6 +720,9 @@ public:
|
|||
const wxString& name = wxEmptyString);
|
||||
~DoubleSlider() {}
|
||||
|
||||
// permissible error for layer height
|
||||
static double epsilon() { return 0.0011;}
|
||||
|
||||
void msw_rescale();
|
||||
|
||||
int GetMinValue() const { return m_min_value; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue