Make OpenGL optional for the new parts dialog. #1731
This commit is contained in:
parent
b961849c38
commit
94cb298eec
1 changed files with 21 additions and 10 deletions
|
@ -51,12 +51,15 @@ sub new {
|
|||
}
|
||||
|
||||
# right pane with preview canvas
|
||||
my $canvas = $self->{canvas} = Slic3r::GUI::PreviewCanvas->new($self, $self->{model_object});
|
||||
my $canvas;
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$canvas = $self->{canvas} = Slic3r::GUI::PreviewCanvas->new($self, $self->{model_object});
|
||||
$canvas->SetSize([500,500]);
|
||||
}
|
||||
|
||||
$self->{sizer} = Wx::BoxSizer->new(wxHORIZONTAL);
|
||||
$self->{sizer}->Add($left_sizer, 0, wxEXPAND | wxALL, 0);
|
||||
$self->{sizer}->Add($canvas, 1, wxEXPAND | wxALL, 0);
|
||||
$self->{sizer}->Add($canvas, 1, wxEXPAND | wxALL, 0) if $canvas;
|
||||
|
||||
$self->SetSizer($self->{sizer});
|
||||
$self->{sizer}->SetSizeHints($self);
|
||||
|
@ -125,18 +128,22 @@ sub selection_changed {
|
|||
my ($self) = @_;
|
||||
|
||||
# deselect all meshes
|
||||
if ($self->{canvas}) {
|
||||
$_->{selected} = 0 for @{$self->{canvas}->volumes};
|
||||
}
|
||||
|
||||
# disable buttons
|
||||
$self->{btn_delete}->Disable;
|
||||
|
||||
my $itemData = $self->get_selection;
|
||||
if ($itemData && $itemData->{type} eq 'volume') {
|
||||
if ($self->{canvas}) {
|
||||
$self->{canvas}->volumes->[ $itemData->{volume_id} ]{selected} = 1;
|
||||
}
|
||||
$self->{btn_delete}->Enable;
|
||||
}
|
||||
|
||||
$self->{canvas}->Render;
|
||||
$self->{canvas}->Render if $self->{canvas};
|
||||
}
|
||||
|
||||
sub on_btn_load {
|
||||
|
@ -165,9 +172,11 @@ sub on_btn_load {
|
|||
}
|
||||
|
||||
$self->reload_tree;
|
||||
if ($self->{canvas}) {
|
||||
$self->{canvas}->load_object($self->{model_object});
|
||||
$self->{canvas}->Render;
|
||||
}
|
||||
}
|
||||
|
||||
sub on_btn_delete {
|
||||
my ($self) = @_;
|
||||
|
@ -186,8 +195,10 @@ sub on_btn_delete {
|
|||
}
|
||||
|
||||
$self->reload_tree;
|
||||
if ($self->{canvas}) {
|
||||
$self->{canvas}->load_object($self->{model_object});
|
||||
$self->{canvas}->Render;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in a new issue