Disable sliders if a volume is not selected.
This commit is contained in:
parent
2eea139731
commit
26b6e4c619
@ -79,8 +79,8 @@ sub new {
|
|||||||
my $settings_sizer = Wx::StaticBoxSizer->new($self->{staticbox} = Wx::StaticBox->new($self, -1, "Part Settings"), wxVERTICAL);
|
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);
|
$settings_sizer->Add($self->{settings_panel}, 1, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
my $optgroup;
|
my $optgroup_movers;
|
||||||
$optgroup = $self->{optgroup} = Slic3r::GUI::OptionsGroup->new(
|
$optgroup_movers = $self->{optgroup_movers} = Slic3r::GUI::OptionsGroup->new(
|
||||||
parent => $self,
|
parent => $self,
|
||||||
title => 'Move',
|
title => 'Move',
|
||||||
on_change => sub {
|
on_change => sub {
|
||||||
@ -89,8 +89,8 @@ sub new {
|
|||||||
# genates tens of events for a single value change.
|
# genates tens of events for a single value change.
|
||||||
# Only trigger the recalculation if the value changes
|
# Only trigger the recalculation if the value changes
|
||||||
# or a live preview was activated and the mesh cut is not valid yet.
|
# or a live preview was activated and the mesh cut is not valid yet.
|
||||||
if ($self->{move_options}{$opt_id} != $optgroup->get_value($opt_id)) {
|
if ($self->{move_options}{$opt_id} != $optgroup_movers->get_value($opt_id)) {
|
||||||
$self->{move_options}{$opt_id} = $optgroup->get_value($opt_id);
|
$self->{move_options}{$opt_id} = $optgroup_movers->get_value($opt_id);
|
||||||
wxTheApp->CallAfter(sub {
|
wxTheApp->CallAfter(sub {
|
||||||
$self->_update;
|
$self->_update;
|
||||||
});
|
});
|
||||||
@ -98,7 +98,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
label_width => 20,
|
label_width => 20,
|
||||||
);
|
);
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$optgroup_movers->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'x',
|
opt_id => 'x',
|
||||||
type => 'slider',
|
type => 'slider',
|
||||||
label => 'X',
|
label => 'X',
|
||||||
@ -107,7 +107,7 @@ sub new {
|
|||||||
max => $self->{model_object}->bounding_box->size->x*4,
|
max => $self->{model_object}->bounding_box->size->x*4,
|
||||||
full_width => 1,
|
full_width => 1,
|
||||||
));
|
));
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$optgroup_movers->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'y',
|
opt_id => 'y',
|
||||||
type => 'slider',
|
type => 'slider',
|
||||||
label => 'Y',
|
label => 'Y',
|
||||||
@ -116,7 +116,7 @@ sub new {
|
|||||||
max => $self->{model_object}->bounding_box->size->y*4,
|
max => $self->{model_object}->bounding_box->size->y*4,
|
||||||
full_width => 1,
|
full_width => 1,
|
||||||
));
|
));
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$optgroup_movers->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'z',
|
opt_id => 'z',
|
||||||
type => 'slider',
|
type => 'slider',
|
||||||
label => 'Z',
|
label => 'Z',
|
||||||
@ -125,14 +125,13 @@ sub new {
|
|||||||
max => $self->{model_object}->bounding_box->size->z*4,
|
max => $self->{model_object}->bounding_box->size->z*4,
|
||||||
full_width => 1,
|
full_width => 1,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
# left pane with tree
|
# left pane with tree
|
||||||
my $left_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
my $left_sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
$left_sizer->Add($tree, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
$left_sizer->Add($tree, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||||
$left_sizer->Add($buttons_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
$left_sizer->Add($buttons_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||||
$left_sizer->Add($settings_sizer, 1, wxEXPAND | wxALL, 0);
|
$left_sizer->Add($settings_sizer, 1, wxEXPAND | wxALL, 0);
|
||||||
$left_sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
$left_sizer->Add($optgroup_movers->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
# right pane with preview canvas
|
# right pane with preview canvas
|
||||||
my $canvas;
|
my $canvas;
|
||||||
@ -247,9 +246,9 @@ sub selection_changed {
|
|||||||
$self->{settings_panel}->set_config(undef);
|
$self->{settings_panel}->set_config(undef);
|
||||||
|
|
||||||
# reset move sliders
|
# reset move sliders
|
||||||
$self->{optgroup}->set_value("x", 0);
|
$self->{optgroup_movers}->set_value("x", 0);
|
||||||
$self->{optgroup}->set_value("y", 0);
|
$self->{optgroup_movers}->set_value("y", 0);
|
||||||
$self->{optgroup}->set_value("z", 0);
|
$self->{optgroup_movers}->set_value("z", 0);
|
||||||
$self->{move_options} = {
|
$self->{move_options} = {
|
||||||
x => 0,
|
x => 0,
|
||||||
y => 0,
|
y => 0,
|
||||||
@ -269,6 +268,7 @@ sub selection_changed {
|
|||||||
$self->{canvas}->volumes->[ $itemData->{volume_id} ]{selected} = 1;
|
$self->{canvas}->volumes->[ $itemData->{volume_id} ]{selected} = 1;
|
||||||
}
|
}
|
||||||
$self->{btn_delete}->Enable;
|
$self->{btn_delete}->Enable;
|
||||||
|
$self->{optgroup_movers}->enable;
|
||||||
|
|
||||||
# attach volume config to settings panel
|
# attach volume config to settings panel
|
||||||
my $volume = $self->{model_object}->volumes->[ $itemData->{volume_id} ];
|
my $volume = $self->{model_object}->volumes->[ $itemData->{volume_id} ];
|
||||||
@ -281,6 +281,7 @@ sub selection_changed {
|
|||||||
# select nothing in 3D preview
|
# select nothing in 3D preview
|
||||||
|
|
||||||
# attach object config to settings panel
|
# attach object config to settings panel
|
||||||
|
$self->{optgroup_movers}->disable;
|
||||||
$self->{staticbox}->SetLabel('Object Settings');
|
$self->{staticbox}->SetLabel('Object Settings');
|
||||||
@opt_keys = (map @{$_->get_keys}, Slic3r::Config::PrintObject->new, Slic3r::Config::PrintRegion->new);
|
@opt_keys = (map @{$_->get_keys}, Slic3r::Config::PrintObject->new, Slic3r::Config::PrintRegion->new);
|
||||||
$config = $self->{model_object}->config;
|
$config = $self->{model_object}->config;
|
||||||
@ -345,11 +346,10 @@ sub on_btn_lambda {
|
|||||||
my $name = "lambda-".$params->{"type"};
|
my $name = "lambda-".$params->{"type"};
|
||||||
my $mesh = Slic3r::TriangleMesh->new();
|
my $mesh = Slic3r::TriangleMesh->new();
|
||||||
|
|
||||||
#TODO support non-boxes
|
|
||||||
if ($type eq "box") {
|
if ($type eq "box") {
|
||||||
$mesh = $mesh->cube($params->{"dim"}[0], $params->{"dim"}[1], $params->{"dim"}[2]);
|
$mesh = $mesh->cube($params->{"dim"}[0], $params->{"dim"}[1], $params->{"dim"}[2]);
|
||||||
} elsif ($type eq "cylinder") {
|
} elsif ($type eq "cylinder") {
|
||||||
$mesh = $mesh->cylinder($params->{"dim"}[0], $params->{"dim"}[1]);
|
$mesh = $mesh->cylinder($params->{"cyl_r"}, $params->{"cyl_h"});
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user