Include cleanup: Selection.hpp
It does not need 3DScene.hpp and Model.hpp And it does not to be included by GLGizmoBase.hpp
This commit is contained in:
parent
c2cd430941
commit
94b0ab603f
18 changed files with 117 additions and 33 deletions
|
@ -42,6 +42,9 @@ struct ThumbnailData;
|
|||
class ModelObject;
|
||||
class ModelInstance;
|
||||
class PrintObject;
|
||||
class Print;
|
||||
class SLAPrint;
|
||||
namespace CustomGCode { struct Item; }
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -4,14 +4,9 @@
|
|||
#include <GL/glew.h>
|
||||
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
|
||||
|
||||
|
||||
// TODO: Display tooltips quicker on Linux
|
||||
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "libslic3r/Point.hpp"
|
||||
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/Selection.hpp"
|
||||
|
||||
#include <cereal/archives/binary.hpp>
|
||||
|
||||
|
@ -31,9 +30,9 @@ static const float CONSTRAINED_COLOR[4] = { 0.5f, 0.5f, 0.5f, 1.0f };
|
|||
|
||||
class ImGuiWrapper;
|
||||
class GLCanvas3D;
|
||||
class ClippingPlane;
|
||||
enum class CommonGizmosDataID;
|
||||
class CommonGizmosDataPool;
|
||||
class Selection;
|
||||
|
||||
class GLGizmoBase
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "slic3r/GUI/3DScene.hpp"
|
||||
|
||||
#include "libslic3r/ObjectID.hpp"
|
||||
|
||||
#include <cereal/types/vector.hpp>
|
||||
|
||||
|
||||
|
@ -15,6 +17,7 @@ enum class FacetSupportType : int8_t;
|
|||
namespace GUI {
|
||||
|
||||
enum class SLAGizmoEventType : unsigned char;
|
||||
class ClippingPlane;
|
||||
|
||||
class GLGizmoFdmSupports : public GLGizmoBase
|
||||
{
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
#define slic3r_GLGizmoFlatten_hpp_
|
||||
|
||||
#include "GLGizmoBase.hpp"
|
||||
#include "slic3r/GUI/3DScene.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
enum class ModelVolumeType : int;
|
||||
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "slic3r/GUI/Plater.hpp"
|
||||
#include "slic3r/GUI/PresetBundle.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
|
|
@ -5,12 +5,17 @@
|
|||
#include "slic3r/GUI/GLSelectionRectangle.hpp"
|
||||
|
||||
#include <libslic3r/SLA/Hollowing.hpp>
|
||||
#include <libslic3r/ObjectID.hpp>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include <cereal/types/vector.hpp>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class ConfigOption;
|
||||
class ConfigOptionDef;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
enum class SLAGizmoEventType : unsigned char;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "GLGizmoBase.hpp"
|
||||
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
|
|
@ -4,13 +4,17 @@
|
|||
#include "GLGizmoBase.hpp"
|
||||
#include "slic3r/GUI/GLSelectionRectangle.hpp"
|
||||
|
||||
#include "libslic3r/SLA/Common.hpp"
|
||||
#include "libslic3r/SLA/SupportPoint.hpp"
|
||||
#include "libslic3r/ObjectID.hpp"
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include <cereal/types/vector.hpp>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class ConfigOption;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
enum class SLAGizmoEventType : unsigned char;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "slic3r/GUI/Gizmos/GLGizmoCut.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoHollow.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp"
|
||||
|
||||
#include "libslic3r/ObjectID.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace Slic3r {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "ArrangeJob.hpp"
|
||||
|
||||
#include "libslic3r/MTUtils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include "slic3r/GUI/Plater.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "libslic3r/MTUtils.hpp"
|
||||
#include "libslic3r/SLA/Rotfinder.hpp"
|
||||
#include "libslic3r/MinAreaBoundingBox.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include "slic3r/GUI/Plater.hpp"
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "slic3r/GUI/GUI_ObjectList.hpp"
|
||||
#include "slic3r/Utils/SLAImport.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/combobox.h>
|
||||
|
|
|
@ -25,10 +25,13 @@ namespace Slic3r {
|
|||
|
||||
class Model;
|
||||
class ModelObject;
|
||||
class ModelInstance;
|
||||
class Print;
|
||||
class SLAPrint;
|
||||
enum SLAPrintObjectStep : unsigned int;
|
||||
|
||||
using ModelInstancePtrs = std::vector<ModelInstance*>;
|
||||
|
||||
namespace UndoRedo {
|
||||
class Stack;
|
||||
struct Snapshot;
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
#include "libslic3r/libslic3r.h"
|
||||
#include "Selection.hpp"
|
||||
|
||||
#include "3DScene.hpp"
|
||||
#include "GLCanvas3D.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_ObjectManipulation.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#include "Gizmos/GLGizmoBase.hpp"
|
||||
#include "3DScene.hpp"
|
||||
#include "Camera.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
@ -54,7 +56,7 @@ bool Selection::Clipboard::is_sla_compliant() const
|
|||
if (m_mode == Selection::Volume)
|
||||
return false;
|
||||
|
||||
for (const ModelObject* o : m_model.objects)
|
||||
for (const ModelObject* o : m_model->objects)
|
||||
{
|
||||
if (o->is_multiparts())
|
||||
return false;
|
||||
|
@ -69,6 +71,35 @@ bool Selection::Clipboard::is_sla_compliant() const
|
|||
return true;
|
||||
}
|
||||
|
||||
Selection::Clipboard::Clipboard()
|
||||
{
|
||||
m_model.reset(new Model);
|
||||
}
|
||||
|
||||
void Selection::Clipboard::reset() {
|
||||
m_model->clear_objects();
|
||||
}
|
||||
|
||||
bool Selection::Clipboard::is_empty() const
|
||||
{
|
||||
return m_model->objects.empty();
|
||||
}
|
||||
|
||||
ModelObject* Selection::Clipboard::add_object()
|
||||
{
|
||||
return m_model->add_object();
|
||||
}
|
||||
|
||||
ModelObject* Selection::Clipboard::get_object(unsigned int id)
|
||||
{
|
||||
return (id < (unsigned int)m_model->objects.size()) ? m_model->objects[id] : nullptr;
|
||||
}
|
||||
|
||||
const ModelObjectPtrs& Selection::Clipboard::get_objects() const
|
||||
{
|
||||
return m_model->objects;
|
||||
}
|
||||
|
||||
Selection::Selection()
|
||||
: m_volumes(nullptr)
|
||||
, m_model(nullptr)
|
||||
|
@ -76,9 +107,11 @@ Selection::Selection()
|
|||
, m_mode(Instance)
|
||||
, m_type(Empty)
|
||||
, m_valid(false)
|
||||
, m_curved_arrow(16)
|
||||
, m_scale_factor(1.0f)
|
||||
{
|
||||
m_arrow.reset(new GLArrow);
|
||||
m_curved_arrow.reset(new GLCurvedArrow(16));
|
||||
|
||||
this->set_bounding_boxes_dirty();
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
m_quadric = ::gluNewQuadric();
|
||||
|
@ -104,15 +137,15 @@ void Selection::set_volumes(GLVolumePtrs* volumes)
|
|||
// Init shall be called from the OpenGL render function, so that the OpenGL context is initialized!
|
||||
bool Selection::init()
|
||||
{
|
||||
if (!m_arrow.init())
|
||||
if (!m_arrow->init())
|
||||
return false;
|
||||
|
||||
m_arrow.set_scale(5.0 * Vec3d::Ones());
|
||||
m_arrow->set_scale(5.0 * Vec3d::Ones());
|
||||
|
||||
if (!m_curved_arrow.init())
|
||||
if (!m_curved_arrow->init())
|
||||
return false;
|
||||
|
||||
m_curved_arrow.set_scale(5.0 * Vec3d::Ones());
|
||||
m_curved_arrow->set_scale(5.0 * Vec3d::Ones());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2048,29 +2081,29 @@ void Selection::render_sidebar_layers_hints(const std::string& sidebar_field) co
|
|||
|
||||
void Selection::render_sidebar_position_hint(Axis axis) const
|
||||
{
|
||||
m_arrow.set_color(AXES_COLOR[axis], 3);
|
||||
m_arrow.render();
|
||||
m_arrow->set_color(AXES_COLOR[axis], 3);
|
||||
m_arrow->render();
|
||||
}
|
||||
|
||||
void Selection::render_sidebar_rotation_hint(Axis axis) const
|
||||
{
|
||||
m_curved_arrow.set_color(AXES_COLOR[axis], 3);
|
||||
m_curved_arrow.render();
|
||||
m_curved_arrow->set_color(AXES_COLOR[axis], 3);
|
||||
m_curved_arrow->render();
|
||||
|
||||
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
|
||||
m_curved_arrow.render();
|
||||
m_curved_arrow->render();
|
||||
}
|
||||
|
||||
void Selection::render_sidebar_scale_hint(Axis axis) const
|
||||
{
|
||||
m_arrow.set_color(((requires_uniform_scale() || wxGetApp().obj_manipul()->get_uniform_scaling()) ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis]), 3);
|
||||
m_arrow->set_color(((requires_uniform_scale() || wxGetApp().obj_manipul()->get_uniform_scaling()) ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis]), 3);
|
||||
|
||||
glsafe(::glTranslated(0.0, 5.0, 0.0));
|
||||
m_arrow.render();
|
||||
m_arrow->render();
|
||||
|
||||
glsafe(::glTranslated(0.0, -10.0, 0.0));
|
||||
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
|
||||
m_arrow.render();
|
||||
m_arrow->render();
|
||||
}
|
||||
|
||||
void Selection::render_sidebar_size_hint(Axis axis, double length) const
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include <set>
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "3DScene.hpp"
|
||||
//#include "libslic3r/Model.hpp"
|
||||
//#include "3DScene.hpp"
|
||||
|
||||
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
|
@ -13,7 +13,19 @@ typedef class GLUquadric GLUquadricObj;
|
|||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class Shader;
|
||||
class Model;
|
||||
class ModelObject;
|
||||
class GLVolume;
|
||||
class GLArrow;
|
||||
class GLCurvedArrow;
|
||||
class DynamicPrintConfig;
|
||||
|
||||
using GLVolumePtrs = std::vector<GLVolume*>;
|
||||
using ModelObjectPtrs = std::vector<ModelObject*>;
|
||||
|
||||
|
||||
namespace GUI {
|
||||
class TransformationType
|
||||
{
|
||||
|
@ -147,18 +159,23 @@ public:
|
|||
|
||||
class Clipboard
|
||||
{
|
||||
Model m_model;
|
||||
// Model is stored through a pointer to avoid including heavy Model.hpp.
|
||||
// It is created in constructor.
|
||||
std::unique_ptr<Model> m_model;
|
||||
|
||||
Selection::EMode m_mode;
|
||||
|
||||
public:
|
||||
void reset() { m_model.clear_objects(); }
|
||||
bool is_empty() const { return m_model.objects.empty(); }
|
||||
Clipboard();
|
||||
|
||||
void reset();
|
||||
bool is_empty() const;
|
||||
|
||||
bool is_sla_compliant() const;
|
||||
|
||||
ModelObject* add_object() { return m_model.add_object(); }
|
||||
ModelObject* get_object(unsigned int id) { return (id < (unsigned int)m_model.objects.size()) ? m_model.objects[id] : nullptr; }
|
||||
const ModelObjectPtrs& get_objects() const { return m_model.objects; }
|
||||
ModelObject* add_object();
|
||||
ModelObject* get_object(unsigned int id);
|
||||
const ModelObjectPtrs& get_objects() const;
|
||||
|
||||
Selection::EMode get_mode() const { return m_mode; }
|
||||
void set_mode(Selection::EMode mode) { m_mode = mode; }
|
||||
|
@ -202,8 +219,11 @@ private:
|
|||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
GLUquadricObj* m_quadric;
|
||||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
mutable GLArrow m_arrow;
|
||||
mutable GLCurvedArrow m_curved_arrow;
|
||||
|
||||
// Arrows are saved through pointers to avoid including 3DScene.hpp.
|
||||
// It also allows mutability.
|
||||
std::unique_ptr<GLArrow> m_arrow;
|
||||
std::unique_ptr<GLCurvedArrow> m_curved_arrow;
|
||||
|
||||
mutable float m_scale_factor;
|
||||
|
||||
|
|
Loading…
Reference in a new issue