Use Pointf for origin_translation and pass const refs whenever possible

This commit is contained in:
Alessandro Ranellucci 2014-05-07 00:58:29 +02:00
parent 54a199919b
commit 13af16ea24
7 changed files with 80 additions and 89 deletions

View file

@ -471,8 +471,8 @@ sub reset {
my $self = shift;
@{$self->{objects}} = ();
$self->{model}->delete_all_objects;
$self->{print}->delete_all_objects;
$self->{model}->clear_objects;
$self->{print}->clear_objects;
$self->{list}->DeleteAllItems;
$self->object_list_changed;

View file

@ -58,7 +58,7 @@ sub add_object {
$args{input_file},
$args{config} // Slic3r::Config->new,
$args{layer_height_ranges} // [],
$args{origin_translation} // Slic3r::Point->new,
$args{origin_translation} // Slic3r::Pointf->new,
);
}

View file

@ -105,7 +105,7 @@ sub apply_config {
# the current subdivision of regions does not make sense anymore.
# we need to remove all objects and re-add them
my @models_objects = map [$_->model, $_->model_object], @{$self->objects};
$self->delete_all_objects;
$self->clear_objects;
$self->add_model_object(@$_) for @models_objects;
}
}
@ -202,7 +202,7 @@ sub delete_object {
$self->_state->invalidate(STEP_BRIM);
}
sub delete_all_objects {
sub clear_objects {
my ($self) = @_;
@{$self->objects} = ();
@ -222,7 +222,7 @@ sub reload_object {
# This should also check whether object volumes (parts) have changed.
my @models_objects = map [$_->model, $_->model_object], @{$self->objects};
$self->delete_all_objects;
$self->clear_objects;
$self->add_model_object(@$_) for @models_objects;
}

View file

@ -44,7 +44,7 @@ sub set_model {
my ($self, $model) = @_;
# make method idempotent so that the object is reusable
$self->_print->delete_all_objects;
$self->_print->clear_objects;
# make sure all objects have at least one defined instance
my $need_arrange = $model->add_default_instances;