Merge branch 'sapir-modelcpp'

This commit is contained in:
Alessandro Ranellucci 2014-05-08 11:13:21 +02:00
commit 6e207d3830
17 changed files with 911 additions and 222 deletions

View file

@ -10,7 +10,7 @@ use Slic3r::Print::State ':steps';
use Slic3r::Surface ':types';
has 'print' => (is => 'ro', weak_ref => 1, required => 1);
has 'model_object' => (is => 'ro', required => 1);
has 'model_object' => (is => 'ro', required => 1); # caller is responsible for holding the Model object
has 'region_volumes' => (is => 'rw', default => sub { [] }); # by region_id
has 'copies' => (is => 'ro'); # Slic3r::Point objects in scaled G-code coordinates
has 'config' => (is => 'ro', default => sub { Slic3r::Config::PrintObject->new });

View file

@ -44,15 +44,15 @@ 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;
# apply scaling and rotation supplied from command line if any
foreach my $instance (map @{$_->instances}, @{$model->objects}) {
$instance->scaling_factor($instance->scaling_factor * $self->scale);
$instance->rotation($instance->rotation + $self->rotate);
$instance->set_scaling_factor($instance->scaling_factor * $self->scale);
$instance->set_rotation($instance->rotation + $self->rotate);
}
if ($self->duplicate_grid->[X] > 1 || $self->duplicate_grid->[Y] > 1) {