Fixed one more regression introduced with Model refactoring. Includes regression test

This commit is contained in:
Alessandro Ranellucci 2014-05-15 16:37:18 +02:00
parent dd1183f19a
commit ad99b2a0fd
4 changed files with 24 additions and 5 deletions

View File

@ -197,7 +197,7 @@ sub on_btn_load {
foreach my $object (@{$model->objects}) {
foreach my $volume (@{$object->volumes}) {
my $new_volume = $self->{model_object}->add_volume($volume);
$new_volume->modifier($is_modifier);
$new_volume->set_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

View File

@ -1732,6 +1732,7 @@ t/14_geometry.t
t/15_config.t
t/16_flow.t
t/17_boundingbox.t
t/19_model.t
xsp/BoundingBox.xsp
xsp/Clipper.xsp
xsp/Config.xsp

18
xs/t/19_model.t Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 3;
{
my $model = Slic3r::Model->new;
my $object = $model->_add_object;
isa_ok $object, 'Slic3r::Model::Object::Ref';
isa_ok $object->origin_translation, 'Slic3r::Pointf::Ref';
$object->origin_translation->translate(10,0);
is_deeply \@{$object->origin_translation}, [10,0], 'origin_translation is modified by ref';
}
__END__

View File

@ -151,8 +151,8 @@ ModelMaterial::attributes()
void set_layer_height_ranges(t_layer_height_ranges ranges)
%code%{ THIS->layer_height_ranges = ranges; %};
Clone<Pointf> origin_translation()
%code%{ RETVAL = THIS->origin_translation; %};
Ref<Pointf> origin_translation()
%code%{ RETVAL = &THIS->origin_translation; %};
void set_origin_translation(Pointf* point)
%code%{ THIS->origin_translation = *point; %};
};
@ -185,8 +185,8 @@ ModelMaterial::attributes()
%code%{ RETVAL = THIS->rotation; %};
double scaling_factor()
%code%{ RETVAL = THIS->scaling_factor; %};
Clone<Pointf> offset()
%code%{ RETVAL = THIS->offset; %};
Ref<Pointf> offset()
%code%{ RETVAL = &THIS->offset; %};
void set_rotation(double val)
%code%{ THIS->rotation = val; %};