diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2018-05-29 16:36:09 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2018-05-29 16:36:09 +0300 |
commit | 2f773a89df2f8838bb006cf37f5e62cdff38a3b3 (patch) | |
tree | c19f552fafd7f33d0f61dd9b54f270476603c63e /xs | |
parent | df14a3c3991525ad850af4b0f5aa1c159765e9c2 (diff) |
3DScene set_viewport_from_scene method moved to c++
Diffstat (limited to 'xs')
-rw-r--r-- | xs/src/slic3r/GUI/3DScene.cpp | 5 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/3DScene.hpp | 1 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/GLCanvas3D.cpp | 9 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/GLCanvas3D.hpp | 1 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/GLCanvas3DManager.cpp | 11 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/GLCanvas3DManager.hpp | 1 | ||||
-rw-r--r-- | xs/xsp/GUI_3DScene.xsp | 7 |
7 files changed, 35 insertions, 0 deletions
diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index a7b7d6e34..80102cc50 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -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); diff --git a/xs/src/slic3r/GUI/3DScene.hpp b/xs/src/slic3r/GUI/3DScene.hpp index 69f48e092..45fdbbb41 100644 --- a/xs/src/slic3r/GUI/3DScene.hpp +++ b/xs/src/slic3r/GUI/3DScene.hpp @@ -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); diff --git a/xs/src/slic3r/GUI/GLCanvas3D.cpp b/xs/src/slic3r/GUI/GLCanvas3D.cpp index 28f105d3c..4946ae807 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.cpp @@ -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)) diff --git a/xs/src/slic3r/GUI/GLCanvas3D.hpp b/xs/src/slic3r/GUI/GLCanvas3D.hpp index 620f68858..30d219cff 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.hpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.hpp @@ -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(); diff --git a/xs/src/slic3r/GUI/GLCanvas3DManager.cpp b/xs/src/slic3r/GUI/GLCanvas3DManager.cpp index 27aaa3188..16398b6d6 100644 --- a/xs/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -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); diff --git a/xs/src/slic3r/GUI/GLCanvas3DManager.hpp b/xs/src/slic3r/GUI/GLCanvas3DManager.hpp index b3580ec63..301650990 100644 --- a/xs/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/xs/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -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); diff --git a/xs/xsp/GUI_3DScene.xsp b/xs/xsp/GUI_3DScene.xsp index 7e1e80d4c..b155c0cb0 100644 --- a/xs/xsp/GUI_3DScene.xsp +++ b/xs/xsp/GUI_3DScene.xsp @@ -718,6 +718,13 @@ select_view(canvas, direction) _3DScene::select_view((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), direction); void +set_viewport_from_scene(canvas, other) + SV *canvas; + SV *other; + CODE: + _3DScene::set_viewport_from_scene((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (wxGLCanvas*)wxPli_sv_2_object(aTHX_ other, "Wx::GLCanvas")); + +void update_volumes_colors_by_extruder(canvas) SV *canvas; CODE: |