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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-09-14 16:12:20 +0300
committerbubnikv <bubnikv@gmail.com>2018-09-14 16:12:20 +0300
commit4ec4c9364e9ff4ca689a61433d95bf45d8b49511 (patch)
treebbcfa3dea142ccf818ad56e67374719473cc9d0a /lib/Slic3r/GUI
parent61a6aa86922cf1a123dfef14e525fd2d9ee42fe1 (diff)
parent6de8e211317578e71398170fd0b4d215d9cc2781 (diff)
Merge remote-tracking branch 'origin/support_improvements'
Diffstat (limited to 'lib/Slic3r/GUI')
-rw-r--r--lib/Slic3r/GUI/Plater/ObjectCutDialog.pm2
-rw-r--r--lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm79
-rw-r--r--lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm50
3 files changed, 104 insertions, 27 deletions
diff --git a/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm b/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm
index 26a6fdec3..77efbb29b 100644
--- a/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm
+++ b/lib/Slic3r/GUI/Plater/ObjectCutDialog.pm
@@ -238,7 +238,7 @@ sub _update {
my @expolygons = ();
foreach my $volume (@{$self->{model_object}->volumes}) {
next if !$volume->mesh;
- next if $volume->modifier;
+ next if !$volume->model_part;
my $expp = $volume->mesh->slice([ $z_cut ])->[0];
push @expolygons, @$expp;
}
diff --git a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
index 4032886f3..fd02a030f 100644
--- a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
+++ b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
@@ -16,6 +16,8 @@ use base 'Wx::Panel';
use constant ICON_OBJECT => 0;
use constant ICON_SOLIDMESH => 1;
use constant ICON_MODIFIERMESH => 2;
+use constant ICON_SUPPORT_ENFORCER => 3;
+use constant ICON_SUPPORT_BLOCKER => 4;
sub new {
my ($class, $parent, %params) = @_;
@@ -35,7 +37,7 @@ sub new {
y => 0,
z => 0,
};
-
+
# create TreeCtrl
my $tree = $self->{tree} = Wx::TreeCtrl->new($self, -1, wxDefaultPosition, [300, 100],
wxTR_NO_BUTTONS | wxSUNKEN_BORDER | wxTR_HAS_VARIABLE_ROW_HEIGHT
@@ -46,6 +48,8 @@ sub new {
$self->{tree_icons}->Add(Wx::Bitmap->new(Slic3r::var("brick.png"), wxBITMAP_TYPE_PNG)); # ICON_OBJECT
$self->{tree_icons}->Add(Wx::Bitmap->new(Slic3r::var("package.png"), wxBITMAP_TYPE_PNG)); # ICON_SOLIDMESH
$self->{tree_icons}->Add(Wx::Bitmap->new(Slic3r::var("plugin.png"), wxBITMAP_TYPE_PNG)); # ICON_MODIFIERMESH
+ $self->{tree_icons}->Add(Wx::Bitmap->new(Slic3r::var("support_enforcer.png"), wxBITMAP_TYPE_PNG)); # ICON_SUPPORT_ENFORCER
+ $self->{tree_icons}->Add(Wx::Bitmap->new(Slic3r::var("support_blocker.png"), wxBITMAP_TYPE_PNG)); # ICON_SUPPORT_BLOCKER
my $rootId = $tree->AddRoot("Object", ICON_OBJECT);
$tree->SetPlData($rootId, { type => 'object' });
@@ -89,7 +93,14 @@ sub new {
$self->{btn_move_down}->SetFont($Slic3r::GUI::small_font);
# part settings panel
- $self->{settings_panel} = Slic3r::GUI::Plater::OverrideSettingsPanel->new($self, on_change => sub { $self->{part_settings_changed} = 1; $self->_update_canvas; });
+ $self->{settings_panel} = Slic3r::GUI::Plater::OverrideSettingsPanel->new($self, on_change => sub {
+ my ($key, $value) = @_;
+ wxTheApp->CallAfter(sub {
+ $self->set_part_type($value) if ($key eq "part_type");
+ $self->{part_settings_changed} = 1;
+ $self->_update_canvas;
+ });
+ });
my $settings_sizer = Wx::StaticBoxSizer->new($self->{staticbox} = Wx::StaticBox->new($self, -1, "Part Settings"), wxVERTICAL);
$settings_sizer->Add($self->{settings_panel}, 1, wxEXPAND | wxALL, 0);
@@ -225,8 +236,11 @@ sub reload_tree {
my $selectedId = $rootId;
foreach my $volume_id (0..$#{$object->volumes}) {
my $volume = $object->volumes->[$volume_id];
-
- my $icon = $volume->modifier ? ICON_MODIFIERMESH : ICON_SOLIDMESH;
+ my $icon =
+ $volume->modifier ? ICON_MODIFIERMESH :
+ $volume->support_enforcer ? ICON_SUPPORT_ENFORCER :
+ $volume->support_blocker ? ICON_SUPPORT_BLOCKER :
+ ICON_SOLIDMESH;
my $itemId = $tree->AppendItem($rootId, $volume->name || $volume_id, $icon);
if ($volume_id == $selected_volume_idx) {
$selectedId = $itemId;
@@ -288,6 +302,8 @@ sub selection_changed {
if (my $itemData = $self->get_selection) {
my ($config, @opt_keys);
+ my $type = Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_OBJECT;
+ my $support = 0;
if ($itemData->{type} eq 'volume') {
# select volume in 3D preview
if ($self->{canvas}) {
@@ -301,16 +317,24 @@ sub selection_changed {
# attach volume config to settings panel
my $volume = $self->{model_object}->volumes->[ $itemData->{volume_id} ];
- if ($volume->modifier) {
+ if (! $volume->model_part) {
$self->{optgroup_movers}->enable;
+ if ($volume->support_enforcer || $volume->support_blocker) {
+ $support = 1;
+ $type = $volume->support_enforcer ?
+ Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_SUPPORT_ENFORCER :
+ Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_SUPPORT_BLOCKER;
+ } else {
+ $type = Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_MODIFIER;
+ }
} else {
+ $type = Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_PART;
$self->{optgroup_movers}->disable;
}
$config = $volume->config;
$self->{staticbox}->SetLabel('Part Settings');
-
# get default values
- @opt_keys = @{Slic3r::Config::PrintRegion->new->get_keys};
+ @opt_keys = $support ? () : @{Slic3r::Config::PrintRegion->new->get_keys};
} elsif ($itemData->{type} eq 'object') {
# select nothing in 3D preview
@@ -323,33 +347,54 @@ sub selection_changed {
# get default values
my $default_config = Slic3r::Config::new_from_defaults_keys(\@opt_keys);
- # decide which settings will be shown by default
+ # decide which settings will be shown by default
if ($itemData->{type} eq 'object') {
$config->set_ifndef('wipe_into_objects', 0);
$config->set_ifndef('wipe_into_infill', 0);
}
# append default extruder
- push @opt_keys, 'extruder';
- $default_config->set('extruder', 0);
- $config->set_ifndef('extruder', 0);
+ if (! $support) {
+ push @opt_keys, 'extruder';
+ $default_config->set('extruder', 0);
+ $config->set_ifndef('extruder', 0);
+ }
+ $self->{settings_panel}->set_type($type);
$self->{settings_panel}->set_default_config($default_config);
$self->{settings_panel}->set_config($config);
$self->{settings_panel}->set_opt_keys(\@opt_keys);
# disable minus icon to remove the settings
- if ($itemData->{type} eq 'object') {
- $self->{settings_panel}->set_fixed_options([qw(extruder), qw(wipe_into_infill), qw(wipe_into_objects)]);
- } else {
- $self->{settings_panel}->set_fixed_options([qw(extruder)]);
- }
-
+ my $fixed_options =
+ ($itemData->{type} eq 'object') ? [qw(extruder), qw(wipe_into_infill), qw(wipe_into_objects)] :
+ $support ? [] : [qw(extruder)];
+ $self->{settings_panel}->set_fixed_options($fixed_options);
$self->{settings_panel}->enable;
}
Slic3r::GUI::_3DScene::render($self->{canvas}) if $self->{canvas};
}
+sub set_part_type
+{
+ my ($self, $part_type) = @_;
+ if (my $itemData = $self->get_selection) {
+ if ($itemData->{type} eq 'volume') {
+ my $volume = $self->{model_object}->volumes->[ $itemData->{volume_id} ];
+ if ($part_type == Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_MODIFIER ||
+ $part_type == Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_PART) {
+ $volume->set_modifier($part_type == Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_MODIFIER);
+ } elsif ($part_type == Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_SUPPORT_ENFORCER) {
+ $volume->set_support_enforcer;
+ } elsif ($part_type == Slic3r::GUI::Plater::OverrideSettingsPanel->TYPE_SUPPORT_BLOCKER) {
+ $volume->set_support_blocker;
+ }
+ # We want the icon of the selected item to be changed as well.
+ $self->reload_tree($itemData->{volume_id});
+ }
+ }
+}
+
sub on_btn_load {
my ($self, $is_modifier) = @_;
diff --git a/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm b/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm
index ea4ce7132..b085871f0 100644
--- a/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm
+++ b/lib/Slic3r/GUI/Plater/OverrideSettingsPanel.pm
@@ -7,15 +7,20 @@ use warnings;
use utf8;
use List::Util qw(first);
-use Wx qw(:misc :sizer :button wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG
- wxTheApp);
-use Wx::Event qw(EVT_BUTTON EVT_LEFT_DOWN EVT_MENU);
+use Wx qw(:misc :sizer :button :combobox wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG wxTheApp);
+use Wx::Event qw(EVT_BUTTON EVT_COMBOBOX EVT_LEFT_DOWN EVT_MENU);
use base 'Wx::ScrolledWindow';
use constant ICON_MATERIAL => 0;
use constant ICON_SOLIDMESH => 1;
use constant ICON_MODIFIERMESH => 2;
+use constant TYPE_OBJECT => -1;
+use constant TYPE_PART => 0;
+use constant TYPE_MODIFIER => 1;
+use constant TYPE_SUPPORT_ENFORCER => 2;
+use constant TYPE_SUPPORT_BLOCKER => 3;
+
my %icons = (
'Advanced' => 'wand.png',
'Extruders' => 'funnel.png',
@@ -36,13 +41,14 @@ sub new {
$self->{config} = Slic3r::Config->new;
# On change callback.
$self->{on_change} = $params{on_change};
+ $self->{type} = TYPE_OBJECT;
$self->{fixed_options} = {};
$self->{sizer} = Wx::BoxSizer->new(wxVERTICAL);
$self->{options_sizer} = Wx::BoxSizer->new(wxVERTICAL);
$self->{sizer}->Add($self->{options_sizer}, 0, wxEXPAND | wxALL, 0);
-
+
# option selector
{
# create the button
@@ -110,6 +116,16 @@ sub set_opt_keys {
$self->{options} = [ sort { $self->{option_labels}{$a} cmp $self->{option_labels}{$b} } @$opt_keys ];
}
+sub set_type {
+ my ($self, $type) = @_;
+ $self->{type} = $type;
+ if ($type == TYPE_SUPPORT_ENFORCER || $type == TYPE_SUPPORT_BLOCKER) {
+ $self->{btn_add}->Hide;
+ } else {
+ $self->{btn_add}->Show;
+ }
+}
+
sub set_fixed_options {
my ($self, $opt_keys) = @_;
$self->{fixed_options} = { map {$_ => 1} @$opt_keys };
@@ -121,12 +137,28 @@ sub update_optgroup {
$self->{options_sizer}->Clear(1);
return if !defined $self->{config};
-
+
+ if ($self->{type} != TYPE_OBJECT) {
+ my $label = Wx::StaticText->new($self, -1, "Type:"),
+ my $selection = [ "Part", "Modifier", "Support Enforcer", "Support Blocker" ];
+ my $field = Wx::ComboBox->new($self, -1, $selection->[$self->{type}], wxDefaultPosition, Wx::Size->new(160, -1), $selection, wxCB_READONLY);
+ my $sizer = Wx::BoxSizer->new(wxHORIZONTAL);
+ $sizer->Add($label, 1, wxEXPAND | wxALL, 5);
+ $sizer->Add($field, 0, wxALL, 5);
+ EVT_COMBOBOX($self, $field, sub {
+ my $idx = $field->GetSelection; # get index of selected value
+ $self->{on_change}->("part_type", $idx) if $self->{on_change};
+ });
+ $self->{options_sizer}->Add($sizer, 0, wxEXPAND | wxBOTTOM, 0);
+ }
+
my %categories = ();
- foreach my $opt_key (@{$self->{config}->get_keys}) {
- my $category = $Slic3r::Config::Options->{$opt_key}{category};
- $categories{$category} ||= [];
- push @{$categories{$category}}, $opt_key;
+ if ($self->{type} != TYPE_SUPPORT_ENFORCER && $self->{type} != TYPE_SUPPORT_BLOCKER) {
+ foreach my $opt_key (@{$self->{config}->get_keys}) {
+ my $category = $Slic3r::Config::Options->{$opt_key}{category};
+ $categories{$category} ||= [];
+ push @{$categories{$category}}, $opt_key;
+ }
}
foreach my $category (sort keys %categories) {
my $optgroup = Slic3r::GUI::ConfigOptionsGroup->new(