diff options
author | YuSanka <yusanka@gmail.com> | 2018-05-14 14:57:08 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2018-05-14 14:57:08 +0300 |
commit | 3bc8d7517a0ff868b2a2731702872857dad01a44 (patch) | |
tree | a63792c4269cade1bd70936b9f3c42992d5d6960 | |
parent | b51197b52cd0374b0cad9acee4fedf0e0900c5b9 (diff) | |
parent | b07e16a3e7ed210c0dc297ed862f33ed938cb821 (diff) |
Merge branch 'master' of https://github.com/prusa3d/Slic3rversion_1.40.0-alpha1
-rw-r--r-- | Build.PL | 1 | ||||
-rw-r--r-- | lib/Slic3r/GUI/Plater/3DPreview.pm | 21 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/3DScene.cpp | 4 |
3 files changed, 21 insertions, 5 deletions
@@ -12,6 +12,7 @@ my %prereqs = qw( ExtUtils::ParseXS 3.22 ExtUtils::XSpp 0 ExtUtils::Typemaps 0 + ExtUtils::Typemaps::Basic 0 File::Basename 0 File::Spec 0 Getopt::Long 0 diff --git a/lib/Slic3r/GUI/Plater/3DPreview.pm b/lib/Slic3r/GUI/Plater/3DPreview.pm index 9d8b82242..b746de98f 100644 --- a/lib/Slic3r/GUI/Plater/3DPreview.pm +++ b/lib/Slic3r/GUI/Plater/3DPreview.pm @@ -58,6 +58,13 @@ sub new { [40,-1], wxALIGN_CENTRE_HORIZONTAL); $z_label_high->SetFont($Slic3r::GUI::small_font); + my $z_label_low_idx = $self->{z_label_low_idx} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, + [40,-1], wxALIGN_CENTRE_HORIZONTAL); + $z_label_low_idx->SetFont($Slic3r::GUI::small_font); + my $z_label_high_idx = $self->{z_label_high_idx} = Wx::StaticText->new($self, -1, "", wxDefaultPosition, + [40,-1], wxALIGN_CENTRE_HORIZONTAL); + $z_label_high_idx->SetFont($Slic3r::GUI::small_font); + $self->single_layer(0); my $checkbox_singlelayer = $self->{checkbox_singlelayer} = Wx::CheckBox->new($self, -1, L("1 Layer")); @@ -103,11 +110,13 @@ sub new { my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); my $vsizer = Wx::BoxSizer->new(wxVERTICAL); my $vsizer_outer = Wx::BoxSizer->new(wxVERTICAL); - $vsizer->Add($slider_low, 3, 0, 0); - $vsizer->Add($z_label_low, 0, 0, 0); + $vsizer->Add($slider_low, 3, wxALIGN_CENTER_HORIZONTAL, 0); + $vsizer->Add($z_label_low_idx, 0, wxALIGN_CENTER_HORIZONTAL, 0); + $vsizer->Add($z_label_low, 0, wxALIGN_CENTER_HORIZONTAL, 0); $hsizer->Add($vsizer, 0, wxEXPAND, 0); $vsizer = Wx::BoxSizer->new(wxVERTICAL); - $vsizer->Add($slider_high, 3, 0, 0); + $vsizer->Add($slider_high, 3, wxALIGN_CENTER_HORIZONTAL, 0); + $vsizer->Add($z_label_high_idx, 0, wxALIGN_CENTER_HORIZONTAL, 0); $vsizer->Add($z_label_high, 0, 0, 0); $hsizer->Add($vsizer, 0, wxEXPAND, 0); $vsizer_outer->Add($hsizer, 3, wxALIGN_CENTER_HORIZONTAL, 0); @@ -325,6 +334,8 @@ sub load_print { $self->slider_high->Hide; $self->{z_label_low}->SetLabel(""); $self->{z_label_high}->SetLabel(""); + $self->{z_label_low_idx}->SetLabel(""); + $self->{z_label_high_idx}->SetLabel(""); $self->canvas->reset_legend_texture(); $self->canvas->Refresh; # clears canvas return; @@ -427,6 +438,10 @@ sub set_z_range return if !$self->enabled; $self->{z_label_low}->SetLabel(sprintf '%.2f', $z_low); $self->{z_label_high}->SetLabel(sprintf '%.2f', $z_high); + my $z_idx_low = 1 + $self->slider_low->GetValue; + my $z_idx_high = 1 + $self->slider_high->GetValue; + $self->{z_label_low_idx}->SetLabel(sprintf '%d', $z_idx_low); + $self->{z_label_high_idx}->SetLabel(sprintf '%d', $z_idx_high); $self->canvas->set_toolpaths_range($z_low - 1e-6, $z_high + 1e-6); $self->canvas->Refresh if $self->IsShown; } diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index 85018404c..df8b1fbfc 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -2204,7 +2204,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, return 0.0f; } - static const GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value) + static GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value) { switch (data.extrusion.view_type) { @@ -2220,7 +2220,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data, return data.get_volumetric_rate_color(value); case GCodePreviewData::Extrusion::Tool: { - static GCodePreviewData::Color color; + GCodePreviewData::Color color; ::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float)); return color; } |