mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	GCode Preview - Legend texture shown only when gcode is available
This commit is contained in:
		
							parent
							
								
									593d794655
								
							
						
					
					
						commit
						6ff9021e04
					
				
					 9 changed files with 61 additions and 30 deletions
				
			
		|  | @ -1605,23 +1605,25 @@ sub draw_legend { | |||
|         my $tex_id = Slic3r::GUI::_3DScene::get_legend_texture_id; | ||||
|         if ($tex_id > 0) | ||||
|         { | ||||
|             glDisable(GL_DEPTH_TEST); | ||||
|             glPushMatrix(); | ||||
|             glLoadIdentity(); | ||||
|          | ||||
|             my $tex_w = Slic3r::GUI::_3DScene::get_legend_texture_width; | ||||
|             my $tex_h = Slic3r::GUI::_3DScene::get_legend_texture_height; | ||||
| 
 | ||||
|             my ($cw, $ch) = $self->GetSizeWH; | ||||
|             if (($tex_w > 0) && ($tex_h > 0)) | ||||
|             { | ||||
|                 glDisable(GL_DEPTH_TEST); | ||||
|                 glPushMatrix(); | ||||
|                 glLoadIdentity(); | ||||
|          | ||||
|                 my ($cw, $ch) = $self->GetSizeWH; | ||||
|                  | ||||
|             my $l = (-0.5 * $cw) / $self->_zoom; | ||||
|             my $t = (0.5 * $ch) / $self->_zoom; | ||||
|             my $r = $l + $tex_w / $self->_zoom; | ||||
|             my $b = $t - $tex_h / $self->_zoom; | ||||
|             $self->_render_texture($tex_id, $l, $r, $b, $t); | ||||
|                 my $l = (-0.5 * $cw) / $self->_zoom; | ||||
|                 my $t = (0.5 * $ch) / $self->_zoom; | ||||
|                 my $r = $l + $tex_w / $self->_zoom; | ||||
|                 my $b = $t - $tex_h / $self->_zoom; | ||||
|                 $self->_render_texture($tex_id, $l, $r, $b, $t); | ||||
| 
 | ||||
|             glPopMatrix(); | ||||
|             glEnable(GL_DEPTH_TEST); | ||||
|                 glPopMatrix(); | ||||
|                 glEnable(GL_DEPTH_TEST); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -2038,4 +2040,8 @@ sub set_toolpaths_range { | |||
|     $self->volumes->set_range($min_z, $max_z); | ||||
| } | ||||
| 
 | ||||
| sub reset_legend_texture { | ||||
|     Slic3r::GUI::_3DScene::reset_legend_texture(); | ||||
| } | ||||
| 
 | ||||
| 1; | ||||
|  |  | |||
|  | @ -1261,6 +1261,8 @@ sub reslice { | |||
|         $self->stop_background_process; | ||||
|         # Rather perform one additional unnecessary update of the print object instead of skipping a pending async update. | ||||
|         $self->async_apply_config; | ||||
|         # Reset gcode data | ||||
|         $self->{print}->clear_gcode_preview_data; | ||||
|         $self->statusbar->SetCancelCallback(sub { | ||||
|             $self->stop_background_process; | ||||
|             $self->statusbar->SetStatusText("Slicing cancelled"); | ||||
|  |  | |||
|  | @ -290,6 +290,9 @@ sub load_print { | |||
|         $self->set_z_range(0,0); | ||||
|         $self->slider_low->Hide; | ||||
|         $self->slider_high->Hide; | ||||
|         $self->{z_label_low}->SetLabel(""); | ||||
|         $self->{z_label_high}->SetLabel(""); | ||||
|         $self->canvas->reset_legend_texture(); | ||||
|         $self->canvas->Refresh;  # clears canvas | ||||
|         return; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri