better handling of too-small and too-short models #929.

These changes handle small models better in the plater preview.
Extremely small thumbnails are preserved instead of culled,
allowing the model to be scaled up. The scale range is extended to
100000% to allow mm-scale objects expressed in meters to be opened
and scaled to mm.
Original coding by mesheldrake
This commit is contained in:
Alessandro Ranellucci 2013-03-30 00:47:13 +01:00
parent ac2356f66a
commit 33a4ec660d

View File

@ -437,7 +437,7 @@ sub changescale {
my ($obj_idx, $object) = $self->selected_object; my ($obj_idx, $object) = $self->selected_object;
# max scale factor should be above 2540 to allow importing files exported in inches # max scale factor should be above 2540 to allow importing files exported in inches
my $scale = Wx::GetNumberFromUser("", "Enter the scale % for the selected object:", "Scale", $object->scale*100, 0, 5000, $self); my $scale = Wx::GetNumberFromUser("", "Enter the scale % for the selected object:", "Scale", $object->scale*100, 0, 100000, $self);
return if !$scale || $scale == -1; return if !$scale || $scale == -1;
$self->{list}->SetItem($obj_idx, 2, "$scale%"); $self->{list}->SetItem($obj_idx, 2, "$scale%");
@ -861,7 +861,7 @@ sub repaint {
@{$parent->{object_previews}} = (); @{$parent->{object_previews}} = ();
for my $obj_idx (0 .. $#{$parent->{objects}}) { for my $obj_idx (0 .. $#{$parent->{objects}}) {
my $object = $parent->{objects}[$obj_idx]; my $object = $parent->{objects}[$obj_idx];
next unless $object->thumbnail; next unless $object->thumbnail && @{$object->thumbnail->expolygons};
for my $instance_idx (0 .. $#{$object->instances}) { for my $instance_idx (0 .. $#{$object->instances}) {
my $instance = $object->instances->[$instance_idx]; my $instance = $object->instances->[$instance_idx];
push @{$parent->{object_previews}}, [ $obj_idx, $instance_idx, $object->thumbnail->clone ]; push @{$parent->{object_previews}}, [ $obj_idx, $instance_idx, $object->thumbnail->clone ];