Merge branch 'master' of https://github.com/prusa3d/Slic3r into gcode_preview
This commit is contained in:
commit
37fa1f296d
7 changed files with 41 additions and 31 deletions
|
@ -40,10 +40,10 @@ use Wx::Event qw(EVT_IDLE EVT_COMMAND EVT_MENU);
|
|||
use base 'Wx::App';
|
||||
|
||||
use constant FILE_WILDCARDS => {
|
||||
known => 'Known files (*.stl, *.obj, *.amf, *.xml, *.3mf, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML;*.3mf;*.3MF;*.prusa;*.PRUSA',
|
||||
known => 'Known files (*.stl, *.obj, *.amf, *.xml, *.3mf, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.zip.amf;*.amf;*.AMF;*.xml;*.XML;*.3mf;*.3MF;*.prusa;*.PRUSA',
|
||||
stl => 'STL files (*.stl)|*.stl;*.STL',
|
||||
obj => 'OBJ files (*.obj)|*.obj;*.OBJ',
|
||||
amf => 'AMF files (*.amf)|*.amf;*.AMF;*.xml;*.XML',
|
||||
amf => 'AMF files (*.amf)|*.zip.amf;*.amf;*.AMF;*.xml;*.XML',
|
||||
threemf => '3MF files (*.3mf)|*.3mf;*.3MF',
|
||||
prusa => 'Prusa Control files (*.prusa)|*.prusa;*.PRUSA',
|
||||
ini => 'INI files *.ini|*.ini;*.INI',
|
||||
|
|
|
@ -1172,18 +1172,17 @@ sub Render {
|
|||
glLightfv_p(GL_LIGHT1, GL_POSITION, 1, 0, 1, 0);
|
||||
|
||||
if ($self->enable_picking) {
|
||||
# Render the object for picking.
|
||||
# FIXME This cannot possibly work in a multi-sampled context as the color gets mangled by the anti-aliasing.
|
||||
# Better to use software ray-casting on a bounding-box hierarchy.
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glDisable(GL_MULTISAMPLE) if ($self->{can_multisample});
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_BLEND);
|
||||
$self->draw_volumes(1);
|
||||
glFlush();
|
||||
glFinish();
|
||||
|
||||
if (my $pos = $self->_mouse_pos) {
|
||||
# Render the object for picking.
|
||||
# FIXME This cannot possibly work in a multi-sampled context as the color gets mangled by the anti-aliasing.
|
||||
# Better to use software ray-casting on a bounding-box hierarchy.
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glDisable(GL_MULTISAMPLE) if ($self->{can_multisample});
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_BLEND);
|
||||
$self->draw_volumes(1);
|
||||
glPopAttrib();
|
||||
glFlush();
|
||||
my $col = [ glReadPixels_p($pos->x, $self->GetSize->GetHeight - $pos->y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE) ];
|
||||
my $volume_idx = $col->[0] + $col->[1]*256 + $col->[2]*256*256;
|
||||
$self->_hover_volume_idx(undef);
|
||||
|
@ -1199,11 +1198,8 @@ sub Render {
|
|||
|
||||
$self->on_hover->($volume_idx) if $self->on_hover;
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glFlush();
|
||||
glFinish();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
# draw fixed background
|
||||
|
@ -1337,9 +1333,6 @@ sub Render {
|
|||
$self->draw_active_object_annotations;
|
||||
|
||||
$self->SwapBuffers();
|
||||
|
||||
# Calling glFinish has a performance penalty, but it seems to fix some OpenGL driver hang-up with extremely large scenes.
|
||||
# glFinish();
|
||||
}
|
||||
|
||||
sub draw_volumes {
|
||||
|
|
|
@ -1616,23 +1616,32 @@ sub export_3mf {
|
|||
sub _get_export_file {
|
||||
my ($self, $format) = @_;
|
||||
my $suffix = '';
|
||||
my $wildcard = 'known';
|
||||
if ($format eq 'STL')
|
||||
{
|
||||
$suffix = '.stl';
|
||||
$wildcard = 'stl';
|
||||
}
|
||||
elsif ($format eq 'AMF')
|
||||
{
|
||||
$suffix = '.zip.amf';
|
||||
if (&Wx::wxMAC) {
|
||||
# It seems that MacOS does not like double extension
|
||||
$suffix = '.amf';
|
||||
} else {
|
||||
$suffix = '.zip.amf';
|
||||
}
|
||||
$wildcard = 'amf';
|
||||
}
|
||||
elsif ($format eq '3MF')
|
||||
{
|
||||
$suffix = '.3mf';
|
||||
$wildcard = 'threemf';
|
||||
}
|
||||
my $output_file = eval { $self->{print}->output_filepath($main::opt{output} // '') };
|
||||
Slic3r::GUI::catch_error($self) and return undef;
|
||||
$output_file =~ s/\.[gG][cC][oO][dD][eE]$/$suffix/;
|
||||
my $dlg = Wx::FileDialog->new($self, "Save $format file as:", dirname($output_file),
|
||||
basename($output_file), &Slic3r::GUI::MODEL_WILDCARD, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
basename($output_file), &Slic3r::GUI::FILE_WILDCARDS->{$wildcard}, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if ($dlg->ShowModal != wxID_OK) {
|
||||
$dlg->Destroy;
|
||||
return undef;
|
||||
|
|
|
@ -338,7 +338,6 @@ sub Render {
|
|||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (!$self->GetParent->enabled || !$self->layers) {
|
||||
glFlush();
|
||||
$self->SwapBuffers;
|
||||
return;
|
||||
}
|
||||
|
@ -486,7 +485,6 @@ sub Render {
|
|||
}
|
||||
|
||||
gluDeleteTess($tess) if $tess;
|
||||
glFlush();
|
||||
$self->SwapBuffers;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue