Assign a default extruder for newly added parts too

This commit is contained in:
Alessandro Ranellucci 2014-03-23 15:25:26 +01:00
parent d75417601e
commit 67ef3f1799
2 changed files with 8 additions and 2 deletions

View file

@ -117,7 +117,7 @@ sub _build_line {
my ($line, $grid_sizer) = @_;
if ($self->extra_column) {
if (defined my $item = $self->extra_column->($line)) {
if (defined (my $item = $self->extra_column->($line))) {
$grid_sizer->Add($item, 0, wxALIGN_CENTER_VERTICAL, 0);
} else {
$grid_sizer->AddSpacer(1);

View file

@ -199,11 +199,17 @@ sub on_btn_load {
my $new_volume = $self->{model_object}->add_volume($volume);
$new_volume->modifier($is_modifier);
if (!defined $new_volume->material_id) {
# it looks like this block is never entered because all input volumes seem to have an assigned material
# TODO: check we can assume that for any input format
my $material_name = basename($input_file);
$material_name =~ s/\.(stl|obj)$//i;
$self->{model_object}->model->set_material($material_name);
my $material = $self->{model_object}->model->set_material($material_name);
$new_volume->material_id($material_name);
}
# 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);
}
}
}