mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-20 10:50:33 -07:00
3DScene load_object method moved to c++
This commit is contained in:
@@ -2016,6 +2016,16 @@ static inline std::vector<float> parse_colors(const std::vector<std::string> &sc
|
||||
}
|
||||
|
||||
//##################################################################################################################
|
||||
std::vector<int> _3DScene::load_object(wxGLCanvas* canvas, const ModelObject* model_object, int obj_idx, std::vector<int> instance_idxs)
|
||||
{
|
||||
return s_canvas_mgr.load_object(canvas, model_object, obj_idx, instance_idxs);
|
||||
}
|
||||
|
||||
std::vector<int> _3DScene::load_object(wxGLCanvas* canvas, const Model* model, int obj_idx, std::vector<int> instance_idxs)
|
||||
{
|
||||
return s_canvas_mgr.load_object(canvas, model, obj_idx, instance_idxs);
|
||||
}
|
||||
|
||||
void _3DScene::load_print_toolpaths(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.load_print_toolpaths(canvas);
|
||||
|
||||
@@ -611,6 +611,9 @@ public:
|
||||
//##################################################################################################################
|
||||
|
||||
//##################################################################################################################
|
||||
static std::vector<int> load_object(wxGLCanvas* canvas, const ModelObject* model_object, int obj_idx, std::vector<int> instance_idxs);
|
||||
static std::vector<int> load_object(wxGLCanvas* canvas, const Model* model, int obj_idx, std::vector<int> instance_idxs);
|
||||
|
||||
static void load_print_toolpaths(wxGLCanvas* canvas);
|
||||
static void load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& str_tool_colors);
|
||||
static void load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
|
||||
|
||||
@@ -959,6 +959,9 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
||||
, m_moving_enabled(false)
|
||||
, m_shader_enabled(false)
|
||||
, m_multisample_allowed(false)
|
||||
, m_color_by("volume")
|
||||
, m_select_by("object")
|
||||
, m_drag_by("instance")
|
||||
{
|
||||
if (m_canvas != nullptr)
|
||||
m_timer = new wxTimer(m_canvas);
|
||||
@@ -1351,6 +1354,34 @@ void GLCanvas3D::set_toolpaths_range(double low, double high)
|
||||
m_volumes->set_range(low, high);
|
||||
}
|
||||
|
||||
std::vector<int> GLCanvas3D::load_object(const ModelObject& model_object, int obj_idx, std::vector<int> instance_idxs)
|
||||
{
|
||||
if (m_volumes == nullptr)
|
||||
return std::vector<int>();
|
||||
|
||||
if (instance_idxs.empty())
|
||||
{
|
||||
for (unsigned int i = 0; i < model_object.instances.size(); ++i)
|
||||
{
|
||||
instance_idxs.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
return m_volumes->load_object(&model_object, obj_idx, instance_idxs, m_color_by, m_select_by, m_drag_by, m_use_VBOs && m_initialized);
|
||||
}
|
||||
|
||||
std::vector<int> GLCanvas3D::load_object(const Model& model, int obj_idx, std::vector<int> instance_idxs)
|
||||
{
|
||||
if ((0 <= obj_idx) && (obj_idx < (int)model.objects.size()))
|
||||
{
|
||||
const ModelObject* model_object = model.objects[obj_idx];
|
||||
if (model_object != nullptr)
|
||||
return load_object(*model_object, obj_idx, instance_idxs);
|
||||
}
|
||||
|
||||
return std::vector<int>();
|
||||
}
|
||||
|
||||
void GLCanvas3D::load_print_toolpaths()
|
||||
{
|
||||
if ((m_print == nullptr) || (m_volumes == nullptr))
|
||||
|
||||
@@ -25,6 +25,8 @@ class ExPolygon;
|
||||
class Print;
|
||||
class PrintObject;
|
||||
class GCodePreviewData;
|
||||
class ModelObject;
|
||||
class Model;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
@@ -342,6 +344,10 @@ private:
|
||||
bool m_shader_enabled;
|
||||
bool m_multisample_allowed;
|
||||
|
||||
std::string m_color_by;
|
||||
std::string m_select_by;
|
||||
std::string m_drag_by;
|
||||
|
||||
GCodePreviewVolumeIndex m_gcode_preview_volume_index;
|
||||
|
||||
PerlCallback m_on_viewport_changed_callback;
|
||||
@@ -411,6 +417,9 @@ public:
|
||||
std::vector<double> get_current_print_zs(bool active_only) const;
|
||||
void set_toolpaths_range(double low, double high);
|
||||
|
||||
std::vector<int> load_object(const ModelObject& model_object, int obj_idx, std::vector<int> instance_idxs);
|
||||
std::vector<int> load_object(const Model& model, int obj_idx, std::vector<int> instance_idxs);
|
||||
|
||||
// Create 3D thick extrusion lines for a skirt and brim.
|
||||
// Adds a new Slic3r::GUI::3DScene::Volume to volumes.
|
||||
void load_print_toolpaths();
|
||||
|
||||
@@ -450,6 +450,24 @@ void GLCanvas3DManager::set_toolpaths_range(wxGLCanvas* canvas, double low, doub
|
||||
it->second->set_toolpaths_range(low, high);
|
||||
}
|
||||
|
||||
std::vector<int> GLCanvas3DManager::load_object(wxGLCanvas* canvas, const ModelObject* model_object, int obj_idx, std::vector<int> instance_idxs)
|
||||
{
|
||||
if (model_object == nullptr)
|
||||
return std::vector<int>();
|
||||
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->load_object(*model_object, obj_idx, instance_idxs) : std::vector<int>();
|
||||
}
|
||||
|
||||
std::vector<int> GLCanvas3DManager::load_object(wxGLCanvas* canvas, const Model* model, int obj_idx, std::vector<int> instance_idxs)
|
||||
{
|
||||
if (model == nullptr)
|
||||
return std::vector<int>();
|
||||
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->load_object(*model, obj_idx, instance_idxs) : std::vector<int>();
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::load_print_toolpaths(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
|
||||
@@ -95,6 +95,9 @@ public:
|
||||
std::vector<double> get_current_print_zs(wxGLCanvas* canvas, bool active_only) const;
|
||||
void set_toolpaths_range(wxGLCanvas* canvas, double low, double high);
|
||||
|
||||
std::vector<int> load_object(wxGLCanvas* canvas, const ModelObject* model_object, int obj_idx, std::vector<int> instance_idxs);
|
||||
std::vector<int> load_object(wxGLCanvas* canvas, const Model* model, int obj_idx, std::vector<int> instance_idxs);
|
||||
|
||||
void load_print_toolpaths(wxGLCanvas* canvas);
|
||||
void load_print_object_toolpaths(wxGLCanvas* canvas, const PrintObject* print_object, const std::vector<std::string>& tool_colors);
|
||||
void load_wipe_tower_toolpaths(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);
|
||||
|
||||
Reference in New Issue
Block a user