mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-05 13:04:03 -06:00
Merge branch 'master' into sender
This commit is contained in:
commit
d2172b4383
47 changed files with 860 additions and 429 deletions
|
@ -16,6 +16,7 @@ __PACKAGE__->mk_accessors( qw(_quat _dirty init
|
|||
enable_cutting
|
||||
enable_picking
|
||||
enable_moving
|
||||
on_viewport_changed
|
||||
on_hover
|
||||
on_select
|
||||
on_double_click
|
||||
|
@ -108,6 +109,7 @@ sub new {
|
|||
-($pos->y - $size->y/2) * ($zoom) / $self->_zoom,
|
||||
0,
|
||||
) if 0;
|
||||
$self->on_viewport_changed->() if $self->on_viewport_changed;
|
||||
$self->_dirty(1);
|
||||
$self->Refresh;
|
||||
});
|
||||
|
@ -207,6 +209,7 @@ sub mouse_event {
|
|||
);
|
||||
$self->_quat(mulquats($self->_quat, \@quat));
|
||||
}
|
||||
$self->on_viewport_changed->() if $self->on_viewport_changed;
|
||||
$self->Refresh;
|
||||
}
|
||||
$self->_drag_start_pos($pos);
|
||||
|
@ -220,6 +223,7 @@ sub mouse_event {
|
|||
$self->_camera_target->translate(
|
||||
@{$orig->vector_to($cur_pos)->negative},
|
||||
);
|
||||
$self->on_viewport_changed->() if $self->on_viewport_changed;
|
||||
$self->Refresh;
|
||||
}
|
||||
$self->_drag_start_xy($pos);
|
||||
|
@ -256,6 +260,17 @@ sub reset_objects {
|
|||
$self->_dirty(1);
|
||||
}
|
||||
|
||||
sub set_viewport_from_scene {
|
||||
my ($self, $scene) = @_;
|
||||
|
||||
$self->_sphi($scene->_sphi);
|
||||
$self->_stheta($scene->_stheta);
|
||||
$self->_camera_target($scene->_camera_target);
|
||||
$self->_zoom($scene->_zoom);
|
||||
$self->_quat($scene->_quat);
|
||||
$self->_dirty(1);
|
||||
}
|
||||
|
||||
sub zoom_to_bounding_box {
|
||||
my ($self, $bb) = @_;
|
||||
|
||||
|
@ -267,6 +282,8 @@ sub zoom_to_bounding_box {
|
|||
|
||||
# center view around bounding box center
|
||||
$self->_camera_target($bb->center);
|
||||
|
||||
$self->on_viewport_changed->() if $self->on_viewport_changed;
|
||||
}
|
||||
|
||||
sub zoom_to_bed {
|
||||
|
@ -347,25 +364,24 @@ sub set_bed_shape {
|
|||
}
|
||||
|
||||
{
|
||||
my @lines = ();
|
||||
my @polylines = ();
|
||||
for (my $x = $bed_bb->x_min; $x <= $bed_bb->x_max; $x += scale 10) {
|
||||
push @lines, Slic3r::Polyline->new([$x,$bed_bb->y_min], [$x,$bed_bb->y_max]);
|
||||
push @polylines, Slic3r::Polyline->new([$x,$bed_bb->y_min], [$x,$bed_bb->y_max]);
|
||||
}
|
||||
for (my $y = $bed_bb->y_min; $y <= $bed_bb->y_max; $y += scale 10) {
|
||||
push @lines, Slic3r::Polyline->new([$bed_bb->x_min,$y], [$bed_bb->x_max,$y]);
|
||||
push @polylines, Slic3r::Polyline->new([$bed_bb->x_min,$y], [$bed_bb->x_max,$y]);
|
||||
}
|
||||
# clip with a slightly grown expolygon because our lines lay on the contours and
|
||||
# may get erroneously clipped
|
||||
@lines = @{intersection_pl(\@lines, [ @{$expolygon->offset(+scaled_epsilon)} ])};
|
||||
my @lines = map Slic3r::Line->new(@$_[0,-1]),
|
||||
@{intersection_pl(\@polylines, [ @{$expolygon->offset(+scaled_epsilon)} ])};
|
||||
|
||||
# append bed contours
|
||||
foreach my $line (map @{$_->lines}, @$expolygon) {
|
||||
push @lines, $line->as_polyline;
|
||||
}
|
||||
push @lines, map @{$_->lines}, @$expolygon;
|
||||
|
||||
my @points = ();
|
||||
foreach my $polyline (@lines) {
|
||||
push @points, map {+ unscale($_->x), unscale($_->y), GROUND_Z } @$polyline; #))
|
||||
foreach my $line (@lines) {
|
||||
push @points, map {+ unscale($_->x), unscale($_->y), GROUND_Z } @$line; #))
|
||||
}
|
||||
$self->bed_grid_lines(OpenGL::Array->new_list(GL_FLOAT, @points));
|
||||
}
|
||||
|
@ -572,9 +588,10 @@ sub Resize {
|
|||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
my $depth = 10 * max(@{ $self->max_bounding_box->size });
|
||||
glOrtho(
|
||||
-$x/2, $x/2, -$y/2, $y/2,
|
||||
-200, 10 * max(@{ $self->max_bounding_box->size }),
|
||||
-$depth, 2*$depth,
|
||||
);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
|
|
@ -307,7 +307,7 @@ sub _repaint_canvas {
|
|||
@polylines = @{intersection_pl(\@polylines, [$bed_polygon])};
|
||||
|
||||
$dc->SetPen(Wx::Pen->new(Wx::Colour->new(230,230,230), 1, wxSOLID));
|
||||
$dc->DrawLine(map @{$to_pixel->([map unscale($_), @$_])}, @$_) for @polylines;
|
||||
$dc->DrawLine(map @{$to_pixel->([map unscale($_), @$_])}, @$_[0,-1]) for @polylines;
|
||||
}
|
||||
|
||||
# draw bed contour
|
||||
|
|
|
@ -255,7 +255,7 @@ sub _init_menubar {
|
|||
Wx::LaunchDefaultBrowser('http://slic3r.org/');
|
||||
});
|
||||
my $versioncheck = $self->_append_menu_item($helpMenu, "Check for &Updates...", 'Check for new Slic3r versions', sub {
|
||||
wxTheApp->check_version(manual => 1);
|
||||
wxTheApp->check_version(1);
|
||||
});
|
||||
$versioncheck->Enable(wxTheApp->have_version_check);
|
||||
$self->_append_menu_item($helpMenu, "Slic3r &Manual", 'Open the Slic3r manual in your browser', sub {
|
||||
|
@ -678,7 +678,7 @@ sub config {
|
|||
} else {
|
||||
my $extruders_count = $self->{options_tabs}{printer}{extruders_count};
|
||||
$config->set("${_}_extruder", min($config->get("${_}_extruder"), $extruders_count))
|
||||
for qw(perimeter infill support_material support_material_interface);
|
||||
for qw(perimeter infill solid_infill support_material support_material_interface);
|
||||
}
|
||||
|
||||
return $config;
|
||||
|
|
|
@ -96,6 +96,9 @@ sub new {
|
|||
$self->{canvas3D}->set_on_double_click($on_double_click);
|
||||
$self->{canvas3D}->set_on_right_click(sub { $on_right_click->($self->{canvas3D}, @_); });
|
||||
$self->{canvas3D}->set_on_instances_moved($on_instances_moved);
|
||||
$self->{canvas3D}->on_viewport_changed(sub {
|
||||
$self->{preview3D}->canvas->set_viewport_from_scene($self->{canvas3D});
|
||||
});
|
||||
}
|
||||
|
||||
# Initialize 2D preview canvas
|
||||
|
@ -109,6 +112,9 @@ sub new {
|
|||
# Initialize 3D toolpaths preview
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print});
|
||||
$self->{preview3D}->canvas->on_viewport_changed(sub {
|
||||
$self->{canvas3D}->set_viewport_from_scene($self->{preview3D}->canvas);
|
||||
});
|
||||
$self->{preview_notebook}->AddPage($self->{preview3D}, 'Preview');
|
||||
$self->{preview3D_page_idx} = $self->{preview_notebook}->GetPageCount-1;
|
||||
}
|
||||
|
@ -988,9 +994,13 @@ sub pause_background_process {
|
|||
|
||||
if ($self->{process_thread} || $self->{export_thread}) {
|
||||
Slic3r::pause_all_threads();
|
||||
return 1;
|
||||
} elsif (defined $self->{apply_config_timer} && $self->{apply_config_timer}->IsRunning) {
|
||||
$self->{apply_config_timer}->Stop;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub resume_background_process {
|
||||
|
@ -1312,9 +1322,14 @@ sub update {
|
|||
$self->{model}->center_instances_around_point($self->bed_centerf);
|
||||
}
|
||||
|
||||
$self->pause_background_process;
|
||||
my $running = $self->pause_background_process;
|
||||
my $invalidated = $self->{print}->reload_model_instances();
|
||||
if ($invalidated) {
|
||||
|
||||
# The mere fact that no steps were invalidated when reloading model instances
|
||||
# doesn't mean that all steps were done: for example, validation might have
|
||||
# failed upon previous instance move, so we have no running thread and no steps
|
||||
# are invalidated on this move, thus we need to schedule a new run.
|
||||
if ($invalidated || !$running) {
|
||||
$self->schedule_background_process;
|
||||
} else {
|
||||
$self->resume_background_process;
|
||||
|
@ -1323,12 +1338,6 @@ sub update {
|
|||
$self->refresh_canvases;
|
||||
}
|
||||
|
||||
sub on_model_instances_changed {
|
||||
my ($self) = @_;
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub on_extruders_change {
|
||||
my ($self, $num_extruders) = @_;
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ sub update_bed_size {
|
|||
push @polylines, Slic3r::Polyline->new([$bb->x_min, $y], [$bb->x_max, $y]);
|
||||
}
|
||||
@polylines = @{intersection_pl(\@polylines, [$polygon])};
|
||||
$self->{grid} = [ map $self->scaled_points_to_pixel(\@$_, 1), @polylines ];
|
||||
$self->{grid} = [ map $self->scaled_points_to_pixel([ @$_[0,-1] ], 1), @polylines ];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ sub Render {
|
|||
$brim_drawn = 1;
|
||||
}
|
||||
if ($self->print->step_done(STEP_SKIRT)
|
||||
&& ($self->print->config->skirt_height == -1 || $self->print->config->skirt_height > $layer->id)
|
||||
&& ($self->print->has_infinite_skirt() || $self->print->config->skirt_height > $layer->id)
|
||||
&& !$skirt_drawn) {
|
||||
$self->color([0, 0, 0]);
|
||||
$self->_draw(undef, $print_z, $_) for @{$self->print->skirt};
|
||||
|
|
|
@ -37,9 +37,9 @@ sub new {
|
|||
|
||||
# buttons
|
||||
$self->{btn_save_preset} = Wx::BitmapButton->new($self, -1, Wx::Bitmap->new("$Slic3r::var/disk.png", wxBITMAP_TYPE_PNG),
|
||||
wxDefaultPosition, [16,16], wxBORDER_NONE);
|
||||
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
$self->{btn_delete_preset} = Wx::BitmapButton->new($self, -1, Wx::Bitmap->new("$Slic3r::var/delete.png", wxBITMAP_TYPE_PNG),
|
||||
wxDefaultPosition, [16,16], wxBORDER_NONE);
|
||||
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
$self->{btn_save_preset}->SetToolTipString("Save current " . lc($self->title));
|
||||
$self->{btn_delete_preset}->SetToolTipString("Delete this preset");
|
||||
$self->{btn_delete_preset}->Disable;
|
||||
|
@ -745,11 +745,13 @@ sub _update {
|
|||
perimeter_speed small_perimeter_speed external_perimeter_speed);
|
||||
|
||||
my $have_infill = $config->fill_density > 0;
|
||||
# infill_extruder uses the same logic as in Print::extruders()
|
||||
$self->get_field($_)->toggle($have_infill)
|
||||
for qw(fill_pattern infill_every_layers infill_only_where_needed solid_infill_every_layers
|
||||
solid_infill_below_area infill_extruder);
|
||||
|
||||
my $have_solid_infill = ($config->top_solid_layers > 0) || ($config->bottom_solid_layers > 0);
|
||||
# solid_infill_extruder uses the same logic as in Print::extruders()
|
||||
$self->get_field($_)->toggle($have_solid_infill)
|
||||
for qw(external_fill_pattern infill_first solid_infill_extruder solid_infill_extrusion_width
|
||||
solid_infill_speed);
|
||||
|
@ -772,6 +774,7 @@ sub _update {
|
|||
for qw(skirt_distance skirt_height);
|
||||
|
||||
my $have_brim = $config->brim_width > 0;
|
||||
# perimeter_extruder uses the same logic as in Print::extruders()
|
||||
$self->get_field('perimeter_extruder')->toggle($have_perimeters || $have_brim);
|
||||
|
||||
my $have_support_material = $config->support_material || $config->raft_layers > 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue