Merge branch 'master' of https://github.com/prusa3d/Slic3r into scene_manipulators

This commit is contained in:
Enrico Turri 2018-06-25 08:26:04 +02:00
commit 92ecda5abe
8 changed files with 30 additions and 0 deletions

View File

@ -206,6 +206,8 @@ sub new {
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
$self->{preview3D}->load_print(1);
# sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
Slic3r::GUI::_3DScene::set_as_dirty($self->{preview3D}->canvas);
} else {
Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 0);
}
@ -218,6 +220,8 @@ sub new {
Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
Slic3r::GUI::_3DScene::reload_scene($self->{canvas3D}, 1);
}
# sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
Slic3r::GUI::_3DScene::set_as_dirty($self->{canvas3D});
} else {
$preview->OnActivate if $preview->can('OnActivate');
}

View File

@ -1758,6 +1758,11 @@ void _3DScene::set_active(wxGLCanvas* canvas, bool active)
s_canvas_mgr.set_active(canvas, active);
}
void _3DScene::set_as_dirty(wxGLCanvas* canvas)
{
s_canvas_mgr.set_as_dirty(canvas);
}
unsigned int _3DScene::get_volumes_count(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_volumes_count(canvas);

View File

@ -517,6 +517,7 @@ public:
static bool init(wxGLCanvas* canvas);
static void set_active(wxGLCanvas* canvas, bool active);
static void set_as_dirty(wxGLCanvas* canvas);
static unsigned int get_volumes_count(wxGLCanvas* canvas);
static void reset_volumes(wxGLCanvas* canvas);

View File

@ -1536,6 +1536,11 @@ void GLCanvas3D::set_active(bool active)
m_active = active;
}
void GLCanvas3D::set_as_dirty()
{
m_dirty = true;
}
unsigned int GLCanvas3D::get_volumes_count() const
{
return (unsigned int)m_volumes.volumes.size();

View File

@ -452,6 +452,7 @@ public:
bool set_current();
void set_active(bool active);
void set_as_dirty();
unsigned int get_volumes_count() const;
void reset_volumes();

View File

@ -219,6 +219,13 @@ void GLCanvas3DManager::set_active(wxGLCanvas* canvas, bool active)
it->second->set_active(active);
}
void GLCanvas3DManager::set_as_dirty(wxGLCanvas* canvas)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->set_as_dirty();
}
unsigned int GLCanvas3DManager::get_volumes_count(wxGLCanvas* canvas) const
{
CanvasesMap::const_iterator it = _get_canvas(canvas);

View File

@ -70,6 +70,7 @@ public:
bool init(wxGLCanvas* canvas);
void set_active(wxGLCanvas* canvas, bool active);
void set_as_dirty(wxGLCanvas* canvas);
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
void reset_volumes(wxGLCanvas* canvas);

View File

@ -197,6 +197,12 @@ set_active(canvas, active)
CODE:
_3DScene::set_active((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), active);
void
set_as_dirty(canvas)
SV *canvas;
CODE:
_3DScene::set_as_dirty((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
unsigned int
get_volumes_count(canvas)
SV *canvas;