mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Merge branch 'master' into wipe_tower_improvements
This commit is contained in:
		
						commit
						eb9917536c
					
				
					 27 changed files with 457 additions and 170 deletions
				
			
		| 
						 | 
				
			
			@ -96,7 +96,7 @@ use constant MANIPULATION_IDLE          => 0;
 | 
			
		|||
use constant MANIPULATION_DRAGGING      => 1;
 | 
			
		||||
use constant MANIPULATION_LAYER_HEIGHT  => 2;
 | 
			
		||||
 | 
			
		||||
use constant GIMBALL_LOCK_THETA_MAX => 170;
 | 
			
		||||
use constant GIMBALL_LOCK_THETA_MAX => 180;
 | 
			
		||||
 | 
			
		||||
use constant VARIABLE_LAYER_THICKNESS_BAR_WIDTH => 70;
 | 
			
		||||
use constant VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT => 22;
 | 
			
		||||
| 
						 | 
				
			
			@ -1316,12 +1316,18 @@ sub Render {
 | 
			
		|||
            $self->mark_volumes_for_layer_height;
 | 
			
		||||
            $self->volumes->set_print_box($self->bed_bounding_box->x_min, $self->bed_bounding_box->y_min, 0.0, $self->bed_bounding_box->x_max, $self->bed_bounding_box->y_max, $self->{config}->get('max_print_height'));
 | 
			
		||||
            $self->volumes->update_outside_state($self->{config}, 0);
 | 
			
		||||
            # do not cull backfaces to show broken geometry, if any
 | 
			
		||||
            glDisable(GL_CULL_FACE);
 | 
			
		||||
        }
 | 
			
		||||
        $self->{plain_shader}->enable if $self->{plain_shader};
 | 
			
		||||
        $self->volumes->render_VBOs;
 | 
			
		||||
        $self->{plain_shader}->disable;
 | 
			
		||||
        glEnable(GL_CULL_FACE) if ($self->enable_picking);
 | 
			
		||||
    } else {
 | 
			
		||||
        # do not cull backfaces to show broken geometry, if any
 | 
			
		||||
        glDisable(GL_CULL_FACE) if ($self->enable_picking);
 | 
			
		||||
        $self->volumes->render_legacy;
 | 
			
		||||
        glEnable(GL_CULL_FACE) if ($self->enable_picking);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # draw cutting plane
 | 
			
		||||
| 
						 | 
				
			
			@ -1358,6 +1364,9 @@ sub draw_volumes {
 | 
			
		|||
    # $fakecolor is a boolean indicating, that the objects shall be rendered in a color coding the object index for picking.
 | 
			
		||||
    my ($self, $fakecolor) = @_;
 | 
			
		||||
    
 | 
			
		||||
    # do not cull backfaces to show broken geometry, if any
 | 
			
		||||
    glDisable(GL_CULL_FACE);
 | 
			
		||||
    
 | 
			
		||||
    glEnable(GL_BLEND);
 | 
			
		||||
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -1385,6 +1394,8 @@ sub draw_volumes {
 | 
			
		|||
    }
 | 
			
		||||
    glDisableClientState(GL_NORMAL_ARRAY);
 | 
			
		||||
    glDisable(GL_BLEND);
 | 
			
		||||
 | 
			
		||||
    glEnable(GL_CULL_FACE);
 | 
			
		||||
    
 | 
			
		||||
    if (defined $self->cutting_plane_z) {
 | 
			
		||||
        glLineWidth(2);
 | 
			
		||||
| 
						 | 
				
			
			@ -1812,6 +1823,7 @@ sub _fragment_shader_Gouraud {
 | 
			
		|||
    return <<'FRAGMENT';
 | 
			
		||||
#version 110
 | 
			
		||||
 | 
			
		||||
const vec4 OUTSIDE_COLOR = vec4(0.24, 0.42, 0.62, 1.0);
 | 
			
		||||
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
 | 
			
		||||
 | 
			
		||||
// x = tainted, y = specular;
 | 
			
		||||
| 
						 | 
				
			
			@ -1824,13 +1836,11 @@ uniform vec4 uniform_color;
 | 
			
		|||
 | 
			
		||||
void main()
 | 
			
		||||
{
 | 
			
		||||
    gl_FragColor = vec4(intensity.y, intensity.y, intensity.y, 0.0) + uniform_color * intensity.x;
 | 
			
		||||
    // if the fragment is outside the print volume use predefined color
 | 
			
		||||
    vec4 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? OUTSIDE_COLOR : uniform_color;
 | 
			
		||||
 | 
			
		||||
    // if the fragment is outside the print volume darken it and set it as transparent
 | 
			
		||||
    if (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO)))
 | 
			
		||||
        gl_FragColor = vec4(mix(gl_FragColor.xyz, ZERO, 0.5), 0.5 * uniform_color.a);
 | 
			
		||||
    else
 | 
			
		||||
        gl_FragColor.a = uniform_color.a;
 | 
			
		||||
    gl_FragColor = vec4(intensity.y, intensity.y, intensity.y, 0.0) + color * intensity.x;
 | 
			
		||||
    gl_FragColor.a = color.a;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FRAGMENT
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,6 +97,16 @@ sub new {
 | 
			
		|||
        $self->update;
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    # callback to enable/disable action buttons
 | 
			
		||||
    my $enable_action_buttons = sub {
 | 
			
		||||
        my ($enable) = @_;
 | 
			
		||||
        $self->{btn_export_gcode}->Enable($enable);
 | 
			
		||||
        $self->{btn_reslice}->Enable($enable);
 | 
			
		||||
        $self->{btn_print}->Enable($enable);
 | 
			
		||||
        $self->{btn_send_gcode}->Enable($enable);
 | 
			
		||||
        $self->{btn_export_stl}->Enable($enable);    
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    # Initialize 3D plater
 | 
			
		||||
    if ($Slic3r::GUI::have_OpenGL) {
 | 
			
		||||
        $self->{canvas3D} = Slic3r::GUI::Plater::3D->new($self->{preview_notebook}, $self->{objects}, $self->{model}, $self->{print}, $self->{config});
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +122,7 @@ sub new {
 | 
			
		|||
        $self->{canvas3D}->set_on_decrease_objects(sub { $self->decrease() });
 | 
			
		||||
        $self->{canvas3D}->set_on_remove_object(sub { $self->remove() });
 | 
			
		||||
        $self->{canvas3D}->set_on_instances_moved($on_instances_moved);
 | 
			
		||||
        $self->{canvas3D}->set_on_enable_action_buttons($enable_action_buttons);
 | 
			
		||||
        $self->{canvas3D}->use_plain_shader(1);
 | 
			
		||||
        $self->{canvas3D}->set_on_wipe_tower_moved(sub {
 | 
			
		||||
            my ($new_pos_3f) = @_;
 | 
			
		||||
| 
						 | 
				
			
			@ -1469,7 +1480,11 @@ sub on_export_completed {
 | 
			
		|||
    # Send $self->{send_gcode_file} to OctoPrint.
 | 
			
		||||
    if ($send_gcode) {
 | 
			
		||||
        my $op = Slic3r::OctoPrint->new($self->{config});
 | 
			
		||||
        $op->send_gcode($self->GetId(), $PROGRESS_BAR_EVENT, $ERROR_EVENT, $self->{send_gcode_file});
 | 
			
		||||
        if ($op->send_gcode($self->{send_gcode_file})) {
 | 
			
		||||
            $self->statusbar->SetStatusText(L("OctoPrint upload finished."));
 | 
			
		||||
        } else {
 | 
			
		||||
            $self->statusbar->SetStatusText("");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $self->{print_file} = undef;
 | 
			
		||||
| 
						 | 
				
			
			@ -1559,7 +1574,7 @@ sub export_amf {
 | 
			
		|||
    return if !@{$self->{objects}};
 | 
			
		||||
    # Ask user for a file name to write into.
 | 
			
		||||
    my $output_file = $self->_get_export_file('AMF') or return;
 | 
			
		||||
    my $res = $self->{model}->store_amf($output_file, $self->{print});
 | 
			
		||||
    my $res = $self->{model}->store_amf($output_file, $self->{print}, $self->{export_option});
 | 
			
		||||
    if ($res)
 | 
			
		||||
    {
 | 
			
		||||
        $self->statusbar->SetStatusText(L("AMF file exported to ").$output_file);
 | 
			
		||||
| 
						 | 
				
			
			@ -1575,7 +1590,7 @@ sub export_3mf {
 | 
			
		|||
    return if !@{$self->{objects}};
 | 
			
		||||
    # Ask user for a file name to write into.
 | 
			
		||||
    my $output_file = $self->_get_export_file('3MF') or return;
 | 
			
		||||
    my $res = $self->{model}->store_3mf($output_file, $self->{print});
 | 
			
		||||
    my $res = $self->{model}->store_3mf($output_file, $self->{print}, $self->{export_option});
 | 
			
		||||
    if ($res)
 | 
			
		||||
    {
 | 
			
		||||
        $self->statusbar->SetStatusText(L("3MF file exported to ").$output_file);
 | 
			
		||||
| 
						 | 
				
			
			@ -1617,11 +1632,13 @@ sub _get_export_file {
 | 
			
		|||
    $output_file =~ s/\.[gG][cC][oO][dD][eE]$/$suffix/;
 | 
			
		||||
    my $dlg = Wx::FileDialog->new($self, L("Save ").$format.L(" file as:"), dirname($output_file),
 | 
			
		||||
        basename($output_file), &Slic3r::GUI::FILE_WILDCARDS->{$wildcard}, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
 | 
			
		||||
    Slic3r::GUI::add_export_option($dlg, $format);
 | 
			
		||||
    if ($dlg->ShowModal != wxID_OK) {
 | 
			
		||||
        $dlg->Destroy;
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
    $output_file = $dlg->GetPath;
 | 
			
		||||
    $self->{export_option} = Slic3r::GUI::get_export_option($dlg);
 | 
			
		||||
    $dlg->Destroy;
 | 
			
		||||
    return $output_file;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ use Wx::Locale gettext => 'L';
 | 
			
		|||
 | 
			
		||||
__PACKAGE__->mk_accessors(qw(
 | 
			
		||||
    on_arrange on_rotate_object_left on_rotate_object_right on_scale_object_uniformly
 | 
			
		||||
    on_remove_object on_increase_objects on_decrease_objects));
 | 
			
		||||
    on_remove_object on_increase_objects on_decrease_objects on_enable_action_buttons));
 | 
			
		||||
 | 
			
		||||
sub new {
 | 
			
		||||
    my $class = shift;
 | 
			
		||||
| 
						 | 
				
			
			@ -176,6 +176,11 @@ sub set_on_model_update {
 | 
			
		|||
    $self->on_model_update($cb);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub set_on_enable_action_buttons {
 | 
			
		||||
    my ($self, $cb) = @_;
 | 
			
		||||
    $self->on_enable_action_buttons($cb);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub reload_scene {
 | 
			
		||||
    my ($self, $force) = @_;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -218,10 +223,12 @@ sub reload_scene {
 | 
			
		|||
        if (!$self->{model}->fits_print_volume($self->{config})) {
 | 
			
		||||
            $self->set_warning_enabled(1);
 | 
			
		||||
            Slic3r::GUI::_3DScene::generate_warning_texture(L("Detected object outside print volume"));
 | 
			
		||||
            $self->on_enable_action_buttons->(0) if ($self->on_enable_action_buttons);
 | 
			
		||||
        } else {
 | 
			
		||||
            $self->set_warning_enabled(0);
 | 
			
		||||
            $self->volumes->update_outside_state($self->{config}, 1);
 | 
			
		||||
            Slic3r::GUI::_3DScene::reset_warning_texture();
 | 
			
		||||
            $self->on_enable_action_buttons->(1) if ($self->on_enable_action_buttons);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,6 +69,7 @@ sub new {
 | 
			
		|||
    $choice_view_type->Append(L("Height"));
 | 
			
		||||
    $choice_view_type->Append(L("Width"));
 | 
			
		||||
    $choice_view_type->Append(L("Speed"));
 | 
			
		||||
    $choice_view_type->Append(L("Volumetric flow rate"));
 | 
			
		||||
    $choice_view_type->Append(L("Tool"));
 | 
			
		||||
    $choice_view_type->SetSelection(0);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue