Common gizmos data are now handled by the CommonGizmosDataPool object
This commit is contained in:
parent
7c4071c541
commit
3b06332999
6 changed files with 19 additions and 9 deletions
|
@ -60,7 +60,7 @@ public:
|
||||||
boost::trim_all(key_trimmed);
|
boost::trim_all(key_trimmed);
|
||||||
assert(key_trimmed == key);
|
assert(key_trimmed == key);
|
||||||
assert(! key_trimmed.empty());
|
assert(! key_trimmed.empty());
|
||||||
#endif _NDEBUG
|
#endif // _NDEBUG
|
||||||
std::string &old = m_storage[section][key];
|
std::string &old = m_storage[section][key];
|
||||||
if (old != value) {
|
if (old != value) {
|
||||||
old = value;
|
old = value;
|
||||||
|
|
|
@ -33,6 +33,7 @@ class ImGuiWrapper;
|
||||||
class GLCanvas3D;
|
class GLCanvas3D;
|
||||||
class ClippingPlane;
|
class ClippingPlane;
|
||||||
enum class CommonGizmosDataID;
|
enum class CommonGizmosDataID;
|
||||||
|
class CommonGizmosDataPool;
|
||||||
|
|
||||||
class GLGizmoBase
|
class GLGizmoBase
|
||||||
{
|
{
|
||||||
|
@ -102,6 +103,7 @@ protected:
|
||||||
ImGuiWrapper* m_imgui;
|
ImGuiWrapper* m_imgui;
|
||||||
bool m_first_input_window_render;
|
bool m_first_input_window_render;
|
||||||
mutable std::string m_tooltip;
|
mutable std::string m_tooltip;
|
||||||
|
CommonGizmosDataPool* m_c;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLGizmoBase(GLCanvas3D& parent,
|
GLGizmoBase(GLCanvas3D& parent,
|
||||||
|
@ -130,6 +132,7 @@ public:
|
||||||
bool is_activable() const { return on_is_activable(); }
|
bool is_activable() const { return on_is_activable(); }
|
||||||
bool is_selectable() const { return on_is_selectable(); }
|
bool is_selectable() const { return on_is_selectable(); }
|
||||||
CommonGizmosDataID get_requirements() const { return on_get_requirements(); }
|
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; }
|
unsigned int get_sprite_id() const { return m_sprite_id; }
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ CommonGizmosDataPool::CommonGizmosDataPool(GLCanvas3D* canvas)
|
||||||
using namespace CommonGizmosDataObjects;
|
using namespace CommonGizmosDataObjects;
|
||||||
using c = CommonGizmosDataID;
|
using c = CommonGizmosDataID;
|
||||||
m_data[c::SelectionInfo].reset( new SelectionInfo(this));
|
m_data[c::SelectionInfo].reset( new SelectionInfo(this));
|
||||||
m_data[c::InstancesHider].reset( new InstancesHider(this));
|
//m_data[c::InstancesHider].reset( new InstancesHider(this));
|
||||||
m_data[c::HollowedMesh].reset( new HollowedMesh(this));
|
//m_data[c::HollowedMesh].reset( new HollowedMesh(this));
|
||||||
m_data[c::ClippingPlaneWrapper].reset(new ClippingPlaneWrapper(this));
|
//m_data[c::ClippingPlaneWrapper].reset(new ClippingPlaneWrapper(this));
|
||||||
m_data[c::SupportsClipper].reset( new SupportsClipper(this));
|
//m_data[c::SupportsClipper].reset( new SupportsClipper(this));
|
||||||
m_data[c::MeshRaycaster].reset( new Raycaster(this));
|
//m_data[c::MeshRaycaster].reset( new Raycaster(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonGizmosDataPool::update(CommonGizmosDataID required)
|
void CommonGizmosDataPool::update(CommonGizmosDataID required)
|
||||||
|
|
|
@ -111,7 +111,7 @@ private:
|
||||||
int m_active_inst = -1;
|
int m_active_inst = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
class InstancesHider : public CommonGizmosDataBase
|
class InstancesHider : public CommonGizmosDataBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -175,7 +175,7 @@ public:
|
||||||
: CommonGizmosDataBase(cgdp) {}
|
: CommonGizmosDataBase(cgdp) {}
|
||||||
void update(bool required) override;
|
void update(bool required) override;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
} // namespace CommonGizmosDataObjects
|
} // namespace CommonGizmosDataObjects
|
||||||
|
|
||||||
|
|
|
@ -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<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());
|
//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) {
|
for (auto& gizmo : m_gizmos) {
|
||||||
if (! gizmo->init()) {
|
if (! gizmo->init()) {
|
||||||
m_gizmos.clear();
|
m_gizmos.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
gizmo->set_common_data_pool(m_common_gizmos_data.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_current = Undefined;
|
m_current = Undefined;
|
||||||
|
@ -1335,5 +1338,6 @@ void CommonGizmosData::build_AABB_if_needed()
|
||||||
m_schedule_aabb_calculation = false;
|
m_schedule_aabb_calculation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "slic3r/GUI/GLToolbar.hpp"
|
#include "slic3r/GUI/GLToolbar.hpp"
|
||||||
#include "libslic3r/ObjectID.hpp"
|
#include "libslic3r/ObjectID.hpp"
|
||||||
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
|
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
|
||||||
|
#include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ class GLCanvas3D;
|
||||||
class ClippingPlane;
|
class ClippingPlane;
|
||||||
enum class SLAGizmoEventType : unsigned char;
|
enum class SLAGizmoEventType : unsigned char;
|
||||||
class CommonGizmosData;
|
class CommonGizmosData;
|
||||||
|
class CommonGizmosDataPool;
|
||||||
|
|
||||||
class Rect
|
class Rect
|
||||||
{
|
{
|
||||||
|
@ -115,7 +117,8 @@ private:
|
||||||
MouseCapture m_mouse_capture;
|
MouseCapture m_mouse_capture;
|
||||||
std::string m_tooltip;
|
std::string m_tooltip;
|
||||||
bool m_serializing;
|
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:
|
public:
|
||||||
explicit GLGizmosManager(GLCanvas3D& parent);
|
explicit GLGizmosManager(GLCanvas3D& parent);
|
||||||
|
|
Loading…
Reference in a new issue