Update plater and print upon changing object parts and their settings
This commit is contained in:
parent
67ef3f1799
commit
fec41d6dfd
7 changed files with 43 additions and 13 deletions
|
@ -1165,6 +1165,7 @@ sub object_settings_dialog {
|
|||
if (!defined $obj_idx) {
|
||||
($obj_idx, undef) = $self->selected_object;
|
||||
}
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
|
||||
# validate config before opening the settings dialog because
|
||||
# that dialog can't be closed if validation fails, but user
|
||||
|
@ -1173,9 +1174,20 @@ sub object_settings_dialog {
|
|||
|
||||
my $dlg = Slic3r::GUI::Plater::ObjectSettingsDialog->new($self,
|
||||
object => $self->{objects}[$obj_idx],
|
||||
model_object => $self->{model}->objects->[$obj_idx],
|
||||
model_object => $model_object,
|
||||
);
|
||||
$dlg->ShowModal;
|
||||
|
||||
# update thumbnail since parts may have changed
|
||||
if ($dlg->PartsChanged) {
|
||||
$self->make_thumbnail($obj_idx);
|
||||
}
|
||||
|
||||
# update print
|
||||
if ($dlg->PartsChanged || $dlg->PartSettingsChanged) {
|
||||
$self->{print}->delete_object($obj_idx);
|
||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||
}
|
||||
}
|
||||
|
||||
sub object_list_changed {
|
||||
|
|
|
@ -54,7 +54,7 @@ sub new {
|
|||
$self->{btn_delete}->SetFont($Slic3r::GUI::small_font);
|
||||
|
||||
# part settings panel
|
||||
$self->{settings_panel} = Slic3r::GUI::Plater::OverrideSettingsPanel->new($self);
|
||||
$self->{settings_panel} = Slic3r::GUI::Plater::OverrideSettingsPanel->new($self, on_change => sub { $self->{part_settings_changed} = 1; });
|
||||
my $settings_sizer = Wx::StaticBoxSizer->new($self->{staticbox} = Wx::StaticBox->new($self, -1, "Part Settings"), wxVERTICAL);
|
||||
$settings_sizer->Add($self->{settings_panel}, 1, wxEXPAND | wxALL, 0);
|
||||
|
||||
|
@ -210,6 +210,8 @@ sub on_btn_load {
|
|||
# set a default extruder value, since user can't add it manually
|
||||
my $material = $self->{model_object}->model->materials->{$new_volume->material_id};
|
||||
$material->config->set_ifndef('extruder', 1);
|
||||
|
||||
$self->{parts_changed} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +237,7 @@ sub on_btn_delete {
|
|||
}
|
||||
|
||||
$self->{model_object}->delete_volume($itemData->{volume_id});
|
||||
$self->{parts_changed} = 1;
|
||||
}
|
||||
|
||||
$self->reload_tree;
|
||||
|
@ -260,4 +263,14 @@ sub CanClose {
|
|||
return 1;
|
||||
}
|
||||
|
||||
sub PartsChanged {
|
||||
my ($self) = @_;
|
||||
return $self->{parts_changed};
|
||||
}
|
||||
|
||||
sub PartSettingsChanged {
|
||||
my ($self) = @_;
|
||||
return $self->{part_settings_changed};
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -40,6 +40,16 @@ sub new {
|
|||
return $self;
|
||||
}
|
||||
|
||||
sub PartsChanged {
|
||||
my ($self) = @_;
|
||||
return $self->{parts}->PartsChanged;
|
||||
}
|
||||
|
||||
sub PartSettingsChanged {
|
||||
my ($self) = @_;
|
||||
return $self->{parts}->PartSettingsChanged;
|
||||
}
|
||||
|
||||
package Slic3r::GUI::Plater::ObjectDialog::BaseTab;
|
||||
use base 'Wx::Panel';
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ sub new {
|
|||
my ($parent, %params) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
$self->{config} = $params{config}; # may be passed as undef
|
||||
$self->{on_change} = $params{on_change};
|
||||
|
||||
$self->{sizer} = Wx::BoxSizer->new(wxVERTICAL);
|
||||
|
||||
|
@ -36,6 +37,7 @@ sub new {
|
|||
EVT_MENU($menu, $id, sub {
|
||||
$self->{config}->apply(Slic3r::Config->new_from_defaults($opt_key));
|
||||
$self->update_optgroup;
|
||||
$self->{on_change}->() if $self->{on_change};
|
||||
});
|
||||
}
|
||||
$self->PopupMenu($menu, $btn->GetPosition);
|
||||
|
@ -94,6 +96,7 @@ sub update_optgroup {
|
|||
label_font => $Slic3r::GUI::small_font,
|
||||
sidetest_font => $Slic3r::GUI::small_font,
|
||||
label_width => 120,
|
||||
on_change => sub { $self->{on_change}->() if $self->{on_change} },
|
||||
extra_column => sub {
|
||||
my ($line) = @_;
|
||||
my ($opt_key) = @{$line->{options}}; # we assume that we have one option per line
|
||||
|
@ -105,6 +108,7 @@ sub update_optgroup {
|
|||
wxDefaultPosition, wxDefaultSize, Wx::wxBORDER_NONE);
|
||||
EVT_BUTTON($self, $btn, sub {
|
||||
$self->{config}->erase($opt_key);
|
||||
$self->{on_change}->() if $self->{on_change};
|
||||
Slic3r::GUI->CallAfter(sub { $self->update_optgroup });
|
||||
});
|
||||
return $btn;
|
||||
|
|
|
@ -5,7 +5,7 @@ use List::Util qw(first);
|
|||
use Slic3r::Geometry qw(scale);
|
||||
use Slic3r::Geometry::Clipper qw(union_ex);
|
||||
|
||||
has 'id' => (is => 'rw', required => 1, trigger => 1); # sequential number of layer, 0-based
|
||||
has 'id' => (is => 'rw', required => 1); # sequential number of layer, 0-based
|
||||
has 'object' => (is => 'ro', weak_ref => 1, required => 1, handles => [qw(print config)]);
|
||||
has 'upper_layer' => (is => 'rw', weak_ref => 1);
|
||||
has 'regions' => (is => 'ro', default => sub { [] });
|
||||
|
@ -19,11 +19,6 @@ has 'height' => (is => 'ro', required => 1); # layer height in unscal
|
|||
# also known as 'islands' (all regions and surface types are merged here)
|
||||
has 'slices' => (is => 'rw', default => sub { Slic3r::ExPolygon::Collection->new });
|
||||
|
||||
sub _trigger_id {
|
||||
my $self = shift;
|
||||
$_->_trigger_layer for @{$self->regions || []};
|
||||
}
|
||||
|
||||
# the purpose of this method is to be overridden for ::Support layers
|
||||
sub islands {
|
||||
my $self = shift;
|
||||
|
|
|
@ -1091,10 +1091,6 @@ sub auto_assign_extruders {
|
|||
my $config = $material->config;
|
||||
my $extruder_id = $i + 1;
|
||||
$config->set_ifndef('extruder', $extruder_id);
|
||||
#$config->set_ifndef('perimeter_extruder', $extruder_id);
|
||||
#$config->set_ifndef('infill_extruder', $extruder_id);
|
||||
#$config->set_ifndef('support_material_extruder', $extruder_id);
|
||||
#$config->set_ifndef('support_material_interface_extruder', $extruder_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue