Common gizmos data are now handled by the CommonGizmosDataPool object

This commit is contained in:
Lukas Matena 2020-04-02 17:07:15 +02:00
parent 7c4071c541
commit 3b06332999
6 changed files with 19 additions and 9 deletions

View File

@ -60,7 +60,7 @@ public:
boost::trim_all(key_trimmed);
assert(key_trimmed == key);
assert(! key_trimmed.empty());
#endif _NDEBUG
#endif // _NDEBUG
std::string &old = m_storage[section][key];
if (old != value) {
old = value;

View File

@ -33,6 +33,7 @@ class ImGuiWrapper;
class GLCanvas3D;
class ClippingPlane;
enum class CommonGizmosDataID;
class CommonGizmosDataPool;
class GLGizmoBase
{
@ -102,6 +103,7 @@ protected:
ImGuiWrapper* m_imgui;
bool m_first_input_window_render;
mutable std::string m_tooltip;
CommonGizmosDataPool* m_c;
public:
GLGizmoBase(GLCanvas3D& parent,
@ -130,6 +132,7 @@ public:
bool is_activable() const { return on_is_activable(); }
bool is_selectable() const { return on_is_selectable(); }
CommonGizmosDataID get_requirements() const { return on_get_requirements(); }
void set_common_data_pool(CommonGizmosDataPool* ptr) { m_c = ptr; }
unsigned int get_sprite_id() const { return m_sprite_id; }

View File

@ -14,11 +14,11 @@ CommonGizmosDataPool::CommonGizmosDataPool(GLCanvas3D* canvas)
using namespace CommonGizmosDataObjects;
using c = CommonGizmosDataID;
m_data[c::SelectionInfo].reset( new SelectionInfo(this));
m_data[c::InstancesHider].reset( new InstancesHider(this));
m_data[c::HollowedMesh].reset( new HollowedMesh(this));
m_data[c::ClippingPlaneWrapper].reset(new ClippingPlaneWrapper(this));
m_data[c::SupportsClipper].reset( new SupportsClipper(this));
m_data[c::MeshRaycaster].reset( new Raycaster(this));
//m_data[c::InstancesHider].reset( new InstancesHider(this));
//m_data[c::HollowedMesh].reset( new HollowedMesh(this));
//m_data[c::ClippingPlaneWrapper].reset(new ClippingPlaneWrapper(this));
//m_data[c::SupportsClipper].reset( new SupportsClipper(this));
//m_data[c::MeshRaycaster].reset( new Raycaster(this));
}
void CommonGizmosDataPool::update(CommonGizmosDataID required)

View File

@ -111,7 +111,7 @@ private:
int m_active_inst = -1;
};
/*
class InstancesHider : public CommonGizmosDataBase
{
public:
@ -175,7 +175,7 @@ public:
: CommonGizmosDataBase(cgdp) {}
void update(bool required) override;
};
*/
} // namespace CommonGizmosDataObjects

View File

@ -102,11 +102,14 @@ bool GLGizmosManager::init()
//dynamic_cast<GLGizmoHollow*>(m_gizmos[Hollow].get())->set_common_data_ptr(m_common_gizmos_data.get());
//dynamic_cast<GLGizmoSlaSupports*>(m_gizmos[SlaSupports].get())->set_common_data_ptr(m_common_gizmos_data.get());
m_common_gizmos_data.reset(new CommonGizmosDataPool(&m_parent));
for (auto& gizmo : m_gizmos) {
if (! gizmo->init()) {
m_gizmos.clear();
return false;
}
gizmo->set_common_data_pool(m_common_gizmos_data.get());
}
m_current = Undefined;
@ -1335,5 +1338,6 @@ void CommonGizmosData::build_AABB_if_needed()
m_schedule_aabb_calculation = false;
}
} // namespace GUI
} // namespace Slic3r

View File

@ -5,6 +5,7 @@
#include "slic3r/GUI/GLToolbar.hpp"
#include "libslic3r/ObjectID.hpp"
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
#include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp"
#include <map>
@ -20,6 +21,7 @@ class GLCanvas3D;
class ClippingPlane;
enum class SLAGizmoEventType : unsigned char;
class CommonGizmosData;
class CommonGizmosDataPool;
class Rect
{
@ -115,7 +117,8 @@ private:
MouseCapture m_mouse_capture;
std::string m_tooltip;
bool m_serializing;
std::unique_ptr<CommonGizmosData> m_common_gizmos_data;
//std::unique_ptr<CommonGizmosData> m_common_gizmos_data;
std::unique_ptr<CommonGizmosDataPool> m_common_gizmos_data;
public:
explicit GLGizmosManager(GLCanvas3D& parent);