Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/et_canvas_manager'
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoturri1966 committed Mar 25, 2020
2 parents faf8df7 + dd34aef commit a8f6f29
Show file tree
Hide file tree
Showing 23 changed files with 821 additions and 45 deletions.
2 changes: 2 additions & 0 deletions src/PrusaSlicer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,10 @@ int CLI::run(int argc, char **argv)
gui->mainframe->load_config(m_extra_config);
});
int result = wxEntry(argc, argv);
#if !ENABLE_NON_STATIC_CANVAS_MANAGER
//FIXME this is a workaround for the PrusaSlicer 2.1 release.
_3DScene::destroy();
#endif // !ENABLE_NON_STATIC_CANVAS_MANAGER
return result;
#else /* SLIC3R_GUI */
// No GUI support. Just print out a help.
Expand Down
9 changes: 9 additions & 0 deletions src/libslic3r/Technologies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,13 @@
#define ENABLE_GIZMO_TOOLBAR_DRAGGING_FIX (1 && ENABLE_2_2_0_FINAL)


//===================
// 2.3.0.alpha1 techs
//===================
#define ENABLE_2_3_0_ALPHA1 1

// Moves GLCanvas3DManager from being a static member of _3DScene to be a normal member of GUI_App
#define ENABLE_NON_STATIC_CANVAS_MANAGER (1 && ENABLE_2_3_0_ALPHA1)


#endif // _prusaslicer_technologies_h_
4 changes: 4 additions & 0 deletions src/slic3r/GUI/3DScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,9 @@ void _3DScene::point3_to_verts(const Vec3crd& point, double width, double height
thick_point_to_verts(point, width, height, volume);
}

#if !ENABLE_NON_STATIC_CANVAS_MANAGER
GUI::GLCanvas3DManager _3DScene::s_canvas_mgr;
#endif // !ENABLE_NON_STATIC_CANVAS_MANAGER

GLModel::GLModel()
: m_filename("")
Expand Down Expand Up @@ -2099,6 +2101,7 @@ bool GLBed::on_init_from_file(const std::string& filename)
return true;
}

#if !ENABLE_NON_STATIC_CANVAS_MANAGER
std::string _3DScene::get_gl_info(bool format_as_html, bool extensions)
{
return Slic3r::GUI::GLCanvas3DManager::get_gl_info().to_string(format_as_html, extensions);
Expand Down Expand Up @@ -2133,5 +2136,6 @@ GUI::GLCanvas3D* _3DScene::get_canvas(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_canvas(canvas);
}
#endif // !ENABLE_NON_STATIC_CANVAS_MANAGER

} // namespace Slic3r
10 changes: 10 additions & 0 deletions src/slic3r/GUI/3DScene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Model.hpp"
#if !ENABLE_NON_STATIC_CANVAS_MANAGER
#include "slic3r/GUI/GLCanvas3DManager.hpp"
#endif // !ENABLE_NON_STATIC_CANVAS_MANAGER

#include <functional>

Expand Down Expand Up @@ -639,10 +641,17 @@ class GLBed : public GLModel
bool on_init_from_file(const std::string& filename) override;
};

#if ENABLE_NON_STATIC_CANVAS_MANAGER
struct _3DScene
#else
class _3DScene
#endif // ENABLE_NON_STATIC_CANVAS_MANAGER
{
#if !ENABLE_NON_STATIC_CANVAS_MANAGER
static GUI::GLCanvas3DManager s_canvas_mgr;
#endif // !ENABLE_NON_STATIC_CANVAS_MANAGER

#if !ENABLE_NON_STATIC_CANVAS_MANAGER
public:
static std::string get_gl_info(bool format_as_html, bool extensions);

Expand All @@ -654,6 +663,7 @@ class _3DScene
static void destroy();

static GUI::GLCanvas3D* get_canvas(wxGLCanvas* canvas);
#endif // !ENABLE_NON_STATIC_CANVAS_MANAGER

static void thick_lines_to_verts(const Lines& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, double top_z, GLVolume& volume);
static void thick_lines_to_verts(const Lines3& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, GLVolume& volume);
Expand Down
Loading

0 comments on commit a8f6f29

Please sign in to comment.