mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
Removed 3DScene volumes from perl
This commit is contained in:
parent
efe6a29032
commit
085110c4d9
11 changed files with 160 additions and 44 deletions
|
@ -1802,9 +1802,9 @@ bool _3DScene::is_shown_on_screen(wxGLCanvas* canvas)
|
|||
return s_canvas_mgr.is_shown_on_screen(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes)
|
||||
unsigned int _3DScene::get_volumes_count(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.set_volumes(canvas, volumes);
|
||||
return s_canvas_mgr.get_volumes_count(canvas);
|
||||
}
|
||||
|
||||
void _3DScene::reset_volumes(wxGLCanvas* canvas)
|
||||
|
@ -1827,6 +1827,21 @@ void _3DScene::update_volumes_selection(wxGLCanvas* canvas, const std::vector<in
|
|||
s_canvas_mgr.update_volumes_selection(canvas, selections);
|
||||
}
|
||||
|
||||
bool _3DScene::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config)
|
||||
{
|
||||
return s_canvas_mgr.check_volumes_outside_state(canvas, config);
|
||||
}
|
||||
|
||||
bool _3DScene::move_volume_up(wxGLCanvas* canvas, unsigned int id)
|
||||
{
|
||||
return s_canvas_mgr.move_volume_up(canvas, id);
|
||||
}
|
||||
|
||||
bool _3DScene::move_volume_down(wxGLCanvas* canvas, unsigned int id)
|
||||
{
|
||||
return s_canvas_mgr.move_volume_down(canvas, id);
|
||||
}
|
||||
|
||||
void _3DScene::set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections)
|
||||
{
|
||||
s_canvas_mgr.set_objects_selections(canvas, selections);
|
||||
|
|
|
@ -558,11 +558,14 @@ public:
|
|||
|
||||
static bool is_shown_on_screen(wxGLCanvas* canvas);
|
||||
|
||||
static void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
||||
static unsigned int get_volumes_count(wxGLCanvas* canvas);
|
||||
static void reset_volumes(wxGLCanvas* canvas);
|
||||
static void deselect_volumes(wxGLCanvas* canvas);
|
||||
static void select_volume(wxGLCanvas* canvas, unsigned int id);
|
||||
static void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections);
|
||||
static bool check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config);
|
||||
static bool move_volume_up(wxGLCanvas* canvas, unsigned int id);
|
||||
static bool move_volume_down(wxGLCanvas* canvas, unsigned int id);
|
||||
|
||||
static void set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections);
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
#include <iostream>
|
||||
#include <float.h>
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#include "SVG.hpp"
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
static const float TRACKBALLSIZE = 0.8f;
|
||||
static const float GIMBALL_LOCK_THETA_MAX = 180.0f;
|
||||
static const float GROUND_Z = -0.02f;
|
||||
|
@ -661,7 +657,6 @@ bool GLCanvas3D::Bed::_are_equal(const Pointfs& bed_1, const Pointfs& bed_2)
|
|||
|
||||
return true;
|
||||
}
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
GLCanvas3D::Axes::Axes()
|
||||
: length(0.0f)
|
||||
|
@ -1212,15 +1207,18 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
|||
, m_reload_delayed(false)
|
||||
{
|
||||
if (m_canvas != nullptr)
|
||||
{
|
||||
m_timer = new wxTimer(m_canvas);
|
||||
m_volumes = new GLVolumeCollection;
|
||||
}
|
||||
}
|
||||
|
||||
GLCanvas3D::~GLCanvas3D()
|
||||
{
|
||||
if (m_volumes != nullptr)
|
||||
{
|
||||
set_current();
|
||||
m_volumes->release_geometry();
|
||||
reset_volumes();
|
||||
delete m_volumes;
|
||||
}
|
||||
|
||||
if (m_timer != nullptr)
|
||||
|
@ -1317,9 +1315,9 @@ bool GLCanvas3D::is_shown_on_screen() const
|
|||
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_volumes(GLVolumeCollection* volumes)
|
||||
unsigned int GLCanvas3D::get_volumes_count() const
|
||||
{
|
||||
m_volumes = volumes;
|
||||
return (m_volumes != nullptr) ? (unsigned int)m_volumes->volumes.size() : 0;
|
||||
}
|
||||
|
||||
void GLCanvas3D::reset_volumes()
|
||||
|
@ -1372,6 +1370,45 @@ void GLCanvas3D::update_volumes_selection(const std::vector<int>& selections)
|
|||
}
|
||||
}
|
||||
|
||||
bool GLCanvas3D::check_volumes_outside_state(const DynamicPrintConfig* config) const
|
||||
{
|
||||
return (m_volumes != nullptr) ? m_volumes->check_outside_state(config) : false;
|
||||
}
|
||||
|
||||
bool GLCanvas3D::move_volume_up(unsigned int id)
|
||||
{
|
||||
if (m_volumes != nullptr)
|
||||
{
|
||||
if ((id > 0) && (id < (unsigned int)m_volumes->volumes.size()))
|
||||
{
|
||||
std::swap(m_volumes->volumes[id - 1], m_volumes->volumes[id]);
|
||||
std::swap(m_volumes->volumes[id - 1]->composite_id, m_volumes->volumes[id]->composite_id);
|
||||
std::swap(m_volumes->volumes[id - 1]->select_group_id, m_volumes->volumes[id]->select_group_id);
|
||||
std::swap(m_volumes->volumes[id - 1]->drag_group_id, m_volumes->volumes[id]->drag_group_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLCanvas3D::move_volume_down(unsigned int id)
|
||||
{
|
||||
if (m_volumes != nullptr)
|
||||
{
|
||||
if ((id >= 0) && (id + 1 < (unsigned int)m_volumes->volumes.size()))
|
||||
{
|
||||
std::swap(m_volumes->volumes[id + 1], m_volumes->volumes[id]);
|
||||
std::swap(m_volumes->volumes[id + 1]->composite_id, m_volumes->volumes[id]->composite_id);
|
||||
std::swap(m_volumes->volumes[id + 1]->select_group_id, m_volumes->volumes[id]->select_group_id);
|
||||
std::swap(m_volumes->volumes[id + 1]->drag_group_id, m_volumes->volumes[id]->drag_group_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GLCanvas3D::set_objects_selections(const std::vector<int>& selections)
|
||||
{
|
||||
m_objects_selections = selections;
|
||||
|
|
|
@ -419,11 +419,14 @@ public:
|
|||
|
||||
bool is_shown_on_screen() const;
|
||||
|
||||
void set_volumes(GLVolumeCollection* volumes);
|
||||
unsigned int get_volumes_count() const;
|
||||
void reset_volumes();
|
||||
void deselect_volumes();
|
||||
void select_volume(unsigned int id);
|
||||
void update_volumes_selection(const std::vector<int>& selections);
|
||||
bool check_volumes_outside_state(const DynamicPrintConfig* config) const;
|
||||
bool move_volume_up(unsigned int id);
|
||||
bool move_volume_down(unsigned int id);
|
||||
|
||||
void set_objects_selections(const std::vector<int>& selections);
|
||||
|
||||
|
|
|
@ -226,11 +226,10 @@ bool GLCanvas3DManager::is_shown_on_screen(wxGLCanvas* canvas) const
|
|||
return (it != m_canvases.end()) ? it->second->is_shown_on_screen() : false;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes)
|
||||
unsigned int GLCanvas3DManager::get_volumes_count(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_volumes(volumes);
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->get_volumes_count() : 0;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas)
|
||||
|
@ -261,6 +260,24 @@ void GLCanvas3DManager::update_volumes_selection(wxGLCanvas* canvas, const std::
|
|||
it->second->update_volumes_selection(selections);
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->check_volumes_outside_state(config) : false;
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::move_volume_up(wxGLCanvas* canvas, unsigned int id)
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->move_volume_up(id) : false;
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::move_volume_down(wxGLCanvas* canvas, unsigned int id)
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->move_volume_down(id) : false;
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
|
|
|
@ -53,11 +53,14 @@ public:
|
|||
|
||||
bool is_shown_on_screen(wxGLCanvas* canvas) const;
|
||||
|
||||
void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
||||
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
|
||||
void reset_volumes(wxGLCanvas* canvas);
|
||||
void deselect_volumes(wxGLCanvas* canvas);
|
||||
void select_volume(wxGLCanvas* canvas, unsigned int id);
|
||||
void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections);
|
||||
bool check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const;
|
||||
bool move_volume_up(wxGLCanvas* canvas, unsigned int id);
|
||||
bool move_volume_down(wxGLCanvas* canvas, unsigned int id);
|
||||
|
||||
void set_objects_selections(wxGLCanvas* canvas, const std::vector<int>& selections);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue