mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fixed conflict after merge with master
This commit is contained in:
		
						commit
						590773d77b
					
				
					 18 changed files with 4553 additions and 2760 deletions
				
			
		| 
						 | 
				
			
			@ -128,8 +128,8 @@ sub new {
 | 
			
		|||
        }
 | 
			
		||||
        $_->set_scaling_factor($scale) for @{ $model_object->instances };
 | 
			
		||||
        
 | 
			
		||||
        $self->{list}->SetItem($obj_idx, 2, ($model_object->instances->[0]->scaling_factor * 100) . "%");        
 | 
			
		||||
        $object->transform_thumbnail($self->{model}, $obj_idx);
 | 
			
		||||
        $self->{list}->SetItem($obj_idx, 2, ($model_object->instances->[0]->scaling_factor * 100) . "%");
 | 
			
		||||
#        $object->transform_thumbnail($self->{model}, $obj_idx);
 | 
			
		||||
    
 | 
			
		||||
        #update print and start background processing
 | 
			
		||||
        $self->{print}->add_model_object($model_object, $obj_idx);
 | 
			
		||||
| 
						 | 
				
			
			@ -277,18 +277,19 @@ sub new {
 | 
			
		|||
        Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{canvas3D}, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{preview3D}->canvas, $self->{canvas3D}); });
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # Initialize 2D preview canvas
 | 
			
		||||
    $self->{canvas} = Slic3r::GUI::Plater::2D->new($self->{preview_notebook}, wxDefaultSize, $self->{objects}, $self->{model}, $self->{config});
 | 
			
		||||
    $self->{preview_notebook}->AddPage($self->{canvas}, L('2D'));
 | 
			
		||||
    $self->{canvas}->on_select_object($on_select_object);
 | 
			
		||||
    $self->{canvas}->on_double_click($on_double_click);
 | 
			
		||||
    $self->{canvas}->on_right_click(sub { $on_right_click->($self->{canvas}, @_); });
 | 
			
		||||
    $self->{canvas}->on_instances_moved($on_instances_moved);
 | 
			
		||||
#    # Initialize 2D preview canvas
 | 
			
		||||
#    $self->{canvas} = Slic3r::GUI::Plater::2D->new($self->{preview_notebook}, wxDefaultSize, $self->{objects}, $self->{model}, $self->{config});
 | 
			
		||||
#    $self->{preview_notebook}->AddPage($self->{canvas}, L('2D'));
 | 
			
		||||
#    $self->{canvas}->on_select_object($on_select_object);
 | 
			
		||||
#    $self->{canvas}->on_double_click($on_double_click);
 | 
			
		||||
#    $self->{canvas}->on_right_click(sub { $on_right_click->($self->{canvas}, @_); });
 | 
			
		||||
#    $self->{canvas}->on_instances_moved($on_instances_moved);
 | 
			
		||||
    
 | 
			
		||||
    # Initialize 3D toolpaths preview
 | 
			
		||||
    if ($Slic3r::GUI::have_OpenGL) {
 | 
			
		||||
        $self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}, $self->{gcode_preview_data}, $self->{config});
 | 
			
		||||
        Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
 | 
			
		||||
        Slic3r::GUI::_3DScene::enable_dynamic_background($self->{preview3D}->canvas, 1);
 | 
			
		||||
        Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{preview3D}->canvas, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas); });
 | 
			
		||||
        $self->{preview_notebook}->AddPage($self->{preview3D}, L('Preview'));
 | 
			
		||||
        $self->{preview3D_page_idx} = $self->{preview_notebook}->GetPageCount-1;
 | 
			
		||||
| 
						 | 
				
			
			@ -386,6 +387,9 @@ sub new {
 | 
			
		|||
        my ($list, $event) = @_;
 | 
			
		||||
        if ($event->GetKeyCode == WXK_TAB) {
 | 
			
		||||
            $list->Navigate($event->ShiftDown ? &Wx::wxNavigateBackward : &Wx::wxNavigateForward);
 | 
			
		||||
        } elsif ($event->GetKeyCode == WXK_DELETE ||
 | 
			
		||||
                ($event->GetKeyCode == WXK_BACK && &Wx::wxMAC) ) {
 | 
			
		||||
            $self->remove;
 | 
			
		||||
        } else {
 | 
			
		||||
            $event->Skip;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -475,7 +479,8 @@ sub new {
 | 
			
		|||
    
 | 
			
		||||
    $_->SetDropTarget(Slic3r::GUI::Plater::DropTarget->new($self))
 | 
			
		||||
        for grep defined($_),
 | 
			
		||||
            $self, $self->{canvas}, $self->{canvas3D}, $self->{preview3D}, $self->{list};
 | 
			
		||||
            $self, $self->{canvas3D}, $self->{preview3D}, $self->{list};
 | 
			
		||||
#            $self, $self->{canvas}, $self->{canvas3D}, $self->{preview3D}, $self->{list};
 | 
			
		||||
    
 | 
			
		||||
    EVT_COMMAND($self, -1, $PROGRESS_BAR_EVENT, sub {
 | 
			
		||||
        my ($self, $event) = @_;
 | 
			
		||||
| 
						 | 
				
			
			@ -506,7 +511,7 @@ sub new {
 | 
			
		|||
        });
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    $self->{canvas}->update_bed_size;
 | 
			
		||||
#    $self->{canvas}->update_bed_size;
 | 
			
		||||
    if ($self->{canvas3D}) {
 | 
			
		||||
        Slic3r::GUI::_3DScene::set_bed_shape($self->{canvas3D}, $self->{config}->bed_shape);
 | 
			
		||||
        Slic3r::GUI::_3DScene::zoom_to_bed($self->{canvas3D});
 | 
			
		||||
| 
						 | 
				
			
			@ -924,8 +929,8 @@ sub load_model_objects {
 | 
			
		|||
    
 | 
			
		||||
        $self->{list}->SetItem($obj_idx, 1, $model_object->instances_count);
 | 
			
		||||
        $self->{list}->SetItem($obj_idx, 2, ($model_object->instances->[0]->scaling_factor * 100) . "%");
 | 
			
		||||
    
 | 
			
		||||
        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
 | 
			
		||||
#        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
    }
 | 
			
		||||
    $self->arrange if $need_arrange;
 | 
			
		||||
    $self->update;
 | 
			
		||||
| 
						 | 
				
			
			@ -1134,7 +1139,7 @@ sub rotate {
 | 
			
		|||
            $inst->set_rotation($rotation);
 | 
			
		||||
            Slic3r::GUI::_3DScene::update_gizmos_data($self->{canvas3D}) if ($self->{canvas3D});            
 | 
			
		||||
        }
 | 
			
		||||
        $object->transform_thumbnail($self->{model}, $obj_idx);
 | 
			
		||||
#        $object->transform_thumbnail($self->{model}, $obj_idx);
 | 
			
		||||
    } else {
 | 
			
		||||
        # rotation around X and Y needs to be performed on mesh
 | 
			
		||||
        # so we first apply any Z rotation
 | 
			
		||||
| 
						 | 
				
			
			@ -1144,9 +1149,9 @@ sub rotate {
 | 
			
		|||
        }
 | 
			
		||||
        $model_object->rotate(deg2rad($angle), $axis);
 | 
			
		||||
        
 | 
			
		||||
        # realign object to Z = 0
 | 
			
		||||
        $model_object->center_around_origin;
 | 
			
		||||
        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
#        # realign object to Z = 0
 | 
			
		||||
#        $model_object->center_around_origin;
 | 
			
		||||
#        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # update print and start background processing
 | 
			
		||||
| 
						 | 
				
			
			@ -1174,9 +1179,9 @@ sub mirror {
 | 
			
		|||
    
 | 
			
		||||
    $model_object->mirror($axis);
 | 
			
		||||
    
 | 
			
		||||
    # realign object to Z = 0
 | 
			
		||||
    $model_object->center_around_origin;
 | 
			
		||||
    $self->reset_thumbnail($obj_idx);
 | 
			
		||||
#    # realign object to Z = 0
 | 
			
		||||
#    $model_object->center_around_origin;
 | 
			
		||||
#    $self->reset_thumbnail($obj_idx);
 | 
			
		||||
        
 | 
			
		||||
    # update print and start background processing
 | 
			
		||||
    $self->stop_background_process;
 | 
			
		||||
| 
						 | 
				
			
			@ -1226,7 +1231,7 @@ sub changescale {
 | 
			
		|||
        #FIXME Scale the layer height profile when $axis == Z?
 | 
			
		||||
        #FIXME Scale the layer height ranges $axis == Z?
 | 
			
		||||
        # object was already aligned to Z = 0, so no need to realign it
 | 
			
		||||
        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
#        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
    } else {
 | 
			
		||||
        my $scale;
 | 
			
		||||
        if ($tosize) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1250,7 +1255,7 @@ sub changescale {
 | 
			
		|||
            $range->[1] *= $variation;
 | 
			
		||||
        }
 | 
			
		||||
        $_->set_scaling_factor($scale) for @{ $model_object->instances };
 | 
			
		||||
        $object->transform_thumbnail($self->{model}, $obj_idx);
 | 
			
		||||
#        $object->transform_thumbnail($self->{model}, $obj_idx);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # update print and start background processing
 | 
			
		||||
| 
						 | 
				
			
			@ -1881,10 +1886,10 @@ sub _get_export_file {
 | 
			
		|||
    return $output_file;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub reset_thumbnail {
 | 
			
		||||
    my ($self, $obj_idx) = @_;
 | 
			
		||||
    $self->{objects}[$obj_idx]->thumbnail(undef);
 | 
			
		||||
}
 | 
			
		||||
#sub reset_thumbnail {
 | 
			
		||||
#    my ($self, $obj_idx) = @_;
 | 
			
		||||
#    $self->{objects}[$obj_idx]->thumbnail(undef);
 | 
			
		||||
#}
 | 
			
		||||
 | 
			
		||||
# this method gets called whenever print center is changed or the objects' bounding box changes
 | 
			
		||||
# (i.e. when an object is added/removed/moved/rotated/scaled)
 | 
			
		||||
| 
						 | 
				
			
			@ -1908,7 +1913,7 @@ sub update {
 | 
			
		|||
        $self->resume_background_process;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $self->{canvas}->reload_scene if $self->{canvas};
 | 
			
		||||
#    $self->{canvas}->reload_scene if $self->{canvas};
 | 
			
		||||
    my $selections = $self->collect_selections;
 | 
			
		||||
    Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
 | 
			
		||||
    Slic3r::GUI::_3DScene::reload_scene($self->{canvas3D}, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1965,7 +1970,7 @@ sub on_config_change {
 | 
			
		|||
    foreach my $opt_key (@{$self->{config}->diff($config)}) {
 | 
			
		||||
        $self->{config}->set($opt_key, $config->get($opt_key));
 | 
			
		||||
        if ($opt_key eq 'bed_shape') {
 | 
			
		||||
            $self->{canvas}->update_bed_size;
 | 
			
		||||
#            $self->{canvas}->update_bed_size;
 | 
			
		||||
            Slic3r::GUI::_3DScene::set_bed_shape($self->{canvas3D}, $self->{config}->bed_shape) if $self->{canvas3D};
 | 
			
		||||
            Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape) if $self->{preview3D};
 | 
			
		||||
            $update_scheduled = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -2031,7 +2036,7 @@ sub list_item_deselected {
 | 
			
		|||
    $self->{_lecursor} = Wx::BusyCursor->new();
 | 
			
		||||
    if ($self->{list}->GetFirstSelected == -1) {
 | 
			
		||||
        $self->select_object(undef);
 | 
			
		||||
        $self->{canvas}->Refresh;
 | 
			
		||||
#        $self->{canvas}->Refresh;
 | 
			
		||||
        Slic3r::GUI::_3DScene::deselect_volumes($self->{canvas3D}) if $self->{canvas3D};
 | 
			
		||||
        Slic3r::GUI::_3DScene::render($self->{canvas3D}) if $self->{canvas3D};
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2044,7 +2049,7 @@ sub list_item_selected {
 | 
			
		|||
    $self->{_lecursor} = Wx::BusyCursor->new();
 | 
			
		||||
    my $obj_idx = $event->GetIndex;
 | 
			
		||||
    $self->select_object($obj_idx);
 | 
			
		||||
    $self->{canvas}->Refresh;
 | 
			
		||||
#    $self->{canvas}->Refresh;
 | 
			
		||||
    if ($self->{canvas3D}) {
 | 
			
		||||
        my $selections = $self->collect_selections;
 | 
			
		||||
        Slic3r::GUI::_3DScene::update_volumes_selection($self->{canvas3D}, \@$selections);
 | 
			
		||||
| 
						 | 
				
			
			@ -2141,19 +2146,19 @@ sub object_settings_dialog {
 | 
			
		|||
	$self->pause_background_process;
 | 
			
		||||
	$dlg->ShowModal;
 | 
			
		||||
	
 | 
			
		||||
    # update thumbnail since parts may have changed
 | 
			
		||||
    if ($dlg->PartsChanged) {
 | 
			
		||||
	    # recenter and re-align to Z = 0
 | 
			
		||||
	    $model_object->center_around_origin;
 | 
			
		||||
        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
    }
 | 
			
		||||
#    # update thumbnail since parts may have changed
 | 
			
		||||
#    if ($dlg->PartsChanged) {
 | 
			
		||||
#	    # recenter and re-align to Z = 0
 | 
			
		||||
#	    $model_object->center_around_origin;
 | 
			
		||||
#        $self->reset_thumbnail($obj_idx);
 | 
			
		||||
#    }
 | 
			
		||||
	
 | 
			
		||||
	# update print
 | 
			
		||||
	if ($dlg->PartsChanged || $dlg->PartSettingsChanged) {
 | 
			
		||||
	    $self->stop_background_process;
 | 
			
		||||
        $self->{print}->reload_object($obj_idx);
 | 
			
		||||
        $self->schedule_background_process;
 | 
			
		||||
        $self->{canvas}->reload_scene if $self->{canvas};
 | 
			
		||||
#        $self->{canvas}->reload_scene if $self->{canvas};
 | 
			
		||||
        my $selections = $self->collect_selections;
 | 
			
		||||
        Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
 | 
			
		||||
        Slic3r::GUI::_3DScene::reload_scene($self->{canvas3D}, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -2477,48 +2482,48 @@ package Slic3r::GUI::Plater::Object;
 | 
			
		|||
use Moo;
 | 
			
		||||
 | 
			
		||||
has 'name'                  => (is => 'rw', required => 1);
 | 
			
		||||
has 'thumbnail'             => (is => 'rw'); # ExPolygon::Collection in scaled model units with no transforms
 | 
			
		||||
has 'transformed_thumbnail' => (is => 'rw');
 | 
			
		||||
has 'instance_thumbnails'   => (is => 'ro', default => sub { [] });  # array of ExPolygon::Collection objects, each one representing the actual placed thumbnail of each instance in pixel units
 | 
			
		||||
#has 'thumbnail'             => (is => 'rw'); # ExPolygon::Collection in scaled model units with no transforms
 | 
			
		||||
#has 'transformed_thumbnail' => (is => 'rw');
 | 
			
		||||
#has 'instance_thumbnails'   => (is => 'ro', default => sub { [] });  # array of ExPolygon::Collection objects, each one representing the actual placed thumbnail of each instance in pixel units
 | 
			
		||||
has 'selected'              => (is => 'rw', default => sub { 0 });
 | 
			
		||||
 | 
			
		||||
sub make_thumbnail {
 | 
			
		||||
    my ($self, $model, $obj_idx) = @_;
 | 
			
		||||
    # make method idempotent
 | 
			
		||||
    $self->thumbnail->clear;
 | 
			
		||||
    # raw_mesh is the non-transformed (non-rotated, non-scaled, non-translated) sum of non-modifier object volumes.
 | 
			
		||||
    my $mesh = $model->objects->[$obj_idx]->raw_mesh;
 | 
			
		||||
#FIXME The "correct" variant could be extremely slow.
 | 
			
		||||
#    if ($mesh->facets_count <= 5000) {
 | 
			
		||||
#        # remove polygons with area <= 1mm
 | 
			
		||||
#        my $area_threshold = Slic3r::Geometry::scale 1;
 | 
			
		||||
#        $self->thumbnail->append(
 | 
			
		||||
#            grep $_->area >= $area_threshold,
 | 
			
		||||
#            @{ $mesh->horizontal_projection },   # horizontal_projection returns scaled expolygons
 | 
			
		||||
#        );
 | 
			
		||||
#        $self->thumbnail->simplify(0.5);
 | 
			
		||||
#    } else {
 | 
			
		||||
        my $convex_hull = Slic3r::ExPolygon->new($mesh->convex_hull);
 | 
			
		||||
        $self->thumbnail->append($convex_hull);
 | 
			
		||||
#    }
 | 
			
		||||
    return $self->thumbnail;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub transform_thumbnail {
 | 
			
		||||
    my ($self, $model, $obj_idx) = @_;
 | 
			
		||||
    
 | 
			
		||||
    return unless defined $self->thumbnail;
 | 
			
		||||
    
 | 
			
		||||
    my $model_object = $model->objects->[$obj_idx];
 | 
			
		||||
    my $model_instance = $model_object->instances->[0];
 | 
			
		||||
    
 | 
			
		||||
    # the order of these transformations MUST be the same everywhere, including
 | 
			
		||||
    # in Slic3r::Print->add_model_object()
 | 
			
		||||
    my $t = $self->thumbnail->clone;
 | 
			
		||||
    $t->rotate($model_instance->rotation, Slic3r::Point->new(0,0));
 | 
			
		||||
    $t->scale($model_instance->scaling_factor);
 | 
			
		||||
    
 | 
			
		||||
    $self->transformed_thumbnail($t);
 | 
			
		||||
}
 | 
			
		||||
#sub make_thumbnail {
 | 
			
		||||
#    my ($self, $model, $obj_idx) = @_;
 | 
			
		||||
#    # make method idempotent
 | 
			
		||||
#    $self->thumbnail->clear;
 | 
			
		||||
#    # raw_mesh is the non-transformed (non-rotated, non-scaled, non-translated) sum of non-modifier object volumes.
 | 
			
		||||
#    my $mesh = $model->objects->[$obj_idx]->raw_mesh;
 | 
			
		||||
##FIXME The "correct" variant could be extremely slow.
 | 
			
		||||
##    if ($mesh->facets_count <= 5000) {
 | 
			
		||||
##        # remove polygons with area <= 1mm
 | 
			
		||||
##        my $area_threshold = Slic3r::Geometry::scale 1;
 | 
			
		||||
##        $self->thumbnail->append(
 | 
			
		||||
##            grep $_->area >= $area_threshold,
 | 
			
		||||
##            @{ $mesh->horizontal_projection },   # horizontal_projection returns scaled expolygons
 | 
			
		||||
##        );
 | 
			
		||||
##        $self->thumbnail->simplify(0.5);
 | 
			
		||||
##    } else {
 | 
			
		||||
#        my $convex_hull = Slic3r::ExPolygon->new($mesh->convex_hull);
 | 
			
		||||
#        $self->thumbnail->append($convex_hull);
 | 
			
		||||
##    }
 | 
			
		||||
#    return $self->thumbnail;
 | 
			
		||||
#}
 | 
			
		||||
#
 | 
			
		||||
#sub transform_thumbnail {
 | 
			
		||||
#    my ($self, $model, $obj_idx) = @_;
 | 
			
		||||
#    
 | 
			
		||||
#    return unless defined $self->thumbnail;
 | 
			
		||||
#    
 | 
			
		||||
#    my $model_object = $model->objects->[$obj_idx];
 | 
			
		||||
#    my $model_instance = $model_object->instances->[0];
 | 
			
		||||
#    
 | 
			
		||||
#    # the order of these transformations MUST be the same everywhere, including
 | 
			
		||||
#    # in Slic3r::Print->add_model_object()
 | 
			
		||||
#    my $t = $self->thumbnail->clone;
 | 
			
		||||
#    $t->rotate($model_instance->rotation, Slic3r::Point->new(0,0));
 | 
			
		||||
#    $t->scale($model_instance->scaling_factor);
 | 
			
		||||
#    
 | 
			
		||||
#    $self->transformed_thumbnail($t);
 | 
			
		||||
#}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@ sub new {
 | 
			
		|||
    # init GUI elements
 | 
			
		||||
    my $canvas = Slic3r::GUI::3DScene->new($self);
 | 
			
		||||
    Slic3r::GUI::_3DScene::enable_shader($canvas, 1);
 | 
			
		||||
    Slic3r::GUI::_3DScene::set_config($canvas, $config);
 | 
			
		||||
    $self->canvas($canvas);
 | 
			
		||||
    my $slider_low = Wx::Slider->new(
 | 
			
		||||
        $self, -1,
 | 
			
		||||
| 
						 | 
				
			
			@ -365,16 +366,8 @@ sub load_print {
 | 
			
		|||
        if ($self->gcode_preview_data->empty) {
 | 
			
		||||
            # load skirt and brim
 | 
			
		||||
            Slic3r::GUI::_3DScene::set_print($self->canvas, $self->print);
 | 
			
		||||
            Slic3r::GUI::_3DScene::load_print_toolpaths($self->canvas);
 | 
			
		||||
            Slic3r::GUI::_3DScene::load_wipe_tower_toolpaths($self->canvas, \@colors);
 | 
			
		||||
            foreach my $object (@{$self->print->objects}) {
 | 
			
		||||
                Slic3r::GUI::_3DScene::load_print_object_toolpaths($self->canvas, $object, \@colors);
 | 
			
		||||
                # Show the objects in very transparent color.
 | 
			
		||||
                #my @volume_ids = $self->canvas->load_object($object->model_object);
 | 
			
		||||
                #$self->canvas->volumes->[$_]->color->[3] = 0.2 for @volume_ids;
 | 
			
		||||
            }
 | 
			
		||||
            Slic3r::GUI::_3DScene::load_preview($self->canvas, \@colors);
 | 
			
		||||
            $self->show_hide_ui_elements('simple');
 | 
			
		||||
            Slic3r::GUI::_3DScene::reset_legend_texture();
 | 
			
		||||
        } else {
 | 
			
		||||
            $self->{force_sliders_full_range} = (Slic3r::GUI::_3DScene::get_volumes_count($self->canvas) == 0);
 | 
			
		||||
            Slic3r::GUI::_3DScene::set_print($self->canvas, $self->print);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -377,10 +377,13 @@ void GCode::do_export(Print *print, const char *path, GCodePreviewData *preview_
 | 
			
		|||
    }
 | 
			
		||||
    fclose(file);
 | 
			
		||||
 | 
			
		||||
    m_normal_time_estimator.post_process_remaining_times(path_tmp, 60.0f);
 | 
			
		||||
    if (print->config.gcode_flavor.value == gcfMarlin)
 | 
			
		||||
    {
 | 
			
		||||
        m_normal_time_estimator.post_process_remaining_times(path_tmp, 60.0f);
 | 
			
		||||
 | 
			
		||||
    if (m_silent_time_estimator_enabled)
 | 
			
		||||
        m_silent_time_estimator.post_process_remaining_times(path_tmp, 60.0f);
 | 
			
		||||
        if (m_silent_time_estimator_enabled)
 | 
			
		||||
            m_silent_time_estimator.post_process_remaining_times(path_tmp, 60.0f);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (! this->m_placeholder_parser_failed_templates.empty()) {
 | 
			
		||||
        // G-code export proceeded, but some of the PlaceholderParser substitutions failed.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,11 +210,12 @@ GLVolume::GLVolume(float r, float g, float b, float a)
 | 
			
		|||
    , selected(false)
 | 
			
		||||
    , is_active(true)
 | 
			
		||||
    , zoom_to_volumes(true)
 | 
			
		||||
    , outside_printer_detection_enabled(true)
 | 
			
		||||
    , shader_outside_printer_detection_enabled(false)
 | 
			
		||||
    , is_outside(false)
 | 
			
		||||
    , hover(false)
 | 
			
		||||
    , is_modifier(false)
 | 
			
		||||
    , is_wipe_tower(false)
 | 
			
		||||
    , is_extrusion_path(false)
 | 
			
		||||
    , tverts_range(0, size_t(-1))
 | 
			
		||||
    , qverts_range(0, size_t(-1))
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -250,7 +251,7 @@ void GLVolume::set_render_color()
 | 
			
		|||
        set_render_color(is_outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR, 4);
 | 
			
		||||
    else if (hover)
 | 
			
		||||
        set_render_color(HOVER_COLOR, 4);
 | 
			
		||||
    else if (is_outside)
 | 
			
		||||
    else if (is_outside && shader_outside_printer_detection_enabled)
 | 
			
		||||
        set_render_color(OUTSIDE_COLOR, 4);
 | 
			
		||||
    else
 | 
			
		||||
        set_render_color(color, 4);
 | 
			
		||||
| 
						 | 
				
			
			@ -441,7 +442,7 @@ void GLVolume::render_VBOs(int color_id, int detection_id, int worldmatrix_id) c
 | 
			
		|||
            ::glColor4f(render_color[0], render_color[1], render_color[2], render_color[3]);
 | 
			
		||||
 | 
			
		||||
        if (detection_id != -1)
 | 
			
		||||
            ::glUniform1i(detection_id, outside_printer_detection_enabled ? 1 : 0);
 | 
			
		||||
            ::glUniform1i(detection_id, shader_outside_printer_detection_enabled ? 1 : 0);
 | 
			
		||||
 | 
			
		||||
        if (worldmatrix_id != -1)
 | 
			
		||||
            ::glUniformMatrix4fv(worldmatrix_id, 1, GL_FALSE, (const GLfloat*)world_matrix().data());
 | 
			
		||||
| 
						 | 
				
			
			@ -460,7 +461,7 @@ void GLVolume::render_VBOs(int color_id, int detection_id, int worldmatrix_id) c
 | 
			
		|||
        ::glColor4f(render_color[0], render_color[1], render_color[2], render_color[3]);
 | 
			
		||||
 | 
			
		||||
    if (detection_id != -1)
 | 
			
		||||
        ::glUniform1i(detection_id, outside_printer_detection_enabled ? 1 : 0);
 | 
			
		||||
        ::glUniform1i(detection_id, shader_outside_printer_detection_enabled ? 1 : 0);
 | 
			
		||||
 | 
			
		||||
    if (worldmatrix_id != -1)
 | 
			
		||||
        ::glUniformMatrix4fv(worldmatrix_id, 1, GL_FALSE, (const GLfloat*)world_matrix().data());
 | 
			
		||||
| 
						 | 
				
			
			@ -633,7 +634,7 @@ std::vector<int> GLVolumeCollection::load_object(
 | 
			
		|||
                    v.extruder_id = extruder_id;
 | 
			
		||||
            }
 | 
			
		||||
            v.is_modifier = model_volume->modifier;
 | 
			
		||||
            v.outside_printer_detection_enabled = !model_volume->modifier;
 | 
			
		||||
            v.shader_outside_printer_detection_enabled = !model_volume->modifier;
 | 
			
		||||
            v.set_origin(Pointf3(instance->offset.x, instance->offset.y, 0.0));
 | 
			
		||||
            v.set_angle_z(instance->rotation);
 | 
			
		||||
            v.set_scale_factor(instance->scaling_factor);
 | 
			
		||||
| 
						 | 
				
			
			@ -1793,6 +1794,11 @@ void _3DScene::enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable)
 | 
			
		|||
    s_canvas_mgr.enable_force_zoom_to_bed(canvas, enable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::enable_dynamic_background(wxGLCanvas* canvas, bool enable)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.enable_dynamic_background(canvas, enable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::allow_multisample(wxGLCanvas* canvas, bool allow)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.allow_multisample(canvas, allow);
 | 
			
		||||
| 
						 | 
				
			
			@ -2054,26 +2060,16 @@ void _3DScene::reload_scene(wxGLCanvas* canvas, bool force)
 | 
			
		|||
    s_canvas_mgr.reload_scene(canvas, force);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::load_print_toolpaths(wxGLCanvas* canvas)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.load_print_toolpaths(canvas);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.load_print_object_toolpaths(canvas, print_object, str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.load_wipe_tower_toolpaths(canvas, str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.load_gcode_preview(canvas, preview_data, str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::load_preview(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.load_preview(canvas, str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _3DScene::reset_legend_texture()
 | 
			
		||||
{
 | 
			
		||||
    s_canvas_mgr.reset_legend_texture();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -289,8 +289,8 @@ public:
 | 
			
		|||
    bool                is_active;
 | 
			
		||||
    // Whether or not to use this volume when applying zoom_to_volumes()
 | 
			
		||||
    bool                zoom_to_volumes;
 | 
			
		||||
    // Wheter or not this volume is enabled for outside print volume detection.
 | 
			
		||||
    bool                outside_printer_detection_enabled;
 | 
			
		||||
    // Wheter or not this volume is enabled for outside print volume detection in shader.
 | 
			
		||||
    bool                shader_outside_printer_detection_enabled;
 | 
			
		||||
    // Wheter or not this volume is outside print volume.
 | 
			
		||||
    bool                is_outside;
 | 
			
		||||
    // Boolean: Is mouse over this object?
 | 
			
		||||
| 
						 | 
				
			
			@ -299,6 +299,8 @@ public:
 | 
			
		|||
    bool                is_modifier;
 | 
			
		||||
    // Wheter or not this volume has been generated from the wipe tower
 | 
			
		||||
    bool                is_wipe_tower;
 | 
			
		||||
    // Wheter or not this volume has been generated from an extrusion path
 | 
			
		||||
    bool                is_extrusion_path;
 | 
			
		||||
 | 
			
		||||
    // Interleaved triangles & normals with indexed triangles & quads.
 | 
			
		||||
    GLIndexedVertexArray        indexed_vertex_array;
 | 
			
		||||
| 
						 | 
				
			
			@ -500,6 +502,7 @@ public:
 | 
			
		|||
//###################################################################################################################################
 | 
			
		||||
    static void enable_shader(wxGLCanvas* canvas, bool enable);
 | 
			
		||||
    static void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
 | 
			
		||||
    static void enable_dynamic_background(wxGLCanvas* canvas, bool enable);
 | 
			
		||||
    static void allow_multisample(wxGLCanvas* canvas, bool allow);
 | 
			
		||||
 | 
			
		||||
//###################################################################################################################################
 | 
			
		||||
| 
						 | 
				
			
			@ -560,10 +563,8 @@ public:
 | 
			
		|||
 | 
			
		||||
    static void reload_scene(wxGLCanvas* canvas, bool force);
 | 
			
		||||
 | 
			
		||||
    static void load_print_toolpaths(wxGLCanvas* canvas);
 | 
			
		||||
    static void load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    static void load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    static void load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    static void load_preview(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
 | 
			
		||||
    static void reset_legend_texture();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -458,6 +458,7 @@ private:
 | 
			
		|||
    bool m_picking_enabled;
 | 
			
		||||
    bool m_moving_enabled;
 | 
			
		||||
    bool m_shader_enabled;
 | 
			
		||||
    bool m_dynamic_background_enabled;
 | 
			
		||||
    bool m_multisample_allowed;
 | 
			
		||||
 | 
			
		||||
    std::string m_color_by;
 | 
			
		||||
| 
						 | 
				
			
			@ -567,6 +568,7 @@ public:
 | 
			
		|||
//###################################################################################################################################
 | 
			
		||||
    void enable_shader(bool enable);
 | 
			
		||||
    void enable_force_zoom_to_bed(bool enable);
 | 
			
		||||
    void enable_dynamic_background(bool enable);
 | 
			
		||||
    void allow_multisample(bool allow);
 | 
			
		||||
 | 
			
		||||
//###################################################################################################################################
 | 
			
		||||
| 
						 | 
				
			
			@ -592,16 +594,8 @@ public:
 | 
			
		|||
 | 
			
		||||
    void reload_scene(bool force);
 | 
			
		||||
 | 
			
		||||
    // Create 3D thick extrusion lines for a skirt and brim.
 | 
			
		||||
    // Adds a new Slic3r::GUI::3DScene::Volume to volumes.
 | 
			
		||||
    void load_print_toolpaths();
 | 
			
		||||
    // Create 3D thick extrusion lines for object forming extrusions.
 | 
			
		||||
    // Adds a new Slic3r::GUI::3DScene::Volume to $self->volumes,
 | 
			
		||||
    // one for perimeters, one for infill and one for supports.
 | 
			
		||||
    void load_print_object_toolpaths(const PrintObject& print_object, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    // Create 3D thick extrusion lines for wipe tower extrusions
 | 
			
		||||
    void load_wipe_tower_toolpaths(const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    void load_gcode_preview(const GCodePreviewData& preview_data, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    void load_preview(const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
 | 
			
		||||
    void register_on_viewport_changed_callback(void* callback);
 | 
			
		||||
    void register_on_double_click_callback(void* callback);
 | 
			
		||||
| 
						 | 
				
			
			@ -710,7 +704,17 @@ private:
 | 
			
		|||
    void _stop_timer();
 | 
			
		||||
 | 
			
		||||
    int _get_first_selected_object_id() const;
 | 
			
		||||
    int _get_first_selected_volume_id() const;
 | 
			
		||||
    int _get_first_selected_volume_id(int object_id) const;
 | 
			
		||||
 | 
			
		||||
    // Create 3D thick extrusion lines for a skirt and brim.
 | 
			
		||||
    // Adds a new Slic3r::GUI::3DScene::Volume to volumes.
 | 
			
		||||
    void _load_print_toolpaths();
 | 
			
		||||
    // Create 3D thick extrusion lines for object forming extrusions.
 | 
			
		||||
    // Adds a new Slic3r::GUI::3DScene::Volume to $self->volumes,
 | 
			
		||||
    // one for perimeters, one for infill and one for supports.
 | 
			
		||||
    void _load_print_object_toolpaths(const PrintObject& print_object, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    // Create 3D thick extrusion lines for wipe tower extrusions
 | 
			
		||||
    void _load_wipe_tower_toolpaths(const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
 | 
			
		||||
    // generates gcode extrusion paths geometry
 | 
			
		||||
    void _load_gcode_extrusion_paths(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors);
 | 
			
		||||
| 
						 | 
				
			
			@ -727,6 +731,8 @@ private:
 | 
			
		|||
    void _load_shells();
 | 
			
		||||
    // sets gcode geometry visibility according to user selection
 | 
			
		||||
    void _update_gcode_volumes_visibility(const GCodePreviewData& preview_data);
 | 
			
		||||
    void _update_toolpath_volumes_outside_state();
 | 
			
		||||
    void _show_warning_texture_if_needed();
 | 
			
		||||
 | 
			
		||||
    void _on_move(const std::vector<int>& volume_idxs);
 | 
			
		||||
    void _on_select(int volume_idx);
 | 
			
		||||
| 
						 | 
				
			
			@ -738,6 +744,8 @@ private:
 | 
			
		|||
    void _generate_warning_texture(const std::string& msg);
 | 
			
		||||
    void _reset_warning_texture();
 | 
			
		||||
 | 
			
		||||
    bool _is_any_volume_outside() const;
 | 
			
		||||
 | 
			
		||||
    static std::vector<float> _parse_colors(const std::vector<std::string>& colors);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -427,6 +427,13 @@ void GLCanvas3DManager::enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable
 | 
			
		|||
        it->second->enable_force_zoom_to_bed(enable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::enable_dynamic_background(wxGLCanvas* canvas, bool enable)
 | 
			
		||||
{
 | 
			
		||||
    CanvasesMap::iterator it = _get_canvas(canvas);
 | 
			
		||||
    if (it != m_canvases.end())
 | 
			
		||||
        it->second->enable_dynamic_background(enable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::allow_multisample(wxGLCanvas* canvas, bool allow)
 | 
			
		||||
{
 | 
			
		||||
    CanvasesMap::iterator it = _get_canvas(canvas);
 | 
			
		||||
| 
						 | 
				
			
			@ -540,30 +547,6 @@ void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force)
 | 
			
		|||
        it->second->reload_scene(force);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::load_print_toolpaths(wxGLCanvas* canvas)
 | 
			
		||||
{
 | 
			
		||||
    CanvasesMap::iterator it = _get_canvas(canvas);
 | 
			
		||||
    if (it != m_canvases.end())
 | 
			
		||||
        it->second->load_print_toolpaths();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    if (print_object == nullptr)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    CanvasesMap::iterator it = _get_canvas(canvas);
 | 
			
		||||
    if (it != m_canvases.end())
 | 
			
		||||
        it->second->load_print_object_toolpaths(*print_object, tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    CanvasesMap::iterator it = _get_canvas(canvas);
 | 
			
		||||
    if (it != m_canvases.end())
 | 
			
		||||
        it->second->load_wipe_tower_toolpaths(str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    if (preview_data == nullptr)
 | 
			
		||||
| 
						 | 
				
			
			@ -574,6 +557,13 @@ void GLCanvas3DManager::load_gcode_preview(wxGLCanvas* canvas, const GCodePrevie
 | 
			
		|||
        it->second->load_gcode_preview(*preview_data, str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::load_preview(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors)
 | 
			
		||||
{
 | 
			
		||||
    CanvasesMap::iterator it = _get_canvas(canvas);
 | 
			
		||||
    if (it != m_canvases.end())
 | 
			
		||||
        it->second->load_preview(str_tool_colors);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLCanvas3DManager::reset_legend_texture()
 | 
			
		||||
{
 | 
			
		||||
    for (CanvasesMap::value_type& canvas : m_canvases)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -115,6 +115,7 @@ public:
 | 
			
		|||
//###################################################################################################################################
 | 
			
		||||
    void enable_shader(wxGLCanvas* canvas, bool enable);
 | 
			
		||||
    void enable_force_zoom_to_bed(wxGLCanvas* canvas, bool enable);
 | 
			
		||||
    void enable_dynamic_background(wxGLCanvas* canvas, bool enable);
 | 
			
		||||
    void allow_multisample(wxGLCanvas* canvas, bool allow);
 | 
			
		||||
 | 
			
		||||
//###################################################################################################################################
 | 
			
		||||
| 
						 | 
				
			
			@ -140,10 +141,8 @@ public:
 | 
			
		|||
 | 
			
		||||
    void reload_scene(wxGLCanvas* canvas, bool force);
 | 
			
		||||
 | 
			
		||||
    void load_print_toolpaths(wxGLCanvas* canvas);
 | 
			
		||||
    void load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& tool_colors);
 | 
			
		||||
    void load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    void load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
    void load_preview(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
 | 
			
		||||
 | 
			
		||||
    void reset_legend_texture();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -250,6 +250,7 @@ bool select_language(wxArrayString & names,
 | 
			
		|||
		g_wxLocale->AddCatalogLookupPathPrefix(wxPathOnly(localization_dir()));
 | 
			
		||||
		g_wxLocale->AddCatalog(g_wxApp->GetAppName());
 | 
			
		||||
		wxSetlocale(LC_NUMERIC, "C");
 | 
			
		||||
		Preset::update_suffix_modified();
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	return false;
 | 
			
		||||
| 
						 | 
				
			
			@ -275,6 +276,7 @@ bool load_language()
 | 
			
		|||
			g_wxLocale->AddCatalogLookupPathPrefix(wxPathOnly(localization_dir()));
 | 
			
		||||
			g_wxLocale->AddCatalog(g_wxApp->GetAppName());
 | 
			
		||||
			wxSetlocale(LC_NUMERIC, "C");
 | 
			
		||||
			Preset::update_suffix_modified();
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -146,6 +146,11 @@ const std::string& Preset::suffix_modified()
 | 
			
		|||
{
 | 
			
		||||
    return g_suffix_modified;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Preset::update_suffix_modified()
 | 
			
		||||
{
 | 
			
		||||
	g_suffix_modified = (" (" + _(L("modified")) + ")").ToUTF8().data();
 | 
			
		||||
}
 | 
			
		||||
// Remove an optional "(modified)" suffix from a name.
 | 
			
		||||
// This converts a UI name to a unique preset identifier.
 | 
			
		||||
std::string Preset::remove_suffix_modified(const std::string &name)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -167,6 +167,7 @@ public:
 | 
			
		|||
    static const std::vector<std::string>&  printer_options();
 | 
			
		||||
    // Nozzle options of the printer options.
 | 
			
		||||
    static const std::vector<std::string>&  nozzle_options();
 | 
			
		||||
	static void update_suffix_modified();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    friend class        PresetCollection;
 | 
			
		||||
| 
						 | 
				
			
			@ -260,7 +261,7 @@ public:
 | 
			
		|||
	// used to update preset_choice from Tab
 | 
			
		||||
	const std::deque<Preset>&	get_presets()	{ return m_presets; }
 | 
			
		||||
	int						get_idx_selected()	{ return m_idx_selected; }
 | 
			
		||||
	const std::string&		get_suffix_modified();
 | 
			
		||||
	static const std::string&	get_suffix_modified();
 | 
			
		||||
 | 
			
		||||
    // Return a preset possibly with modifications.
 | 
			
		||||
	Preset&			default_preset()			{ return m_presets.front(); }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -552,6 +552,8 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
 | 
			
		|||
    std::string &inherits                       = Preset::inherits(config);
 | 
			
		||||
    compatible_printers_condition_values.resize(num_extruders + 2, std::string());
 | 
			
		||||
    inherits_values.resize(num_extruders + 2, std::string());
 | 
			
		||||
    // The "default_filament_profile" will be later extracted into the printer profile.
 | 
			
		||||
    config.option<ConfigOptionStrings>("default_filament_profile", true)->values.resize(num_extruders, std::string());
 | 
			
		||||
 | 
			
		||||
    // 1) Create a name from the file name.
 | 
			
		||||
    // Keep the suffix (.ini, .gcode, .amf, .3mf etc) to differentiate it from the normal profiles.
 | 
			
		||||
| 
						 | 
				
			
			@ -576,7 +578,6 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
 | 
			
		|||
    // 3) Now load the filaments. If there are multiple filament presets, split them and load them.
 | 
			
		||||
    auto old_filament_profile_names = config.option<ConfigOptionStrings>("filament_settings_id", true);
 | 
			
		||||
	old_filament_profile_names->values.resize(num_extruders, std::string());
 | 
			
		||||
    config.option<ConfigOptionStrings>("default_filament_profile", true)->values.resize(num_extruders, std::string());
 | 
			
		||||
 | 
			
		||||
    if (num_extruders <= 1) {
 | 
			
		||||
        // Split the "compatible_printers_condition" and "inherits" from the cummulative vectors to separate filament presets.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2728,7 +2728,7 @@ void SavePresetWindow::accept()
 | 
			
		|||
		const char* unusable_symbols = "<>:/\\|?*\"";
 | 
			
		||||
		bool is_unusable_symbol = false;
 | 
			
		||||
		bool is_unusable_postfix = false;
 | 
			
		||||
		const std::string unusable_postfix = "(modified)";
 | 
			
		||||
		const std::string unusable_postfix = PresetCollection::get_suffix_modified();//"(modified)";
 | 
			
		||||
		for (size_t i = 0; i < std::strlen(unusable_symbols); i++){
 | 
			
		||||
			if (m_chosen_name.find_first_of(unusable_symbols[i]) != std::string::npos){
 | 
			
		||||
				is_unusable_symbol = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -2743,8 +2743,9 @@ void SavePresetWindow::accept()
 | 
			
		|||
							_(L("the following characters are not allowed:")) + " <>:/\\|?*\"");
 | 
			
		||||
		}
 | 
			
		||||
		else if (is_unusable_postfix){
 | 
			
		||||
			show_error(this,	_(L("The supplied name is not valid;")) + "\n" + 
 | 
			
		||||
								_(L("the following postfix are not allowed:")) + "\n\t" + unusable_postfix);
 | 
			
		||||
			show_error(this,_(L("The supplied name is not valid;")) + "\n" +
 | 
			
		||||
							_(L("the following postfix are not allowed:")) + "\n\t" + //unusable_postfix);
 | 
			
		||||
							wxString::FromUTF8(unusable_postfix.c_str()));
 | 
			
		||||
		}
 | 
			
		||||
		else if (m_chosen_name.compare("- default -") == 0) {
 | 
			
		||||
			show_error(this, _(L("The supplied name is not available.")));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -437,6 +437,13 @@ enable_force_zoom_to_bed(canvas, enable)
 | 
			
		|||
    CODE:
 | 
			
		||||
        _3DScene::enable_force_zoom_to_bed((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
enable_dynamic_background(canvas, enable)
 | 
			
		||||
        SV   *canvas;
 | 
			
		||||
        bool enable;
 | 
			
		||||
    CODE:
 | 
			
		||||
        _3DScene::enable_dynamic_background((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), enable);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
allow_multisample(canvas, allow)
 | 
			
		||||
        SV   *canvas;
 | 
			
		||||
| 
						 | 
				
			
			@ -772,27 +779,6 @@ reload_scene(canvas, force)
 | 
			
		|||
    CODE:
 | 
			
		||||
        _3DScene::reload_scene((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), force);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
load_print_toolpaths(canvas)
 | 
			
		||||
        SV *canvas;
 | 
			
		||||
    CODE:
 | 
			
		||||
        _3DScene::load_print_toolpaths((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
load_print_object_toolpaths(canvas, print_object, tool_colors)
 | 
			
		||||
        SV                       *canvas;
 | 
			
		||||
        PrintObject              *print_object;
 | 
			
		||||
        std::vector<std::string> tool_colors;
 | 
			
		||||
    CODE:
 | 
			
		||||
        _3DScene::load_print_object_toolpaths((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), print_object, tool_colors);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
load_wipe_tower_toolpaths(canvas, tool_colors)
 | 
			
		||||
        SV                       *canvas;
 | 
			
		||||
        std::vector<std::string> tool_colors;
 | 
			
		||||
    CODE:
 | 
			
		||||
        _3DScene::load_wipe_tower_toolpaths((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), tool_colors);
 | 
			
		||||
 | 
			
		||||
void 
 | 
			
		||||
load_gcode_preview(canvas, preview_data, str_tool_colors)
 | 
			
		||||
        SV                       *canvas;
 | 
			
		||||
| 
						 | 
				
			
			@ -800,5 +786,12 @@ load_gcode_preview(canvas, preview_data, str_tool_colors)
 | 
			
		|||
        std::vector<std::string> str_tool_colors;
 | 
			
		||||
    CODE:
 | 
			
		||||
        _3DScene::load_gcode_preview((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), preview_data, str_tool_colors);
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
load_preview(canvas, str_tool_colors)
 | 
			
		||||
        SV                       *canvas;
 | 
			
		||||
        std::vector<std::string> str_tool_colors;
 | 
			
		||||
    CODE:
 | 
			
		||||
        _3DScene::load_preview((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), str_tool_colors);
 | 
			
		||||
 | 
			
		||||
%}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue