3DScene set_viewport_from_scene method moved to c++

This commit is contained in:
Enrico Turri 2018-05-29 15:36:09 +02:00
parent df14a3c399
commit 2f773a89df
9 changed files with 135 additions and 119 deletions

View file

@ -2105,6 +2105,11 @@ void _3DScene::select_view(wxGLCanvas* canvas, const std::string& direction)
s_canvas_mgr.select_view(canvas, direction);
}
void _3DScene::set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other)
{
s_canvas_mgr.set_viewport_from_scene(canvas, other);
}
void _3DScene::update_volumes_colors_by_extruder(wxGLCanvas* canvas)
{
s_canvas_mgr.update_volumes_colors_by_extruder(canvas);

View file

@ -644,6 +644,7 @@ public:
static void zoom_to_bed(wxGLCanvas* canvas);
static void zoom_to_volumes(wxGLCanvas* canvas);
static void select_view(wxGLCanvas* canvas, const std::string& direction);
static void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
static void update_volumes_colors_by_extruder(wxGLCanvas* canvas);

View file

@ -1520,6 +1520,15 @@ void GLCanvas3D::select_view(const std::string& direction)
}
}
void GLCanvas3D::set_viewport_from_scene(const GLCanvas3D& other)
{
set_camera_phi(other.get_camera_phi());
set_camera_theta(other.get_camera_theta());
set_camera_target(other.get_camera_target());
set_camera_zoom(other.get_camera_zoom());
set_dirty(true);
}
void GLCanvas3D::update_volumes_colors_by_extruder()
{
if ((m_volumes == nullptr) || (m_config == nullptr))

View file

@ -427,6 +427,7 @@ public:
void zoom_to_bed();
void zoom_to_volumes();
void select_view(const std::string& direction);
void set_viewport_from_scene(const GLCanvas3D& other);
void update_volumes_colors_by_extruder();

View file

@ -597,6 +597,17 @@ void GLCanvas3DManager::select_view(wxGLCanvas* canvas, const std::string& direc
it->second->select_view(direction);
}
void GLCanvas3DManager::set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
{
CanvasesMap::iterator other_it = _get_canvas(other);
if (other_it != m_canvases.end())
it->second->set_viewport_from_scene(*other_it->second);
}
}
void GLCanvas3DManager::update_volumes_colors_by_extruder(wxGLCanvas* canvas)
{
CanvasesMap::const_iterator it = _get_canvas(canvas);

View file

@ -144,6 +144,7 @@ public:
void zoom_to_bed(wxGLCanvas* canvas);
void zoom_to_volumes(wxGLCanvas* canvas);
void select_view(wxGLCanvas* canvas, const std::string& direction);
void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
void update_volumes_colors_by_extruder(wxGLCanvas* canvas);