More work for updating the embedded Print object when Model is changed in plater
This commit is contained in:
parent
fcbd62f07c
commit
d3171b1eea
2 changed files with 17 additions and 4 deletions
|
@ -526,6 +526,11 @@ sub rotate {
|
|||
my $new_angle = $model_instance->rotation + $angle;
|
||||
$_->rotation($new_angle) for @{ $model_object->instances };
|
||||
$model_object->update_bounding_box;
|
||||
|
||||
# update print
|
||||
$self->{print}->delete_object($obj_idx);
|
||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||
|
||||
$object->transform_thumbnail($self->{model}, $obj_idx);
|
||||
}
|
||||
$self->selection_changed; # refresh info (size etc.)
|
||||
|
@ -557,6 +562,11 @@ sub changescale {
|
|||
}
|
||||
$_->scaling_factor($scale) for @{ $model_object->instances };
|
||||
$model_object->update_bounding_box;
|
||||
|
||||
# update print
|
||||
$self->{print}->delete_object($obj_idx);
|
||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||
|
||||
$object->transform_thumbnail($self->{model}, $obj_idx);
|
||||
}
|
||||
$self->selection_changed(1); # refresh info (size, volume etc.)
|
||||
|
@ -725,7 +735,6 @@ sub export_gcode2 {
|
|||
|
||||
eval {
|
||||
$print->config->validate;
|
||||
$print->add_model_object($_) for @{ $self->{model}->objects };
|
||||
$print->validate;
|
||||
|
||||
{
|
||||
|
@ -1058,7 +1067,6 @@ sub mouse_event {
|
|||
$parent->Refresh;
|
||||
} elsif ($event->Moving) {
|
||||
my $cursor = wxSTANDARD_CURSOR;
|
||||
###use XXX;YYY [[$pos->pp], map $_->pp, @$_];
|
||||
if (defined first { $_->contains_point($pos) } map @{$_->instance_thumbnails}, @{ $parent->{objects} }) {
|
||||
$cursor = Wx::Cursor->new(wxCURSOR_HAND);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ sub _build_has_support_material {
|
|||
# and have explicit instance positions
|
||||
sub add_model_object {
|
||||
my $self = shift;
|
||||
my ($object) = @_;
|
||||
my ($object, $obj_idx) = @_;
|
||||
|
||||
# read the material mapping provided by the model object, if any
|
||||
my %matmap = %{ $object->material_mapping || {} };
|
||||
|
@ -113,7 +113,7 @@ sub add_model_object {
|
|||
}
|
||||
|
||||
# initialize print object
|
||||
push @{$self->objects}, Slic3r::Print::Object->new(
|
||||
my $o = Slic3r::Print::Object->new(
|
||||
print => $self,
|
||||
meshes => [ map $meshes{$_}, 0..$#{$self->regions} ],
|
||||
copies => [ map Slic3r::Point->new_scale(@{ $_->offset }), @{ $object->instances } ],
|
||||
|
@ -121,6 +121,11 @@ sub add_model_object {
|
|||
config_overrides => $object->config,
|
||||
layer_height_ranges => $object->layer_height_ranges,
|
||||
);
|
||||
if (defined $obj_idx) {
|
||||
splice @{$self->objects}, $obj_idx, 0, $o;
|
||||
} else {
|
||||
push @{$self->objects}, $o;
|
||||
}
|
||||
|
||||
if (!defined $self->extra_variables->{input_filename}) {
|
||||
if (defined (my $input_file = $object->input_file)) {
|
||||
|
|
Loading…
Reference in a new issue