mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 14:04:11 -06:00
Merge with latest master
This commit is contained in:
commit
a7298d9d89
469 changed files with 186404 additions and 685 deletions
|
@ -1401,7 +1401,7 @@ sub Render {
|
|||
if ($self->enable_picking) {
|
||||
$self->mark_volumes_for_layer_height;
|
||||
$self->volumes->set_print_box($self->bed_bounding_box->x_min, $self->bed_bounding_box->y_min, 0.0, $self->bed_bounding_box->x_max, $self->bed_bounding_box->y_max, $self->{config}->get('max_print_height'));
|
||||
$self->volumes->update_outside_state($self->{config}, 0);
|
||||
$self->volumes->check_outside_state($self->{config});
|
||||
# do not cull backfaces to show broken geometry, if any
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
|
@ -2192,10 +2192,8 @@ sub reset_legend_texture {
|
|||
}
|
||||
|
||||
sub get_current_print_zs {
|
||||
my ($self) = @_;
|
||||
|
||||
my $count = $self->volumes->get_current_print_zs();
|
||||
return $count;
|
||||
my ($self, $active_only) = @_;
|
||||
return $self->volumes->get_current_print_zs($active_only);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -191,7 +191,7 @@ sub _init_menubar {
|
|||
# File menu
|
||||
my $fileMenu = Wx::Menu->new;
|
||||
{
|
||||
wxTheApp->append_menu_item($fileMenu, L("Open STL/OBJ/AMF…\tCtrl+O"), L('Open a model'), sub {
|
||||
wxTheApp->append_menu_item($fileMenu, L("Open STL/OBJ/AMF/3MF…\tCtrl+O"), L('Open a model'), sub {
|
||||
$self->{plater}->add if $self->{plater};
|
||||
}, undef, undef); #'brick_add.png');
|
||||
$self->_append_menu_item($fileMenu, L("&Load Config…\tCtrl+L"), L('Load exported configuration file'), sub {
|
||||
|
@ -337,6 +337,9 @@ sub _init_menubar {
|
|||
$self->_append_menu_item($helpMenu, L("System Info"), L('Show system information'), sub {
|
||||
wxTheApp->system_info;
|
||||
});
|
||||
$self->_append_menu_item($helpMenu, L("Show &Configuration Folder"), L('Show user configuration folder (datadir)'), sub {
|
||||
Slic3r::GUI::desktop_open_datadir_folder();
|
||||
});
|
||||
$self->_append_menu_item($helpMenu, L("Report an Issue"), L('Report an issue on the Slic3r Prusa Edition'), sub {
|
||||
Wx::LaunchDefaultBrowser('http://github.com/prusa3d/slic3r/issues/new');
|
||||
});
|
||||
|
@ -355,8 +358,8 @@ sub _init_menubar {
|
|||
$menubar->Append($self->{object_menu}, L("&Object")) if $self->{object_menu};
|
||||
$menubar->Append($windowMenu, L("&Window"));
|
||||
$menubar->Append($self->{viewMenu}, L("&View")) if $self->{viewMenu};
|
||||
# Add a configuration menu.
|
||||
Slic3r::GUI::add_config_menu($menubar, $self->{preferences_event}, $self->{lang_ch_event});
|
||||
# Add additional menus from C++
|
||||
Slic3r::GUI::add_menus($menubar, $self->{preferences_event}, $self->{lang_ch_event});
|
||||
$menubar->Append($helpMenu, L("&Help"));
|
||||
$self->SetMenuBar($menubar);
|
||||
}
|
||||
|
|
|
@ -225,9 +225,13 @@ sub new {
|
|||
$self->{btoolbar}->Add($self->{"btn_layer_editing"});
|
||||
}
|
||||
|
||||
### Panel for right column
|
||||
$self->{right_panel} = Wx::Panel->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
|
||||
### Scrolled Window for info boxes
|
||||
my $scrolled_window_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||
my $scrolled_window_panel = Wx::ScrolledWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
$scrolled_window_sizer->SetMinSize([310, -1]);
|
||||
my $scrolled_window_panel = Wx::ScrolledWindow->new($self->{right_panel}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
$scrolled_window_panel->SetSizer($scrolled_window_sizer);
|
||||
$scrolled_window_panel->SetScrollbars(1, 1, 1, 1);
|
||||
|
||||
|
@ -249,11 +253,11 @@ sub new {
|
|||
});
|
||||
|
||||
# right pane buttons
|
||||
$self->{btn_export_gcode} = Wx::Button->new($self, -1, L("Export G-code…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_reslice} = Wx::Button->new($self, -1, L("Slice now"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_print} = Wx::Button->new($self, -1, L("Print…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_send_gcode} = Wx::Button->new($self, -1, L("Send to printer"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_export_stl} = Wx::Button->new($self, -1, L("Export STL…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_export_gcode} = Wx::Button->new($self->{right_panel}, -1, L("Export G-code…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_reslice} = Wx::Button->new($self->{right_panel}, -1, L("Slice now"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_print} = Wx::Button->new($self->{right_panel}, -1, L("Print…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_send_gcode} = Wx::Button->new($self->{right_panel}, -1, L("Send to printer"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
$self->{btn_export_stl} = Wx::Button->new($self->{right_panel}, -1, L("Export STL…"), wxDefaultPosition, [-1, 30], wxBU_LEFT);
|
||||
#$self->{btn_export_gcode}->SetFont($Slic3r::GUI::small_font);
|
||||
#$self->{btn_export_stl}->SetFont($Slic3r::GUI::small_font);
|
||||
$self->{btn_print}->Hide;
|
||||
|
@ -390,9 +394,9 @@ sub new {
|
|||
# $self->{preset_choosers}{$group}[$idx]
|
||||
$self->{preset_choosers} = {};
|
||||
for my $group (qw(print filament printer)) {
|
||||
my $text = Wx::StaticText->new($self, -1, "$group_labels{$group}:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
|
||||
my $text = Wx::StaticText->new($self->{right_panel}, -1, "$group_labels{$group}:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
|
||||
$text->SetFont($Slic3r::GUI::small_font);
|
||||
my $choice = Wx::BitmapComboBox->new($self, -1, "", wxDefaultPosition, wxDefaultSize, [], wxCB_READONLY);
|
||||
my $choice = Wx::BitmapComboBox->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, [], wxCB_READONLY);
|
||||
if ($group eq 'filament') {
|
||||
EVT_LEFT_DOWN($choice, sub { $self->filament_color_box_lmouse_down(0, @_); } );
|
||||
}
|
||||
|
@ -407,10 +411,11 @@ sub new {
|
|||
$presets->Add($text, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxRIGHT, 4);
|
||||
$presets->Add($choice, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxBOTTOM, 1);
|
||||
}
|
||||
$presets->Layout;
|
||||
}
|
||||
|
||||
my $frequently_changed_parameters_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||
Slic3r::GUI::add_frequently_changed_parameters($self, $frequently_changed_parameters_sizer, $presets);
|
||||
Slic3r::GUI::add_frequently_changed_parameters($self->{right_panel}, $frequently_changed_parameters_sizer, $presets);
|
||||
|
||||
my $object_info_sizer;
|
||||
{
|
||||
|
@ -514,9 +519,12 @@ sub new {
|
|||
# Show the box initially, let it be shown after the slicing is finished.
|
||||
$self->{"print_info_box_show"}->(0);
|
||||
|
||||
$right_sizer->SetSizeHints($self->{right_panel});
|
||||
$self->{right_panel}->SetSizer($right_sizer);
|
||||
|
||||
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||
$hsizer->Add($self->{preview_notebook}, 1, wxEXPAND | wxTOP, 1);
|
||||
$hsizer->Add($right_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
||||
$hsizer->Add($self->{right_panel}, 0, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
||||
|
||||
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||
$sizer->Add($self->{htoolbar}, 0, wxEXPAND, 0) if $self->{htoolbar};
|
||||
|
@ -559,7 +567,8 @@ sub _on_select_preset {
|
|||
wxTheApp->{preset_bundle}->update_platter_filament_ui($idx, $choice);
|
||||
} else {
|
||||
my $selected_item = $choice->GetSelection();
|
||||
return if ($selected_item == $self->{"selected_item_$group"});
|
||||
return if ($selected_item == $self->{"selected_item_$group"} &&
|
||||
!Slic3r::GUI::get_preset_tab($group)->current_preset_is_dirty);
|
||||
|
||||
my $selected_string = $choice->GetString($selected_item);
|
||||
if ($selected_string eq ("------- ".L("System presets")." -------") ||
|
||||
|
@ -1732,7 +1741,7 @@ sub on_extruders_change {
|
|||
my @presets = $choices->[0]->GetStrings;
|
||||
|
||||
# initialize new choice
|
||||
my $choice = Wx::BitmapComboBox->new($self, -1, "", wxDefaultPosition, wxDefaultSize, [@presets], wxCB_READONLY);
|
||||
my $choice = Wx::BitmapComboBox->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, [@presets], wxCB_READONLY);
|
||||
my $extruder_idx = scalar @$choices;
|
||||
EVT_LEFT_DOWN($choice, sub { $self->filament_color_box_lmouse_down($extruder_idx, @_); } );
|
||||
push @$choices, $choice;
|
||||
|
@ -1964,7 +1973,7 @@ sub object_list_changed {
|
|||
}
|
||||
|
||||
my $export_in_progress = $self->{export_gcode_output_file} || $self->{send_gcode_file};
|
||||
my $model_fits = $self->{model}->fits_print_volume($self->{config});
|
||||
my $model_fits = $self->{canvas3D} ? $self->{canvas3D}->volumes->check_outside_state($self->{config}) : 1;
|
||||
my $method = ($have_objects && ! $export_in_progress && $model_fits) ? 'Enable' : 'Disable';
|
||||
$self->{"btn_$_"}->$method
|
||||
for grep $self->{"btn_$_"}, qw(reslice export_gcode print send_gcode);
|
||||
|
@ -1976,7 +1985,7 @@ sub selection_changed {
|
|||
my ($obj_idx, $object) = $self->selected_object;
|
||||
my $have_sel = defined $obj_idx;
|
||||
|
||||
$self->Freeze;
|
||||
$self->{right_panel}->Freeze;
|
||||
if ($self->{htoolbar}) {
|
||||
# On OSX or Linux
|
||||
$self->{htoolbar}->EnableTool($_, $have_sel)
|
||||
|
@ -2030,7 +2039,7 @@ sub selection_changed {
|
|||
|
||||
# prepagate the event to the frame (a custom Wx event would be cleaner)
|
||||
$self->GetFrame->on_plater_selection_changed($have_sel);
|
||||
$self->Thaw;
|
||||
$self->{right_panel}->Thaw;
|
||||
}
|
||||
|
||||
sub select_object {
|
||||
|
|
|
@ -237,15 +237,16 @@ sub reload_scene {
|
|||
# checks for geometry outside the print volume to render it accordingly
|
||||
if (scalar @{$self->volumes} > 0)
|
||||
{
|
||||
if (!$self->{model}->fits_print_volume($self->{config})) {
|
||||
my $contained = $self->volumes->check_outside_state($self->{config});
|
||||
if (!$contained) {
|
||||
$self->set_warning_enabled(1);
|
||||
Slic3r::GUI::_3DScene::generate_warning_texture(L("Detected object outside print volume"));
|
||||
$self->on_enable_action_buttons->(0) if ($self->on_enable_action_buttons);
|
||||
} else {
|
||||
$self->set_warning_enabled(0);
|
||||
$self->volumes->update_outside_state($self->{config}, 1);
|
||||
$self->volumes->reset_outside_state();
|
||||
Slic3r::GUI::_3DScene::reset_warning_texture();
|
||||
$self->on_enable_action_buttons->(1) if ($self->on_enable_action_buttons);
|
||||
$self->on_enable_action_buttons->(scalar @{$self->{model}->objects} > 0) if ($self->on_enable_action_buttons);
|
||||
}
|
||||
} else {
|
||||
$self->set_warning_enabled(0);
|
||||
|
|
|
@ -328,22 +328,12 @@ sub load_print {
|
|||
}
|
||||
|
||||
if ($n_layers == 0) {
|
||||
$self->enabled(0);
|
||||
$self->set_z_range(0,0);
|
||||
$self->slider_low->Hide;
|
||||
$self->slider_high->Hide;
|
||||
$self->{z_label_low}->SetLabel("");
|
||||
$self->{z_label_high}->SetLabel("");
|
||||
$self->{z_label_low_idx}->SetLabel("");
|
||||
$self->{z_label_high_idx}->SetLabel("");
|
||||
$self->reset_sliders;
|
||||
$self->canvas->reset_legend_texture();
|
||||
$self->canvas->Refresh; # clears canvas
|
||||
return;
|
||||
}
|
||||
|
||||
# used to set the sliders to the extremes of the current zs range
|
||||
$self->{force_sliders_full_range} = 0;
|
||||
|
||||
if ($self->{preferred_color_mode} eq 'tool_or_feature') {
|
||||
# It is left to Slic3r to decide whether the print shall be colored by the tool or by the feature.
|
||||
# Color by feature if it is a single extruder print.
|
||||
|
@ -369,6 +359,9 @@ sub load_print {
|
|||
}
|
||||
|
||||
if ($self->IsShown) {
|
||||
# used to set the sliders to the extremes of the current zs range
|
||||
$self->{force_sliders_full_range} = 0;
|
||||
|
||||
if ($self->gcode_preview_data->empty) {
|
||||
# load skirt and brim
|
||||
$self->canvas->load_print_toolpaths($self->print, \@colors);
|
||||
|
@ -380,21 +373,39 @@ sub load_print {
|
|||
#$self->canvas->volumes->[$_]->color->[3] = 0.2 for @volume_ids;
|
||||
}
|
||||
$self->show_hide_ui_elements('simple');
|
||||
$self->canvas->reset_legend_texture();
|
||||
} else {
|
||||
$self->{force_sliders_full_range} = (scalar(@{$self->canvas->volumes}) == 0);
|
||||
$self->canvas->load_gcode_preview($self->print, $self->gcode_preview_data, \@colors);
|
||||
$self->show_hide_ui_elements('full');
|
||||
|
||||
# recalculates zs and update sliders accordingly
|
||||
$self->{layers_z} = $self->canvas->get_current_print_zs();
|
||||
$self->{layers_z} = $self->canvas->get_current_print_zs(1);
|
||||
$n_layers = scalar(@{$self->{layers_z}});
|
||||
}
|
||||
if ($n_layers == 0) {
|
||||
# all layers filtered out
|
||||
$self->reset_sliders;
|
||||
$self->canvas->Refresh; # clears canvas
|
||||
}
|
||||
}
|
||||
|
||||
$self->update_sliders($n_layers);
|
||||
$self->update_sliders($n_layers) if ($n_layers > 0);
|
||||
$self->_loaded(1);
|
||||
}
|
||||
}
|
||||
|
||||
sub reset_sliders {
|
||||
my ($self) = @_;
|
||||
$self->enabled(0);
|
||||
$self->set_z_range(0,0);
|
||||
$self->slider_low->Hide;
|
||||
$self->slider_high->Hide;
|
||||
$self->{z_label_low}->SetLabel("");
|
||||
$self->{z_label_high}->SetLabel("");
|
||||
$self->{z_label_low_idx}->SetLabel("");
|
||||
$self->{z_label_high_idx}->SetLabel("");
|
||||
}
|
||||
|
||||
sub update_sliders
|
||||
{
|
||||
my ($self, $n_layers) = @_;
|
||||
|
@ -409,18 +420,32 @@ sub update_sliders
|
|||
$z_idx_low = 0;
|
||||
$z_idx_high = $n_layers - 1;
|
||||
} elsif ($z_idx_high < $n_layers && ($self->single_layer || $z_idx_high != 0)) {
|
||||
# use $z_idx
|
||||
} else {
|
||||
# search new indices for nearest z (size of $self->{layers_z} may change in dependence of what is shown)
|
||||
if (defined($self->{z_low})) {
|
||||
for (my $i = scalar(@{$self->{layers_z}}) - 1; $i >= 0; $i -= 1) {
|
||||
if ($self->{layers_z}[$i] <= $self->{z_low}) {
|
||||
$z_idx_low = $i;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defined($self->{z_high})) {
|
||||
for (my $i = scalar(@{$self->{layers_z}}) - 1; $i >= 0; $i -= 1) {
|
||||
if ($self->{layers_z}[$i] <= $self->{z_high}) {
|
||||
$z_idx_high = $i;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elsif ($z_idx_high >= $n_layers) {
|
||||
# Out of range. Disable 'single layer' view.
|
||||
$self->single_layer(0);
|
||||
$self->{checkbox_singlelayer}->SetValue(0);
|
||||
$z_idx_low = 0;
|
||||
$z_idx_high = $n_layers - 1;
|
||||
}
|
||||
if ($self->single_layer) {
|
||||
$z_idx_low = $z_idx_high;
|
||||
} elsif ($z_idx_low > $z_idx_high) {
|
||||
} else {
|
||||
$z_idx_low = 0;
|
||||
$z_idx_high = $n_layers - 1;
|
||||
}
|
||||
|
||||
$self->slider_low->SetValue($z_idx_low);
|
||||
|
@ -436,12 +461,25 @@ sub set_z_range
|
|||
my ($self, $z_low, $z_high) = @_;
|
||||
|
||||
return if !$self->enabled;
|
||||
$self->{z_low} = $z_low;
|
||||
$self->{z_high} = $z_high;
|
||||
$self->{z_label_low}->SetLabel(sprintf '%.2f', $z_low);
|
||||
$self->{z_label_high}->SetLabel(sprintf '%.2f', $z_high);
|
||||
my $z_idx_low = 1 + $self->slider_low->GetValue;
|
||||
my $z_idx_high = 1 + $self->slider_high->GetValue;
|
||||
$self->{z_label_low_idx}->SetLabel(sprintf '%d', $z_idx_low);
|
||||
$self->{z_label_high_idx}->SetLabel(sprintf '%d', $z_idx_high);
|
||||
|
||||
my $layers_z = $self->canvas->get_current_print_zs(0);
|
||||
for (my $i = 0; $i < scalar(@{$layers_z}); $i += 1) {
|
||||
if (($z_low - 1e-6 < @{$layers_z}[$i]) && (@{$layers_z}[$i] < $z_low + 1e-6)) {
|
||||
$self->{z_label_low_idx}->SetLabel(sprintf '%d', $i + 1);
|
||||
last;
|
||||
}
|
||||
}
|
||||
for (my $i = 0; $i < scalar(@{$layers_z}); $i += 1) {
|
||||
if (($z_high - 1e-6 < @{$layers_z}[$i]) && (@{$layers_z}[$i] < $z_high + 1e-6)) {
|
||||
$self->{z_label_high_idx}->SetLabel(sprintf '%d', $i + 1);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$self->canvas->set_toolpaths_range($z_low - 1e-6, $z_high + 1e-6);
|
||||
$self->canvas->Refresh if $self->IsShown;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ sub new {
|
|||
$self->SetSizer($sizer);
|
||||
$self->SetMinSize($self->GetSize);
|
||||
|
||||
$self->Layout;
|
||||
|
||||
wxTheApp->restore_window_pos($self, "object_settings");
|
||||
|
||||
return $self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue