From 8474f77db4a55aa1a8ea7e4699b983b750495f2c Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 3 Feb 2017 15:53:31 +0100 Subject: [PATCH] Enabled the variable layer height in the builds by default. --- lib/Slic3r/GUI/3DScene.pm | 29 +++++++++++++---------------- lib/Slic3r/GUI/Plater.pm | 11 +++-------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm index c1f82f4c8..fcb54c018 100644 --- a/lib/Slic3r/GUI/3DScene.pm +++ b/lib/Slic3r/GUI/3DScene.pm @@ -141,8 +141,10 @@ sub new { $self->_camera_distance(0.); # Size of a layer height texture, used by a shader to color map the object print layers. - $self->{layer_preview_z_texture_width} = 512; - $self->{layer_preview_z_texture_height} = 512; + $self->layer_editing_enabled(0); + # 512x512 bitmaps are supported everywhere, but that may not be sufficent for super large print volumes. + $self->{layer_preview_z_texture_width} = 1024; + $self->{layer_preview_z_texture_height} = 1024; $self->{layer_height_edit_band_width} = 2.; $self->{layer_height_edit_strength} = 0.005; $self->{layer_height_edit_last_object_id} = -1; @@ -842,20 +844,15 @@ sub InitGL { return unless $self->GetContext; $self->init(1); - my $shader; - $shader = $self->{shader} = new Slic3r::GUI::GLShader - if (defined($ENV{'SLIC3R_EXPERIMENTAL'}) && $ENV{'SLIC3R_EXPERIMENTAL'} == 1); - if ($self->{shader}) { - my $info = $shader->Load($self->_fragment_shader, $self->_vertex_shader); - print $info if $info; - - ($self->{layer_preview_z_texture_id}) = glGenTextures_p(1); - glBindTexture(GL_TEXTURE_2D, $self->{layer_preview_z_texture_id}); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1); - glBindTexture(GL_TEXTURE_2D, 0); - } + my $shader = $self->{shader} = new Slic3r::GUI::GLShader; + my $info = $shader->Load($self->_fragment_shader, $self->_vertex_shader); +# print $info if $info; + ($self->{layer_preview_z_texture_id}) = glGenTextures_p(1); + glBindTexture(GL_TEXTURE_2D, $self->{layer_preview_z_texture_id}); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1); + glBindTexture(GL_TEXTURE_2D, 0); glClearColor(0, 0, 0, 1); glColor3f(1, 0, 0); diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index ead1fc4fe..b307d9312 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -156,10 +156,7 @@ sub new { $self->{htoolbar}->AddTool(TB_CUT, "Cut…", Wx::Bitmap->new($Slic3r::var->("package.png"), wxBITMAP_TYPE_PNG), ''); $self->{htoolbar}->AddSeparator; $self->{htoolbar}->AddTool(TB_SETTINGS, "Settings…", Wx::Bitmap->new($Slic3r::var->("cog.png"), wxBITMAP_TYPE_PNG), ''); - - # FIXME add a button for layer editing - $self->{htoolbar}->AddTool(TB_LAYER_EDITING, 'Layer Editing', Wx::Bitmap->new($Slic3r::var->("delete.png"), wxBITMAP_TYPE_PNG), wxNullBitmap, 1, undef, 'Layer Editing') - if (defined($ENV{'SLIC3R_EXPERIMENTAL'}) && $ENV{'SLIC3R_EXPERIMENTAL'} == 1); + $self->{htoolbar}->AddTool(TB_LAYER_EDITING, 'Layer Editing', Wx::Bitmap->new($Slic3r::var->("delete.png"), wxBITMAP_TYPE_PNG), wxNullBitmap, 1, undef, 'Layer Editing'); } else { my %tbar_buttons = ( add => "Add…", @@ -181,10 +178,8 @@ sub new { $self->{"btn_$_"} = Wx::Button->new($self, -1, $tbar_buttons{$_}, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); $self->{btoolbar}->Add($self->{"btn_$_"}); } - if (defined($ENV{'SLIC3R_EXPERIMENTAL'}) && $ENV{'SLIC3R_EXPERIMENTAL'} == 1) { - $self->{"btn_layer_editing"} = Wx::ToggleButton->new($self, -1, $tbar_buttons{'layer_editing'}, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); - $self->{btoolbar}->Add($self->{"btn_layer_editing"}); - } + $self->{"btn_layer_editing"} = Wx::ToggleButton->new($self, -1, $tbar_buttons{'layer_editing'}, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); + $self->{btoolbar}->Add($self->{"btn_layer_editing"}); } $self->{list} = Wx::ListView->new($self, -1, wxDefaultPosition, wxDefaultSize,