Include cleanup: do not include Model.hpp from 3DScene.hpp
This commit is contained in:
parent
f78f5c85be
commit
fb9d8b2025
9 changed files with 44 additions and 35 deletions
|
@ -1383,8 +1383,8 @@ unsigned int ModelObject::check_instances_print_volume_state(const BoundingBoxf3
|
||||||
inside_outside |= OUTSIDE;
|
inside_outside |= OUTSIDE;
|
||||||
}
|
}
|
||||||
model_instance->print_volume_state =
|
model_instance->print_volume_state =
|
||||||
(inside_outside == (INSIDE | OUTSIDE)) ? ModelInstance::PVS_Partly_Outside :
|
(inside_outside == (INSIDE | OUTSIDE)) ? ModelInstancePVS_Partly_Outside :
|
||||||
(inside_outside == INSIDE) ? ModelInstance::PVS_Inside : ModelInstance::PVS_Fully_Outside;
|
(inside_outside == INSIDE) ? ModelInstancePVS_Inside : ModelInstancePVS_Fully_Outside;
|
||||||
if (inside_outside == INSIDE)
|
if (inside_outside == INSIDE)
|
||||||
++ num_printable;
|
++ num_printable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "libslic3r.h"
|
#include "libslic3r.h"
|
||||||
#include "Geometry.hpp"
|
#include "Geometry.hpp"
|
||||||
#include "Layer.hpp"
|
|
||||||
#include "ObjectID.hpp"
|
#include "ObjectID.hpp"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "PrintConfig.hpp"
|
#include "PrintConfig.hpp"
|
||||||
|
@ -641,25 +640,26 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum ModelInstanceEPrintVolumeState : unsigned char
|
||||||
|
{
|
||||||
|
ModelInstancePVS_Inside,
|
||||||
|
ModelInstancePVS_Partly_Outside,
|
||||||
|
ModelInstancePVS_Fully_Outside,
|
||||||
|
ModelInstanceNum_BedStates
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// A single instance of a ModelObject.
|
// A single instance of a ModelObject.
|
||||||
// Knows the affine transformation of an object.
|
// Knows the affine transformation of an object.
|
||||||
class ModelInstance final : public ObjectBase
|
class ModelInstance final : public ObjectBase
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
enum EPrintVolumeState : unsigned char
|
|
||||||
{
|
|
||||||
PVS_Inside,
|
|
||||||
PVS_Partly_Outside,
|
|
||||||
PVS_Fully_Outside,
|
|
||||||
Num_BedStates
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Geometry::Transformation m_transformation;
|
Geometry::Transformation m_transformation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// flag showing the position of this instance with respect to the print volume (set by Print::validate() using ModelObject::check_instances_print_volume_state())
|
// flag showing the position of this instance with respect to the print volume (set by Print::validate() using ModelObject::check_instances_print_volume_state())
|
||||||
EPrintVolumeState print_volume_state;
|
ModelInstanceEPrintVolumeState print_volume_state;
|
||||||
// Whether or not this instance is printable
|
// Whether or not this instance is printable
|
||||||
bool printable;
|
bool printable;
|
||||||
|
|
||||||
|
@ -706,7 +706,7 @@ public:
|
||||||
|
|
||||||
const Transform3d& get_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.get_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
|
const Transform3d& get_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.get_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
|
||||||
|
|
||||||
bool is_printable() const { return object->printable && printable && (print_volume_state == PVS_Inside); }
|
bool is_printable() const { return object->printable && printable && (print_volume_state == ModelInstancePVS_Inside); }
|
||||||
|
|
||||||
// Getting the input polygon for arrange
|
// Getting the input polygon for arrange
|
||||||
arrangement::ArrangePolygon get_arrange_polygon() const;
|
arrangement::ArrangePolygon get_arrange_polygon() const;
|
||||||
|
@ -735,10 +735,10 @@ private:
|
||||||
ModelObject* object;
|
ModelObject* object;
|
||||||
|
|
||||||
// Constructor, which assigns a new unique ID.
|
// Constructor, which assigns a new unique ID.
|
||||||
explicit ModelInstance(ModelObject* object) : print_volume_state(PVS_Inside), printable(true), object(object) { assert(this->id().valid()); }
|
explicit ModelInstance(ModelObject* object) : print_volume_state(ModelInstancePVS_Inside), printable(true), object(object) { assert(this->id().valid()); }
|
||||||
// Constructor, which assigns a new unique ID.
|
// Constructor, which assigns a new unique ID.
|
||||||
explicit ModelInstance(ModelObject *object, const ModelInstance &other) :
|
explicit ModelInstance(ModelObject *object, const ModelInstance &other) :
|
||||||
m_transformation(other.m_transformation), print_volume_state(PVS_Inside), printable(other.printable), object(object) { assert(this->id().valid() && this->id() != other.id()); }
|
m_transformation(other.m_transformation), print_volume_state(ModelInstancePVS_Inside), printable(other.printable), object(object) { assert(this->id().valid() && this->id() != other.id()); }
|
||||||
|
|
||||||
explicit ModelInstance(ModelInstance &&rhs) = delete;
|
explicit ModelInstance(ModelInstance &&rhs) = delete;
|
||||||
ModelInstance& operator=(const ModelInstance &rhs) = delete;
|
ModelInstance& operator=(const ModelInstance &rhs) = delete;
|
||||||
|
@ -753,6 +753,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ModelWipeTower final : public ObjectBase
|
class ModelWipeTower final : public ObjectBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -724,7 +724,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||||
glsafe(::glDisable(GL_BLEND));
|
glsafe(::glDisable(GL_BLEND));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, ModelInstance::EPrintVolumeState* out_state)
|
bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, ModelInstanceEPrintVolumeState* out_state)
|
||||||
{
|
{
|
||||||
if (config == nullptr)
|
if (config == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
@ -738,7 +738,7 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
||||||
// Allow the objects to protrude below the print bed
|
// Allow the objects to protrude below the print bed
|
||||||
print_volume.min(2) = -1e10;
|
print_volume.min(2) = -1e10;
|
||||||
|
|
||||||
ModelInstance::EPrintVolumeState state = ModelInstance::PVS_Inside;
|
ModelInstanceEPrintVolumeState state = ModelInstancePVS_Inside;
|
||||||
|
|
||||||
bool contained_min_one = false;
|
bool contained_min_one = false;
|
||||||
|
|
||||||
|
@ -757,11 +757,11 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
||||||
if (contained)
|
if (contained)
|
||||||
contained_min_one = true;
|
contained_min_one = true;
|
||||||
|
|
||||||
if ((state == ModelInstance::PVS_Inside) && volume->is_outside)
|
if ((state == ModelInstancePVS_Inside) && volume->is_outside)
|
||||||
state = ModelInstance::PVS_Fully_Outside;
|
state = ModelInstancePVS_Fully_Outside;
|
||||||
|
|
||||||
if ((state == ModelInstance::PVS_Fully_Outside) && volume->is_outside && print_volume.intersects(bb))
|
if ((state == ModelInstancePVS_Fully_Outside) && volume->is_outside && print_volume.intersects(bb))
|
||||||
state = ModelInstance::PVS_Partly_Outside;
|
state = ModelInstancePVS_Partly_Outside;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out_state != nullptr)
|
if (out_state != nullptr)
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
#include "libslic3r/Line.hpp"
|
#include "libslic3r/Line.hpp"
|
||||||
#include "libslic3r/TriangleMesh.hpp"
|
#include "libslic3r/TriangleMesh.hpp"
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
//#include "libslic3r/Model.hpp"
|
||||||
|
#include "libslic3r/Geometry.hpp"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
@ -40,6 +41,9 @@ class ExtrusionMultiPath;
|
||||||
class ExtrusionLoop;
|
class ExtrusionLoop;
|
||||||
class ExtrusionEntity;
|
class ExtrusionEntity;
|
||||||
class ExtrusionEntityCollection;
|
class ExtrusionEntityCollection;
|
||||||
|
class ModelObject;
|
||||||
|
class ModelVolume;
|
||||||
|
enum ModelInstanceEPrintVolumeState : unsigned char;
|
||||||
|
|
||||||
// A container for interleaved arrays of 3D vertices and normals,
|
// A container for interleaved arrays of 3D vertices and normals,
|
||||||
// possibly indexed by triangles and / or quads.
|
// possibly indexed by triangles and / or quads.
|
||||||
|
@ -578,7 +582,7 @@ public:
|
||||||
|
|
||||||
// returns true if all the volumes are completely contained in the print volume
|
// returns true if all the volumes are completely contained in the print volume
|
||||||
// returns the containment state in the given out_state, if non-null
|
// returns the containment state in the given out_state, if non-null
|
||||||
bool check_outside_state(const DynamicPrintConfig* config, ModelInstance::EPrintVolumeState* out_state);
|
bool check_outside_state(const DynamicPrintConfig* config, ModelInstanceEPrintVolumeState* out_state);
|
||||||
void reset_outside_state();
|
void reset_outside_state();
|
||||||
|
|
||||||
void update_colors_by_extruder(const DynamicPrintConfig* config);
|
void update_colors_by_extruder(const DynamicPrintConfig* config);
|
||||||
|
|
|
@ -1694,7 +1694,7 @@ void GLCanvas3D::reset_volumes()
|
||||||
|
|
||||||
int GLCanvas3D::check_volumes_outside_state() const
|
int GLCanvas3D::check_volumes_outside_state() const
|
||||||
{
|
{
|
||||||
ModelInstance::EPrintVolumeState state;
|
ModelInstanceEPrintVolumeState state;
|
||||||
m_volumes.check_outside_state(m_config, &state);
|
m_volumes.check_outside_state(m_config, &state);
|
||||||
return (int)state;
|
return (int)state;
|
||||||
}
|
}
|
||||||
|
@ -2578,15 +2578,15 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||||
// checks for geometry outside the print volume to render it accordingly
|
// checks for geometry outside the print volume to render it accordingly
|
||||||
if (!m_volumes.empty())
|
if (!m_volumes.empty())
|
||||||
{
|
{
|
||||||
ModelInstance::EPrintVolumeState state;
|
ModelInstanceEPrintVolumeState state;
|
||||||
|
|
||||||
const bool contained_min_one = m_volumes.check_outside_state(m_config, &state);
|
const bool contained_min_one = m_volumes.check_outside_state(m_config, &state);
|
||||||
|
|
||||||
_set_warning_texture(WarningTexture::ObjectClashed, state == ModelInstance::PVS_Partly_Outside);
|
_set_warning_texture(WarningTexture::ObjectClashed, state == ModelInstancePVS_Partly_Outside);
|
||||||
_set_warning_texture(WarningTexture::ObjectOutside, state == ModelInstance::PVS_Fully_Outside);
|
_set_warning_texture(WarningTexture::ObjectOutside, state == ModelInstancePVS_Fully_Outside);
|
||||||
|
|
||||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
|
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
|
||||||
contained_min_one && !m_model->objects.empty() && state != ModelInstance::PVS_Partly_Outside));
|
contained_min_one && !m_model->objects.empty() && state != ModelInstancePVS_Partly_Outside));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "GLSelectionRectangle.hpp"
|
#include "GLSelectionRectangle.hpp"
|
||||||
#include "MeshUtils.hpp"
|
#include "MeshUtils.hpp"
|
||||||
|
|
||||||
|
#include "libslic3r/Slicing.hpp"
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
|
@ -33,13 +35,13 @@ class wxGLContext;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class Bed3D;
|
|
||||||
struct Camera;
|
struct Camera;
|
||||||
class BackgroundSlicingProcess;
|
class BackgroundSlicingProcess;
|
||||||
class GCodePreviewData;
|
class GCodePreviewData;
|
||||||
struct ThumbnailData;
|
struct ThumbnailData;
|
||||||
struct SlicingParameters;
|
class ModelObject;
|
||||||
enum LayerHeightEditActionType : unsigned int;
|
class ModelInstance;
|
||||||
|
class PrintObject;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
#include "libslic3r/Point.hpp"
|
#include "libslic3r/Point.hpp"
|
||||||
|
#include "libslic3r/CustomGCode.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "libslic3r/Model.hpp"
|
|
||||||
|
|
||||||
class wxNotebook;
|
class wxNotebook;
|
||||||
class wxGLCanvas;
|
class wxGLCanvas;
|
||||||
|
|
|
@ -2626,7 +2626,7 @@ void Plater::priv::object_list_changed()
|
||||||
{
|
{
|
||||||
const bool export_in_progress = this->background_process.is_export_scheduled(); // || ! send_gcode_file.empty());
|
const bool export_in_progress = this->background_process.is_export_scheduled(); // || ! send_gcode_file.empty());
|
||||||
// XXX: is this right?
|
// XXX: is this right?
|
||||||
const bool model_fits = view3D->check_volumes_outside_state() == ModelInstance::PVS_Inside;
|
const bool model_fits = view3D->check_volumes_outside_state() == ModelInstancePVS_Inside;
|
||||||
|
|
||||||
sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits);
|
sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits);
|
||||||
}
|
}
|
||||||
|
@ -3318,7 +3318,7 @@ void Plater::priv::set_current_panel(wxPanel* panel)
|
||||||
// see: Plater::priv::object_list_changed()
|
// see: Plater::priv::object_list_changed()
|
||||||
// FIXME: it may be better to have a single function making this check and let it be called wherever needed
|
// FIXME: it may be better to have a single function making this check and let it be called wherever needed
|
||||||
bool export_in_progress = this->background_process.is_export_scheduled();
|
bool export_in_progress = this->background_process.is_export_scheduled();
|
||||||
bool model_fits = view3D->check_volumes_outside_state() != ModelInstance::PVS_Partly_Outside;
|
bool model_fits = view3D->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside;
|
||||||
if (!model.objects.empty() && !export_in_progress && model_fits)
|
if (!model.objects.empty() && !export_in_progress && model_fits)
|
||||||
this->q->reslice();
|
this->q->reslice();
|
||||||
// keeps current gcode preview, if any
|
// keeps current gcode preview, if any
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "libslic3r/Geometry.hpp"
|
#include "libslic3r/Geometry.hpp"
|
||||||
|
#include "libslic3r/Model.hpp"
|
||||||
#include "3DScene.hpp"
|
#include "3DScene.hpp"
|
||||||
|
|
||||||
|
|
||||||
#if ENABLE_RENDER_SELECTION_CENTER
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
class GLUquadric;
|
class GLUquadric;
|
||||||
typedef class GLUquadric GLUquadricObj;
|
typedef class GLUquadric GLUquadricObj;
|
||||||
|
|
Loading…
Reference in a new issue