Split objects could not be repositioned in plater. 3D preview and stats were not available too. #1543
This commit is contained in:
parent
22605418ba
commit
bed1625d6b
@ -594,8 +594,10 @@ sub split_object {
|
||||
input_file_object_id => undef,
|
||||
model => $new_model,
|
||||
model_object_idx => $#{$new_model->objects},
|
||||
instances => [ map $bb->min_point, 1..$current_copies_num ],
|
||||
mesh_stats => $mesh->stats, # so that we can free model
|
||||
instances => [ map $bb->min_point->pp, 1..$current_copies_num ],
|
||||
);
|
||||
|
||||
push @{ $self->{objects} }, $object;
|
||||
$self->object_loaded($#{ $self->{objects} }, no_arrange => 1);
|
||||
}
|
||||
@ -1274,7 +1276,7 @@ has 'thumbnail_scaling_factor' => (is => 'rw', trigger => \&_transform_thumbnail
|
||||
has 'config' => (is => 'rw', default => sub { Slic3r::Config->new });
|
||||
has 'layer_height_ranges' => (is => 'rw', default => sub { [] }); # [ z_min, z_max, layer_height ]
|
||||
has 'material_mapping' => (is => 'rw', default => sub { {} }); # { material_id => extruder_idx }
|
||||
has 'mesh_stats' => (is => 'rw');
|
||||
has 'mesh_stats' => (is => 'ro', required => 1);
|
||||
|
||||
# statistics
|
||||
has 'facets' => (is => 'rw');
|
||||
|
@ -308,7 +308,7 @@ use Storable qw(dclone);
|
||||
has 'input_file' => (is => 'rw');
|
||||
has 'model' => (is => 'ro', weak_ref => 1, required => 1);
|
||||
has 'volumes' => (is => 'ro', default => sub { [] });
|
||||
has 'instances' => (is => 'rw');
|
||||
has 'instances' => (is => 'rw'); # in unscaled coordinates
|
||||
has 'config' => (is => 'rw', default => sub { Slic3r::Config->new });
|
||||
has 'layer_height_ranges' => (is => 'rw', default => sub { [] }); # [ z_min, z_max, layer_height ]
|
||||
has 'material_mapping' => (is => 'rw', default => sub { {} }); # { material_id => extruder_idx }
|
||||
|
@ -532,8 +532,11 @@ TriangleMesh::split() const
|
||||
mesh->stl.stats.original_num_facets = mesh->stl.stats.number_of_facets;
|
||||
stl_allocate(&mesh->stl);
|
||||
|
||||
int first = 1;
|
||||
for (std::deque<int>::const_iterator facet = facets.begin(); facet != facets.end(); facet++) {
|
||||
mesh->stl.facet_start[facet - facets.begin()] = this->stl.facet_start[*facet];
|
||||
stl_facet_stats(&mesh->stl, this->stl.facet_start[*facet], first);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,6 +178,6 @@ extern void stl_initialize(stl_file *stl);
|
||||
static void stl_count_facets(stl_file *stl, char *file);
|
||||
extern void stl_allocate(stl_file *stl);
|
||||
static void stl_read(stl_file *stl, int first_facet, int first);
|
||||
static void stl_facet_stats(stl_file *stl, stl_facet facet, int first);
|
||||
extern void stl_facet_stats(stl_file *stl, stl_facet facet, int first);
|
||||
extern void stl_reallocate(stl_file *stl);
|
||||
extern void stl_get_size(stl_file *stl);
|
||||
|
@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 51;
|
||||
use Test::More tests => 52;
|
||||
|
||||
is Slic3r::TriangleMesh::hello_world(), 'Hello world!',
|
||||
'hello world';
|
||||
@ -59,6 +59,7 @@ my $cube = {
|
||||
my $meshes = $m->split;
|
||||
is scalar(@$meshes), 1, 'split';
|
||||
isa_ok $meshes->[0], 'Slic3r::TriangleMesh', 'split';
|
||||
is_deeply $m->bb3, $meshes->[0]->bb3, 'split populates stats';
|
||||
}
|
||||
|
||||
my $m2 = Slic3r::TriangleMesh->new;
|
||||
|
Loading…
Reference in New Issue
Block a user