Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-02-17 17:11:59 +0300
committerbubnikv <bubnikv@gmail.com>2017-02-17 17:11:59 +0300
commit89702a5b4e63b783193bfbfcf1bddeeaf404a7c4 (patch)
treea8d765ebb0b4162b85f082b625dcbfee31b83de9
parent31f213d6ca8de9e450bf399daa044a2704ec6f3e (diff)
Fixing an update of the "Export G-code, Send to printer" and similar buttons.version_1.33.5
It is a bug, which was lingering around for a long time, only now the buggy function is called at a time point, where it really hurts. https://github.com/prusa3d/Slic3r/issues/137
-rw-r--r--lib/Slic3r/GUI/3DScene.pm33
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm
index 740fbcc10..e7a3791b8 100644
--- a/lib/Slic3r/GUI/3DScene.pm
+++ b/lib/Slic3r/GUI/3DScene.pm
@@ -61,7 +61,6 @@ __PACKAGE__->mk_accessors( qw(_quat _dirty init
_drag_start_xy
_dragged
- layer_editing_enabled
_layer_height_edited
_camera_type
@@ -190,6 +189,28 @@ sub Destroy {
return $self->SUPER::Destroy;
}
+sub layer_editing_enabled {
+ my ($self, $value) = @_;
+ if (@_ == 2) {
+ $self->{layer_editing_enabled} = $value;
+ if ($value && ! $self->{layer_editing_initialized}) {
+ # Enabling the layer editing for the first time. This triggers compilation of the necessary OpenGL shaders.
+ # If compilation fails, the compile log is printed into the console.
+ $self->{layer_editing_initialized} = 1;
+ 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);
+ }
+ }
+ return $self->{layer_editing_enabled};
+}
+
sub _first_selected_object_id {
my ($self) = @_;
for my $i (0..$#{$self->volumes}) {
@@ -893,16 +914,6 @@ sub InitGL {
return unless $self->GetContext;
$self->init(1);
- 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);
glEnable(GL_DEPTH_TEST);