mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	Expose all multi-extruder settings to the GUI
This commit is contained in:
		
							parent
							
								
									793301d319
								
							
						
					
					
						commit
						2548d5b993
					
				
					 4 changed files with 35 additions and 18 deletions
				
			
		|  | @ -88,7 +88,7 @@ sub OnInit { | ||||||
|         $fileMenu->AppendSeparator(); |         $fileMenu->AppendSeparator(); | ||||||
|         $fileMenu->Append(wxID_EXIT, "&Quit", 'Quit Slic3r'); |         $fileMenu->Append(wxID_EXIT, "&Quit", 'Quit Slic3r'); | ||||||
|         EVT_MENU($frame, MI_LOAD_CONF, sub { $self->{skeinpanel}->load_config_file }); |         EVT_MENU($frame, MI_LOAD_CONF, sub { $self->{skeinpanel}->load_config_file }); | ||||||
|         EVT_MENU($frame, MI_EXPORT_CONF, sub { $self->{skeinpanel}->save_config }); |         EVT_MENU($frame, MI_EXPORT_CONF, sub { $self->{skeinpanel}->export_config }); | ||||||
|         EVT_MENU($frame, MI_QUICK_SLICE, sub { $self->{skeinpanel}->do_slice; |         EVT_MENU($frame, MI_QUICK_SLICE, sub { $self->{skeinpanel}->do_slice; | ||||||
|                                                $repeat->Enable(defined $Slic3r::GUI::SkeinPanel::last_input_file) }); |                                                $repeat->Enable(defined $Slic3r::GUI::SkeinPanel::last_input_file) }); | ||||||
|         EVT_MENU($frame, MI_REPEAT_QUICK, sub { $self->{skeinpanel}->do_slice(reslice => 1) }); |         EVT_MENU($frame, MI_REPEAT_QUICK, sub { $self->{skeinpanel}->do_slice(reslice => 1) }); | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ sub new { | ||||||
|     my ($parent) = @_; |     my ($parent) = @_; | ||||||
|     my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); |     my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | ||||||
|     $self->{config} = Slic3r::Config->new_from_defaults(qw( |     $self->{config} = Slic3r::Config->new_from_defaults(qw( | ||||||
|         bed_size print_center complete_objects extruder_clearance_radius skirts skirt_distance extruders_count |         bed_size print_center complete_objects extruder_clearance_radius skirts skirt_distance | ||||||
|     )); |     )); | ||||||
|      |      | ||||||
|     $self->{canvas} = Wx::Panel->new($self, -1, wxDefaultPosition, CANVAS_SIZE, wxTAB_TRAVERSAL); |     $self->{canvas} = Wx::Panel->new($self, -1, wxDefaultPosition, CANVAS_SIZE, wxTAB_TRAVERSAL); | ||||||
|  | @ -227,7 +227,7 @@ sub new { | ||||||
|             $self->{preset_choosers}{$group} = [$choice]; |             $self->{preset_choosers}{$group} = [$choice]; | ||||||
|             EVT_CHOICE($choice, $choice, sub { |             EVT_CHOICE($choice, $choice, sub { | ||||||
|                 my $choice = shift;  # avoid leaks |                 my $choice = shift;  # avoid leaks | ||||||
|                 return if $group eq 'filament' && ($self->{config}->get('extruders_count') // 1) > 1; #/ |                 return if $group eq 'filament' && @{$self->{preset_choosers}{filament}} > 1; #/ | ||||||
|                 $self->skeinpanel->{options_tabs}{$group}->select_preset($choice->GetSelection); |                 $self->skeinpanel->{options_tabs}{$group}->select_preset($choice->GetSelection); | ||||||
|             }); |             }); | ||||||
|              |              | ||||||
|  | @ -711,9 +711,6 @@ sub recenter { | ||||||
| sub on_config_change { | sub on_config_change { | ||||||
|     my $self = shift; |     my $self = shift; | ||||||
|     my ($opt_key, $value) = @_; |     my ($opt_key, $value) = @_; | ||||||
|     if (exists $self->{config}{$opt_key}) { |  | ||||||
|         $self->{config}->set($opt_key, $value); |  | ||||||
|         $self->_update_bed_size if $opt_key eq 'bed_size'; |  | ||||||
|     if ($opt_key eq 'extruders_count' && defined $value) { |     if ($opt_key eq 'extruders_count' && defined $value) { | ||||||
|         my $choices = $self->{preset_choosers}{filament}; |         my $choices = $self->{preset_choosers}{filament}; | ||||||
|         while (@$choices < $value) { |         while (@$choices < $value) { | ||||||
|  | @ -726,7 +723,9 @@ sub on_config_change { | ||||||
|             pop @$choices; |             pop @$choices; | ||||||
|         } |         } | ||||||
|         $self->Layout; |         $self->Layout; | ||||||
|         } |     } elsif (exists $self->{config}{$opt_key}) { | ||||||
|  |         $self->{config}->set($opt_key, $value); | ||||||
|  |         $self->_update_bed_size if $opt_key eq 'bed_size'; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -164,7 +164,7 @@ sub do_slice { | ||||||
|     Slic3r::GUI::catch_error($self, sub { $process_dialog->Destroy if $process_dialog }); |     Slic3r::GUI::catch_error($self, sub { $process_dialog->Destroy if $process_dialog }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| sub save_config { | sub export_config { | ||||||
|     my $self = shift; |     my $self = shift; | ||||||
|      |      | ||||||
|     my $config = $self->config; |     my $config = $self->config; | ||||||
|  |  | ||||||
|  | @ -454,6 +454,13 @@ sub build { | ||||||
|         }, |         }, | ||||||
|     ]); |     ]); | ||||||
|      |      | ||||||
|  |     $self->add_options_page('Multiple Extruders', 'funnel.png', optgroups => [ | ||||||
|  |         { | ||||||
|  |             title => 'Extruders', | ||||||
|  |             options => [qw(perimeter_extruder infill_extruder support_material_extruder)], | ||||||
|  |         }, | ||||||
|  |     ]); | ||||||
|  |      | ||||||
|     $self->add_options_page('Advanced', 'wrench.png', optgroups => [ |     $self->add_options_page('Advanced', 'wrench.png', optgroups => [ | ||||||
|         { |         { | ||||||
|             title => 'Extrusion width', |             title => 'Extrusion width', | ||||||
|  | @ -643,6 +650,17 @@ sub on_preset_loaded { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | sub load_external_config { | ||||||
|  |     my $self = shift; | ||||||
|  |     $self->SUPER::load_external_config(@_); | ||||||
|  |      | ||||||
|  |     Slic3r::GUI::warning_catcher($self)->( | ||||||
|  |         "Your configuration was imported. However, Slic3r is currently only able to import settings " | ||||||
|  |         . "for the first defined filament. We recommend you don't use exported configuration files " | ||||||
|  |         . "for multi-extruder setups and rely on the built-in preset management system instead.") | ||||||
|  |         if @{ $self->{config}->nozzle_diameter } > 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| package Slic3r::GUI::Tab::Page; | package Slic3r::GUI::Tab::Page; | ||||||
| use Wx qw(:misc :panel :sizer); | use Wx qw(:misc :panel :sizer); | ||||||
| use base 'Wx::ScrolledWindow'; | use base 'Wx::ScrolledWindow'; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci