mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue