mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
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;
|
my $new_angle = $model_instance->rotation + $angle;
|
||||||
$_->rotation($new_angle) for @{ $model_object->instances };
|
$_->rotation($new_angle) for @{ $model_object->instances };
|
||||||
$model_object->update_bounding_box;
|
$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);
|
$object->transform_thumbnail($self->{model}, $obj_idx);
|
||||||
}
|
}
|
||||||
$self->selection_changed; # refresh info (size etc.)
|
$self->selection_changed; # refresh info (size etc.)
|
||||||
|
@ -557,6 +562,11 @@ sub changescale {
|
||||||
}
|
}
|
||||||
$_->scaling_factor($scale) for @{ $model_object->instances };
|
$_->scaling_factor($scale) for @{ $model_object->instances };
|
||||||
$model_object->update_bounding_box;
|
$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);
|
$object->transform_thumbnail($self->{model}, $obj_idx);
|
||||||
}
|
}
|
||||||
$self->selection_changed(1); # refresh info (size, volume etc.)
|
$self->selection_changed(1); # refresh info (size, volume etc.)
|
||||||
|
@ -725,7 +735,6 @@ sub export_gcode2 {
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
$print->config->validate;
|
$print->config->validate;
|
||||||
$print->add_model_object($_) for @{ $self->{model}->objects };
|
|
||||||
$print->validate;
|
$print->validate;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1058,7 +1067,6 @@ sub mouse_event {
|
||||||
$parent->Refresh;
|
$parent->Refresh;
|
||||||
} elsif ($event->Moving) {
|
} elsif ($event->Moving) {
|
||||||
my $cursor = wxSTANDARD_CURSOR;
|
my $cursor = wxSTANDARD_CURSOR;
|
||||||
###use XXX;YYY [[$pos->pp], map $_->pp, @$_];
|
|
||||||
if (defined first { $_->contains_point($pos) } map @{$_->instance_thumbnails}, @{ $parent->{objects} }) {
|
if (defined first { $_->contains_point($pos) } map @{$_->instance_thumbnails}, @{ $parent->{objects} }) {
|
||||||
$cursor = Wx::Cursor->new(wxCURSOR_HAND);
|
$cursor = Wx::Cursor->new(wxCURSOR_HAND);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ sub _build_has_support_material {
|
||||||
# and have explicit instance positions
|
# and have explicit instance positions
|
||||||
sub add_model_object {
|
sub add_model_object {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($object) = @_;
|
my ($object, $obj_idx) = @_;
|
||||||
|
|
||||||
# read the material mapping provided by the model object, if any
|
# read the material mapping provided by the model object, if any
|
||||||
my %matmap = %{ $object->material_mapping || {} };
|
my %matmap = %{ $object->material_mapping || {} };
|
||||||
|
@ -113,7 +113,7 @@ sub add_model_object {
|
||||||
}
|
}
|
||||||
|
|
||||||
# initialize print object
|
# initialize print object
|
||||||
push @{$self->objects}, Slic3r::Print::Object->new(
|
my $o = Slic3r::Print::Object->new(
|
||||||
print => $self,
|
print => $self,
|
||||||
meshes => [ map $meshes{$_}, 0..$#{$self->regions} ],
|
meshes => [ map $meshes{$_}, 0..$#{$self->regions} ],
|
||||||
copies => [ map Slic3r::Point->new_scale(@{ $_->offset }), @{ $object->instances } ],
|
copies => [ map Slic3r::Point->new_scale(@{ $_->offset }), @{ $object->instances } ],
|
||||||
|
@ -121,6 +121,11 @@ sub add_model_object {
|
||||||
config_overrides => $object->config,
|
config_overrides => $object->config,
|
||||||
layer_height_ranges => $object->layer_height_ranges,
|
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 $self->extra_variables->{input_filename}) {
|
||||||
if (defined (my $input_file = $object->input_file)) {
|
if (defined (my $input_file = $object->input_file)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue