mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-04 04:24:04 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_bug_fixes
This commit is contained in:
commit
fac28ea27a
48 changed files with 98 additions and 351 deletions
|
@ -166,4 +166,4 @@ void Bed_2D::set_pos(const Vec2d& pos)
|
|||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
} // Slic3r
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "GUI_App.hpp"
|
||||
#include "PresetBundle.hpp"
|
||||
#include "Gizmos/GLGizmoBase.hpp"
|
||||
#include "GLCanvas3D.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
@ -630,4 +629,4 @@ void Bed3D::reset()
|
|||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
} // Slic3r
|
||||
|
|
|
@ -17,23 +17,17 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
#include <assert.h>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/spin_mutex.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "GUI.hpp"
|
||||
|
||||
#ifdef HAS_GLSAFE
|
||||
void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "slic3r/GUI/GLCanvas3DManager.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define HAS_GLSAFE
|
||||
|
@ -34,13 +33,8 @@ struct Camera;
|
|||
class GLToolbar;
|
||||
} // namespace GUI
|
||||
|
||||
class Print;
|
||||
class PrintObject;
|
||||
class SLAPrint;
|
||||
class SLAPrintObject;
|
||||
enum SLAPrintObjectStep : unsigned int;
|
||||
class Model;
|
||||
class ModelObject;
|
||||
class DynamicPrintConfig;
|
||||
class ExtrusionPath;
|
||||
class ExtrusionMultiPath;
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#include "I18N.hpp"
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef slic3r_GUI_AboutDialog_hpp_
|
||||
#define slic3r_GUI_AboutDialog_hpp_
|
||||
|
||||
#include "GUI.hpp"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
|
|
|
@ -2,22 +2,18 @@
|
|||
#include "libslic3r/Utils.hpp"
|
||||
#include "AppConfig.hpp"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/nowide/cenv.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/exceptions.hpp>
|
||||
#include <boost/property_tree/ptree_fwd.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/format/format_fwd.hpp>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include "I18N.hpp"
|
||||
|
@ -76,7 +72,7 @@ void AppConfig::set_defaults()
|
|||
if (get("remember_output_path").empty())
|
||||
set("remember_output_path", "1");
|
||||
|
||||
if (get("remember_output_path_removable").empty())
|
||||
if (get("remember_output_path_removable").empty())
|
||||
set("remember_output_path_removable", "1");
|
||||
|
||||
if (get("use_custom_toolbar_size").empty())
|
||||
|
|
|
@ -26,17 +26,16 @@
|
|||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/format/format_fwd.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/nowide/cstdio.hpp>
|
||||
#include "I18N.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "RemovableDriveManager.hpp"
|
||||
|
||||
#include "slic3r/Utils/Thread.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
BackgroundSlicingProcess::BackgroundSlicingProcess()
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <wx/event.h>
|
||||
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
#include "slic3r/Utils/Thread.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
|
@ -1755,7 +1755,7 @@ bool ConfigWizard::priv::on_bnt_finish()
|
|||
page_sla_materials->reload_presets();
|
||||
|
||||
// theres no need to check that filament is selected if we have only custom printer
|
||||
if (custom_printer_selected && !any_fff_selected && !any_sla_selected) return true;
|
||||
if (custom_printer_selected && !any_fff_selected && !any_sla_selected) return true;
|
||||
// check, that there is selected at least one filament/material
|
||||
return check_and_install_missing_materials(T_ANY);
|
||||
}
|
||||
|
|
|
@ -514,7 +514,7 @@ void TextCtrl::disable() { dynamic_cast<wxTextCtrl*>(window)->Disable(); dynamic
|
|||
#ifdef __WXGTK__
|
||||
void TextCtrl::change_field_value(wxEvent& event)
|
||||
{
|
||||
if (bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP))
|
||||
if ((bChangedValueEvent = (event.GetEventType()==wxEVT_KEY_UP)))
|
||||
on_change_field();
|
||||
event.Skip();
|
||||
};
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "slic3r/GUI/PresetBundle.hpp"
|
||||
#include "slic3r/GUI/Tab.hpp"
|
||||
#include "slic3r/GUI/GUI_Preview.hpp"
|
||||
#include "slic3r/GUI/3DBed.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
@ -1298,7 +1300,7 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_
|
|||
|
||||
// updates print order strings
|
||||
if (sorted_instances.size() > 1) {
|
||||
for (int i = 0; i < sorted_instances.size(); ++i) {
|
||||
for (size_t i = 0; i < sorted_instances.size(); ++i) {
|
||||
size_t id = sorted_instances[i]->id().id;
|
||||
std::vector<Owner>::iterator it = std::find_if(owners.begin(), owners.end(), [id](const Owner& owner) {
|
||||
return owner.model_instance_id == id;
|
||||
|
@ -4117,6 +4119,13 @@ Linef3 GLCanvas3D::mouse_ray(const Point& mouse_pos)
|
|||
return Linef3(_mouse_to_3d(mouse_pos, &z0), _mouse_to_3d(mouse_pos, &z1));
|
||||
}
|
||||
|
||||
|
||||
void GLCanvas3D::refresh_camera_scene_box()
|
||||
{
|
||||
m_camera.set_scene_box(scene_bounding_box());
|
||||
}
|
||||
|
||||
|
||||
double GLCanvas3D::get_size_proportional_to_max_bed_size(double factor) const
|
||||
{
|
||||
return factor * m_bed.get_bounding_box(false).max_size();
|
||||
|
|
|
@ -9,19 +9,18 @@
|
|||
|
||||
#include "3DScene.hpp"
|
||||
#include "GLToolbar.hpp"
|
||||
#include "GLShader.hpp"
|
||||
#include "Event.hpp"
|
||||
#include "3DBed.hpp"
|
||||
#include "Camera.hpp"
|
||||
#include "Selection.hpp"
|
||||
#include "Gizmos/GLGizmosManager.hpp"
|
||||
#include "GUI_ObjectLayers.hpp"
|
||||
#include "GLSelectionRectangle.hpp"
|
||||
#include "MeshUtils.hpp"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include <wx/timer.h>
|
||||
|
||||
class wxWindow;
|
||||
class wxSizeEvent;
|
||||
class wxIdleEvent;
|
||||
class wxKeyEvent;
|
||||
|
@ -35,8 +34,8 @@ class wxGLCanvas;
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
class GLShader;
|
||||
class ExPolygon;
|
||||
class Bed3D;
|
||||
struct Camera;
|
||||
class BackgroundSlicingProcess;
|
||||
class GCodePreviewData;
|
||||
#if ENABLE_THUMBNAIL_GENERATOR
|
||||
|
@ -47,8 +46,6 @@ enum LayerHeightEditActionType : unsigned int;
|
|||
|
||||
namespace GUI {
|
||||
|
||||
class GLGizmoBase;
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
class RetinaHelper;
|
||||
#endif
|
||||
|
@ -670,7 +667,7 @@ public:
|
|||
Linef3 mouse_ray(const Point& mouse_pos);
|
||||
|
||||
void set_mouse_as_dragging() { m_mouse.dragging = true; }
|
||||
void refresh_camera_scene_box() { m_camera.set_scene_box(scene_bounding_box()); }
|
||||
void refresh_camera_scene_box();
|
||||
bool is_mouse_dragging() const { return m_mouse.dragging; }
|
||||
|
||||
double get_size_proportional_to_max_bed_size(double factor) const;
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#include "GLToolbar.hpp"
|
||||
|
||||
#include "../../slic3r/GUI/GLCanvas3D.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include "../../slic3r/GUI/Camera.hpp"
|
||||
|
||||
#include <wx/event.h>
|
||||
#include <wx/bitmap.h>
|
||||
|
|
|
@ -483,7 +483,6 @@ void ObjectList::update_extruder_values_for_items(const size_t max_extruder)
|
|||
|
||||
void ObjectList::update_objects_list_extruder_column(size_t extruders_count)
|
||||
{
|
||||
if (!this) return; // #ys_FIXME
|
||||
if (printer_technology() == ptSLA)
|
||||
extruders_count = 1;
|
||||
|
||||
|
@ -1558,7 +1557,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
|||
// If there are selected more then one instance but not all of them
|
||||
// don't add settings menu items
|
||||
const Selection& selection = scene_selection();
|
||||
if (selection.is_multiple_full_instance() && !selection.is_single_full_object() ||
|
||||
if ((selection.is_multiple_full_instance() && !selection.is_single_full_object()) ||
|
||||
selection.is_multiple_volume() || selection.is_mixed() ) // more than one volume(part) is selected on the scene
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "GLGizmoHollow.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
@ -99,16 +100,11 @@ void GLGizmoHollow::on_render() const
|
|||
return;
|
||||
}
|
||||
|
||||
// !!! is it necessary?
|
||||
//const_cast<GLGizmoHollow*>(this)->m_c->update_from_backend(m_parent, m_c->m_model_object);
|
||||
|
||||
glsafe(::glEnable(GL_BLEND));
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
|
||||
m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z();
|
||||
|
||||
render_hollowed_mesh();
|
||||
|
||||
if (m_quadric != nullptr && selection.is_from_single_instance())
|
||||
render_points(selection, false);
|
||||
|
||||
|
@ -120,28 +116,6 @@ void GLGizmoHollow::on_render() const
|
|||
|
||||
|
||||
|
||||
void GLGizmoHollow::render_hollowed_mesh() const
|
||||
{
|
||||
/*if (m_c->m_volume_with_cavity) {
|
||||
m_c->m_volume_with_cavity->set_sla_shift_z(m_z_shift);
|
||||
m_parent.get_shader().start_using();
|
||||
|
||||
GLint current_program_id;
|
||||
glsafe(::glGetIntegerv(GL_CURRENT_PROGRAM, ¤t_program_id));
|
||||
GLint color_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "uniform_color") : -1;
|
||||
GLint print_box_detection_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_detection") : -1;
|
||||
GLint print_box_worldmatrix_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_world_matrix") : -1;
|
||||
glcheck();
|
||||
m_c->m_volume_with_cavity->set_render_color();
|
||||
const Geometry::Transformation& volume_trafo = m_c->m_model_object->volumes.front()->get_transformation();
|
||||
m_c->m_volume_with_cavity->set_volume_transformation(volume_trafo);
|
||||
m_c->m_volume_with_cavity->set_instance_transformation(m_c->m_model_object->instances[size_t(m_c->m_active_instance)]->get_transformation());
|
||||
m_c->m_volume_with_cavity->render(color_id, print_box_detection_id, print_box_worldmatrix_id);
|
||||
m_parent.get_shader().stop_using();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void GLGizmoHollow::render_clipping_plane(const Selection& selection) const
|
||||
{
|
||||
if (m_c->m_clipping_plane_distance == 0.f)
|
||||
|
@ -169,11 +143,6 @@ void GLGizmoHollow::render_clipping_plane(const Selection& selection) const
|
|||
m_c->m_object_clipper->set_plane(*m_c->m_clipping_plane);
|
||||
m_c->m_object_clipper->set_transformation(trafo);
|
||||
|
||||
|
||||
// Next, ask the backend if supports are already calculated. If so, we are gonna cut them too.
|
||||
//if (m_c->m_print_object_idx < 0)
|
||||
// m_c->update_from_backend(m_parent, m_c->m_model_object);
|
||||
|
||||
if (m_c->m_print_object_idx >= 0) {
|
||||
const SLAPrintObject* print_object = m_parent.sla_print()->objects()[m_c->m_print_object_idx];
|
||||
|
||||
|
@ -229,7 +198,6 @@ void GLGizmoHollow::on_render_for_picking() const
|
|||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
render_points(selection, true);
|
||||
render_hollowed_mesh();
|
||||
}
|
||||
|
||||
void GLGizmoHollow::render_points(const Selection& selection, bool picking) const
|
||||
|
@ -343,10 +311,6 @@ bool GLGizmoHollow::unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, V
|
|||
if (! m_c->m_mesh_raycaster)
|
||||
return false;
|
||||
|
||||
// if the gizmo doesn't have the V, F structures for igl, calculate them first:
|
||||
// !!! is it really necessary?
|
||||
//m_c->update_from_backend(m_parent, m_c->m_model_object);
|
||||
|
||||
const Camera& camera = m_parent.get_camera();
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
|
||||
|
@ -561,87 +525,15 @@ void GLGizmoHollow::on_update(const UpdateData& data)
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<const TriangleMesh *, sla::HollowingConfig> GLGizmoHollow::get_hollowing_parameters() const
|
||||
{
|
||||
// FIXME this function is probably obsolete, caller could
|
||||
// get the data from model config himself
|
||||
auto opts = get_config_options({"hollowing_min_thickness", "hollowing_quality", "hollowing_closing_distance"});
|
||||
double offset = static_cast<const ConfigOptionFloat*>(opts[0].first)->value;
|
||||
double quality = static_cast<const ConfigOptionFloat*>(opts[1].first)->value;
|
||||
double closing_d = static_cast<const ConfigOptionFloat*>(opts[2].first)->value;
|
||||
return std::make_pair(m_c->m_mesh, sla::HollowingConfig{offset, quality, closing_d});
|
||||
}
|
||||
|
||||
void GLGizmoHollow::update_mesh_raycaster(std::unique_ptr<MeshRaycaster> &&rc)
|
||||
{
|
||||
m_c->m_mesh_raycaster = std::move(rc);
|
||||
m_c->m_object_clipper.reset();
|
||||
//m_c->m_volume_with_cavity.reset();
|
||||
}
|
||||
|
||||
void GLGizmoHollow::hollow_mesh(bool postpone_error_messages)
|
||||
{
|
||||
// Trigger a UI job to hollow the mesh.
|
||||
// wxGetApp().plater()->hollow();
|
||||
|
||||
wxGetApp().CallAfter([this, postpone_error_messages]() {
|
||||
wxGetApp().plater()->reslice_SLA_hollowing(*m_c->m_model_object, postpone_error_messages);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void GLGizmoHollow::update_hollowed_mesh(std::unique_ptr<TriangleMesh> &&mesh)
|
||||
{
|
||||
// Called from Plater when the UI job finishes
|
||||
/*m_c->m_cavity_mesh = std::move(mesh);
|
||||
|
||||
if(m_c->m_cavity_mesh) {
|
||||
// First subtract the holes:
|
||||
if (! m_c->m_model_object->sla_drain_holes.empty()) {
|
||||
TriangleMesh holes_mesh;
|
||||
for (const sla::DrainHole& hole : m_c->m_model_object->sla_drain_holes) {
|
||||
TriangleMesh hole_mesh = make_cylinder(hole.radius, hole.height, 2*M_PI/32);
|
||||
|
||||
Vec3d scaling = m_c->m_model_object->instances[m_c->m_active_instance]->get_scaling_factor();
|
||||
Vec3d normal_transformed = Vec3d(hole.normal(0)/scaling(0), hole.normal(1)/scaling(1), hole.normal(2)/scaling(2));
|
||||
normal_transformed.normalize();
|
||||
|
||||
// Rotate the cylinder appropriately
|
||||
Eigen::Quaterniond q;
|
||||
Transform3d m = Transform3d::Identity();
|
||||
m.matrix().block(0, 0, 3, 3) = q.setFromTwoVectors(Vec3d::UnitZ(), normal_transformed).toRotationMatrix();
|
||||
hole_mesh.transform(m);
|
||||
|
||||
// If the instance is scaled, undo the scaling of the hole
|
||||
hole_mesh.scale(Vec3d(1/scaling(0), 1/scaling(1), 1/scaling(2)));
|
||||
|
||||
// Translate the hole into position and merge with the others
|
||||
hole_mesh.translate(hole.pos);
|
||||
holes_mesh.merge(hole_mesh);
|
||||
holes_mesh.repair();
|
||||
}
|
||||
MeshBoolean::minus(*m_c->m_cavity_mesh.get(), holes_mesh);
|
||||
}
|
||||
|
||||
// create a new GLVolume that only has the cavity inside
|
||||
m_c->m_volume_with_cavity.reset(new GLVolume(GLVolume::MODEL_COLOR[2]));
|
||||
m_c->m_volume_with_cavity->indexed_vertex_array.load_mesh(*m_c->m_cavity_mesh.get());
|
||||
m_c->m_volume_with_cavity->finalize_geometry(true);
|
||||
m_c->m_volume_with_cavity->force_transparent = false;
|
||||
|
||||
m_parent.toggle_model_objects_visibility(false, m_c->m_model_object, m_c->m_active_instance);
|
||||
m_parent.toggle_sla_auxiliaries_visibility(true, m_c->m_model_object, m_c->m_active_instance);
|
||||
|
||||
// Reset raycaster so it works with the new mesh:
|
||||
m_c->m_mesh_raycaster.reset(new MeshRaycaster(*m_c->mesh()));
|
||||
}
|
||||
|
||||
if (m_c->m_clipping_plane_distance == 0.f) {
|
||||
m_c->m_clipping_plane_distance = 0.5f;
|
||||
update_clipping_plane();
|
||||
}*/
|
||||
}
|
||||
|
||||
std::vector<std::pair<const ConfigOption*, const ConfigOptionDef*>> GLGizmoHollow::get_config_options(const std::vector<std::string>& keys) const
|
||||
{
|
||||
std::vector<std::pair<const ConfigOption*, const ConfigOptionDef*>> out;
|
||||
|
@ -829,7 +721,6 @@ RENDER_AGAIN:
|
|||
bool remove_selected = false;
|
||||
bool remove_all = false;
|
||||
|
||||
// m_imgui->text(" "); // vertical gap
|
||||
ImGui::Separator();
|
||||
|
||||
float diameter_upper_cap = 15.;
|
||||
|
@ -1013,10 +904,6 @@ void GLGizmoHollow::on_set_state()
|
|||
m_parent.toggle_model_objects_visibility(true, m_c->m_model_object, m_c->m_active_instance);
|
||||
m_parent.toggle_sla_auxiliaries_visibility(m_show_supports, m_c->m_model_object, m_c->m_active_instance);
|
||||
}
|
||||
|
||||
// Set default head diameter from config.
|
||||
//const DynamicPrintConfig& cfg = wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
|
||||
//m_new_hole_radius = static_cast<const ConfigOptionFloat*>(cfg.option("support_head_front_diameter"))->value;
|
||||
}
|
||||
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
|
||||
//Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("SLA gizmo turned off")));
|
||||
|
|
|
@ -36,11 +36,6 @@ public:
|
|||
void delete_selected_points();
|
||||
ClippingPlane get_sla_clipping_plane() const;
|
||||
|
||||
|
||||
std::pair<const TriangleMesh *, sla::HollowingConfig> get_hollowing_parameters() const;
|
||||
void update_mesh_raycaster(std::unique_ptr<MeshRaycaster> &&rc);
|
||||
void update_hollowed_mesh(std::unique_ptr<TriangleMesh> &&mesh);
|
||||
|
||||
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
|
||||
void update_clipping_plane(bool keep_normal = false) const;
|
||||
void set_common_data_ptr(CommonGizmosData* ptr) { m_c = ptr; }
|
||||
|
@ -53,7 +48,6 @@ private:
|
|||
|
||||
void render_points(const Selection& selection, bool picking = false) const;
|
||||
void render_clipping_plane(const Selection& selection) const;
|
||||
void render_hollowed_mesh() const;
|
||||
void hollow_mesh(bool postpone_error_messages = false);
|
||||
bool unsaved_changes() const;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Include GLGizmoBase.hpp before I18N.hpp as it includes some libigl code, which overrides our localization "L" macro.
|
||||
#include "GLGizmoSlaSupports.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
@ -106,8 +107,6 @@ void GLGizmoSlaSupports::on_render() const
|
|||
|
||||
m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z();
|
||||
|
||||
render_hollowed_mesh();
|
||||
|
||||
if (m_quadric != nullptr && selection.is_from_single_instance())
|
||||
render_points(selection, false);
|
||||
|
||||
|
@ -119,29 +118,6 @@ void GLGizmoSlaSupports::on_render() const
|
|||
|
||||
|
||||
|
||||
void GLGizmoSlaSupports::render_hollowed_mesh() const
|
||||
{
|
||||
/*if (m_c->m_volume_with_cavity) {
|
||||
m_c->m_volume_with_cavity->set_sla_shift_z(m_z_shift);
|
||||
m_parent.get_shader().start_using();
|
||||
|
||||
GLint current_program_id;
|
||||
glsafe(::glGetIntegerv(GL_CURRENT_PROGRAM, ¤t_program_id));
|
||||
GLint color_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "uniform_color") : -1;
|
||||
GLint print_box_detection_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_detection") : -1;
|
||||
GLint print_box_worldmatrix_id = (current_program_id > 0) ? ::glGetUniformLocation(current_program_id, "print_box.volume_world_matrix") : -1;
|
||||
glcheck();
|
||||
m_c->m_volume_with_cavity->set_render_color();
|
||||
const Geometry::Transformation& volume_trafo = m_c->m_model_object->volumes.front()->get_transformation();
|
||||
m_c->m_volume_with_cavity->set_volume_transformation(volume_trafo);
|
||||
m_c->m_volume_with_cavity->set_instance_transformation(m_c->m_model_object->instances[size_t(m_c->m_active_instance)]->get_transformation());
|
||||
m_c->m_volume_with_cavity->render(color_id, print_box_detection_id, print_box_worldmatrix_id);
|
||||
m_parent.get_shader().stop_using();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GLGizmoSlaSupports::render_clipping_plane(const Selection& selection) const
|
||||
{
|
||||
if (m_c->m_clipping_plane_distance == 0.f || m_c->m_mesh->empty())
|
||||
|
@ -238,7 +214,6 @@ void GLGizmoSlaSupports::on_render_for_picking() const
|
|||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
render_points(selection, true);
|
||||
render_hollowed_mesh();
|
||||
}
|
||||
|
||||
void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking) const
|
||||
|
@ -627,8 +602,6 @@ void GLGizmoSlaSupports::delete_selected_points(bool force)
|
|||
}
|
||||
|
||||
select_point(NoPoints);
|
||||
|
||||
//m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||
}
|
||||
|
||||
void GLGizmoSlaSupports::on_update(const UpdateData& data)
|
||||
|
@ -643,8 +616,6 @@ void GLGizmoSlaSupports::on_update(const UpdateData& data)
|
|||
m_editing_cache[m_hover_id].support_point.pos = pos_and_normal.first;
|
||||
m_editing_cache[m_hover_id].support_point.is_new_island = false;
|
||||
m_editing_cache[m_hover_id].normal = pos_and_normal.second;
|
||||
// Do not update immediately, wait until the mouse is released.
|
||||
// m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ private:
|
|||
//void render_selection_rectangle() const;
|
||||
void render_points(const Selection& selection, bool picking = false) const;
|
||||
void render_clipping_plane(const Selection& selection) const;
|
||||
void render_hollowed_mesh() const;
|
||||
bool unsaved_changes() const;
|
||||
|
||||
bool m_lock_unique_islands = false;
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
#include "slic3r/Utils/UndoRedo.hpp"
|
||||
#include "libslic3r/SLAPrint.hpp"
|
||||
#include "slic3r/GUI/MeshUtils.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
#include "slic3r/GUI/Camera.hpp"
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "slic3r/GUI/GLTexture.hpp"
|
||||
#include "slic3r/GUI/GLToolbar.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmos.hpp"
|
||||
#include "libslic3r/ObjectID.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
@ -18,6 +18,8 @@ namespace GUI {
|
|||
|
||||
class GLCanvas3D;
|
||||
class ClippingPlane;
|
||||
enum class SLAGizmoEventType : unsigned char;
|
||||
class CommonGizmosData;
|
||||
|
||||
class Rect
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "GUI_ObjectList.hpp"
|
||||
#include "I18N.hpp"
|
||||
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/dc.h>
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
#include "../Utils/PrintHost.hpp"
|
||||
#include "../Utils/FixModelByWin10.hpp"
|
||||
#include "../Utils/UndoRedo.hpp"
|
||||
#include "../Utils/Thread.hpp"
|
||||
#include "RemovableDriveManager.hpp"
|
||||
|
||||
#include <wx/glcanvas.h> // Needs to be last because reasons :-/
|
||||
|
@ -1560,8 +1559,7 @@ struct Plater::priv
|
|||
|
||||
enum class Jobs : size_t {
|
||||
Arrange,
|
||||
Rotoptimize,
|
||||
Hollow
|
||||
Rotoptimize
|
||||
};
|
||||
|
||||
class ArrangeJob : public PlaterJob
|
||||
|
@ -1734,22 +1732,6 @@ struct Plater::priv
|
|||
void process() override;
|
||||
};
|
||||
|
||||
class HollowJob : public PlaterJob
|
||||
{
|
||||
public:
|
||||
using PlaterJob::PlaterJob;
|
||||
void prepare() override;
|
||||
void process() override;
|
||||
void finalize() override;
|
||||
private:
|
||||
GLGizmoHollow * get_gizmo();
|
||||
const GLGizmoHollow * get_gizmo() const;
|
||||
|
||||
std::unique_ptr<TriangleMesh> m_output_mesh;
|
||||
std::unique_ptr<MeshRaycaster> m_output_raycaster;
|
||||
const TriangleMesh* m_object_mesh = nullptr;
|
||||
sla::HollowingConfig m_cfg;
|
||||
};
|
||||
|
||||
// Jobs defined inside the group class will be managed so that only one can
|
||||
// run at a time. Also, the background process will be stopped if a job is
|
||||
|
@ -1762,7 +1744,6 @@ struct Plater::priv
|
|||
|
||||
ArrangeJob arrange_job{m_plater};
|
||||
RotoptimizeJob rotoptimize_job{m_plater};
|
||||
HollowJob hollow_job{m_plater};
|
||||
|
||||
// To create a new job, just define a new subclass of Job, implement
|
||||
// the process and the optional prepare() and finalize() methods
|
||||
|
@ -1770,8 +1751,7 @@ struct Plater::priv
|
|||
// if it cannot run concurrently with other jobs in this group
|
||||
|
||||
std::vector<std::reference_wrapper<Job>> m_jobs{arrange_job,
|
||||
rotoptimize_job,
|
||||
hollow_job};
|
||||
rotoptimize_job};
|
||||
|
||||
public:
|
||||
ExclusiveJobGroup(priv *_plater) : m_plater(_plater) {}
|
||||
|
@ -1874,7 +1854,6 @@ struct Plater::priv
|
|||
void reset();
|
||||
void mirror(Axis axis);
|
||||
void arrange();
|
||||
void hollow();
|
||||
void sla_optimize_rotation();
|
||||
void split_object();
|
||||
void split_volume();
|
||||
|
@ -2818,11 +2797,6 @@ void Plater::priv::arrange()
|
|||
m_ui_jobs.start(Jobs::Arrange);
|
||||
}
|
||||
|
||||
void Plater::priv::hollow()
|
||||
{
|
||||
this->take_snapshot(_(L("Hollow")));
|
||||
m_ui_jobs.start(Jobs::Hollow);
|
||||
}
|
||||
|
||||
// This method will find an optimal orientation for the currently selected item
|
||||
// Very similar in nature to the arrange method above...
|
||||
|
@ -2960,67 +2934,6 @@ void Plater::priv::RotoptimizeJob::process()
|
|||
: _(L("Orientation found.")));
|
||||
}
|
||||
|
||||
void Plater::priv::HollowJob::prepare()
|
||||
{
|
||||
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
|
||||
const GLGizmoHollow* gizmo_hollow = dynamic_cast<const GLGizmoHollow*>(gizmo_manager.get_current());
|
||||
assert(gizmo_hollow);
|
||||
auto hlw_data = gizmo_hollow->get_hollowing_parameters();
|
||||
m_object_mesh = hlw_data.first;
|
||||
m_cfg = hlw_data.second;
|
||||
m_output_mesh.reset();
|
||||
}
|
||||
|
||||
void Plater::priv::HollowJob::process()
|
||||
{
|
||||
sla::JobController ctl;
|
||||
ctl.stopcondition = [this]{ return was_canceled(); };
|
||||
ctl.statuscb = [this](unsigned st, const std::string &s) {
|
||||
if (st < 100) update_status(int(st), s);
|
||||
};
|
||||
|
||||
std::unique_ptr<TriangleMesh> omesh =
|
||||
sla::generate_interior(*m_object_mesh, m_cfg, ctl);
|
||||
|
||||
if (omesh && !omesh->empty()) {
|
||||
m_output_mesh.reset(new TriangleMesh{*m_object_mesh});
|
||||
m_output_mesh->merge(*omesh);
|
||||
m_output_mesh->require_shared_vertices();
|
||||
|
||||
update_status(90, _(L("Indexing hollowed object")));
|
||||
|
||||
m_output_raycaster.reset(new MeshRaycaster(*m_output_mesh));
|
||||
|
||||
update_status(100, was_canceled() ? _(L("Hollowing cancelled.")) :
|
||||
_(L("Hollowing done.")));
|
||||
} else {
|
||||
update_status(100, _(L("Hollowing failed.")));
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::priv::HollowJob::finalize()
|
||||
{
|
||||
if (auto gizmo = get_gizmo()) {
|
||||
gizmo->update_mesh_raycaster(std::move(m_output_raycaster));
|
||||
gizmo->update_hollowed_mesh(std::move(m_output_mesh));
|
||||
}
|
||||
}
|
||||
|
||||
GLGizmoHollow *Plater::priv::HollowJob::get_gizmo()
|
||||
{
|
||||
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
|
||||
auto ret = dynamic_cast<GLGizmoHollow*>(gizmo_manager.get_current());
|
||||
assert(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const GLGizmoHollow *Plater::priv::HollowJob::get_gizmo() const
|
||||
{
|
||||
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
|
||||
auto ret = dynamic_cast<const GLGizmoHollow*>(gizmo_manager.get_current());
|
||||
assert(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Plater::priv::split_object()
|
||||
{
|
||||
|
@ -5131,10 +5044,6 @@ void Plater::export_toolpaths_to_obj() const
|
|||
p->preview->get_canvas3d()->export_toolpaths_to_obj(into_u8(path).c_str());
|
||||
}
|
||||
|
||||
void Plater::hollow()
|
||||
{
|
||||
p->hollow();
|
||||
}
|
||||
|
||||
void Plater::reslice()
|
||||
{
|
||||
|
|
|
@ -10,14 +10,11 @@
|
|||
|
||||
#include "Preset.hpp"
|
||||
|
||||
#include "3DScene.hpp"
|
||||
#include "GLTexture.hpp"
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
class wxButton;
|
||||
class ScalableButton;
|
||||
class wxBoxSizer;
|
||||
class wxGLCanvas;
|
||||
class wxScrolledWindow;
|
||||
class wxString;
|
||||
|
||||
|
@ -30,9 +27,9 @@ class SLAPrint;
|
|||
enum SLAPrintObjectStep : unsigned int;
|
||||
|
||||
namespace UndoRedo {
|
||||
class Stack;
|
||||
struct Snapshot;
|
||||
};
|
||||
class Stack;
|
||||
struct Snapshot;
|
||||
}
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
@ -44,6 +41,7 @@ class ObjectLayers;
|
|||
class ObjectList;
|
||||
class GLCanvas3D;
|
||||
class Mouse3DController;
|
||||
struct Camera;
|
||||
|
||||
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
|
||||
|
||||
|
@ -200,7 +198,6 @@ public:
|
|||
void reload_all_from_disk();
|
||||
bool has_toolpaths_to_export() const;
|
||||
void export_toolpaths_to_obj() const;
|
||||
void hollow();
|
||||
void reslice();
|
||||
void reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages = false);
|
||||
void reslice_SLA_hollowing(const ModelObject &object, bool postpone_error_messages = false);
|
||||
|
|
|
@ -1027,7 +1027,7 @@ const std::string& PresetCollection::get_preset_name_by_alias(const std::string&
|
|||
it != m_map_alias_to_profile_name.end() && it->first == alias; ++ it)
|
||||
if (auto it_preset = this->find_preset_internal(it->second);
|
||||
it_preset != m_presets.end() && it_preset->name == it->second &&
|
||||
it_preset->is_visible && (it_preset->is_compatible || (it_preset - m_presets.begin()) == m_idx_selected))
|
||||
it_preset->is_visible && (it_preset->is_compatible || size_t(it_preset - m_presets.begin()) == m_idx_selected))
|
||||
return it_preset->name;
|
||||
return alias;
|
||||
}
|
||||
|
@ -1089,6 +1089,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
bool selected = idx_preset == m_idx_selected;
|
||||
Preset &preset_selected = m_presets[idx_preset];
|
||||
Preset &preset_edited = selected ? m_edited_preset : preset_selected;
|
||||
|
||||
const PresetWithVendorProfile this_preset_with_vendor_profile = this->get_preset_with_vendor_profile(preset_edited);
|
||||
bool was_compatible = preset_edited.is_compatible;
|
||||
preset_edited.is_compatible = is_compatible_with_printer(this_preset_with_vendor_profile, active_printer, &config);
|
||||
|
@ -1097,7 +1098,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
preset_edited.is_compatible &= is_compatible_with_print(this_preset_with_vendor_profile, *active_print, active_printer);
|
||||
if (! preset_edited.is_compatible && selected &&
|
||||
(unselect_if_incompatible == PresetSelectCompatibleType::Always || (unselect_if_incompatible == PresetSelectCompatibleType::OnlyIfWasCompatible && was_compatible)))
|
||||
m_idx_selected = -1;
|
||||
m_idx_selected = size_t(-1);
|
||||
if (selected)
|
||||
preset_selected.is_compatible = preset_edited.is_compatible;
|
||||
}
|
||||
|
@ -1398,7 +1399,7 @@ void add_correct_opts_to_diff(const std::string &opt_key, t_config_option_keys&
|
|||
const T* opt_init = static_cast<const T*>(other.option(opt_key));
|
||||
const T* opt_cur = static_cast<const T*>(this_c.option(opt_key));
|
||||
int opt_init_max_id = opt_init->values.size() - 1;
|
||||
for (int i = 0; i < opt_cur->values.size(); i++)
|
||||
for (int i = 0; i < int(opt_cur->values.size()); i++)
|
||||
{
|
||||
int init_id = i <= opt_init_max_id ? i : 0;
|
||||
if (opt_cur->values[i] != opt_init->values[init_id])
|
||||
|
|
|
@ -342,9 +342,9 @@ public:
|
|||
// Return the selected preset, without the user modifications applied.
|
||||
Preset& get_selected_preset() { return m_presets[m_idx_selected]; }
|
||||
const Preset& get_selected_preset() const { return m_presets[m_idx_selected]; }
|
||||
int get_selected_idx() const { return m_idx_selected; }
|
||||
size_t get_selected_idx() const { return m_idx_selected; }
|
||||
// Returns the name of the selected preset, or an empty string if no preset is selected.
|
||||
std::string get_selected_preset_name() const { return (m_idx_selected == -1) ? std::string() : this->get_selected_preset().name; }
|
||||
std::string get_selected_preset_name() const { return (m_idx_selected == size_t(-1)) ? std::string() : this->get_selected_preset().name; }
|
||||
// For the current edited preset, return the parent preset if there is one.
|
||||
// If there is no parent preset, nullptr is returned.
|
||||
// The parent preset may be a system preset or a user preset, which will be
|
||||
|
@ -366,7 +366,7 @@ public:
|
|||
|
||||
// used to update preset_choice from Tab
|
||||
const std::deque<Preset>& get_presets() const { return m_presets; }
|
||||
int get_idx_selected() { return m_idx_selected; }
|
||||
size_t get_idx_selected() { return m_idx_selected; }
|
||||
static const std::string& get_suffix_modified();
|
||||
|
||||
// Return a preset possibly with modifications.
|
||||
|
@ -374,7 +374,7 @@ public:
|
|||
const Preset& default_preset(size_t idx = 0) const { assert(idx < m_num_default_presets); return m_presets[idx]; }
|
||||
virtual const Preset& default_preset_for(const DynamicPrintConfig & /* config */) const { return this->default_preset(); }
|
||||
// Return a preset by an index. If the preset is active, a temporary copy is returned.
|
||||
Preset& preset(size_t idx) { return (int(idx) == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
|
||||
Preset& preset(size_t idx) { return (idx == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
|
||||
const Preset& preset(size_t idx) const { return const_cast<PresetCollection*>(this)->preset(idx); }
|
||||
void discard_current_changes() { m_presets[m_idx_selected].reset_dirty(); m_edited_preset = m_presets[m_idx_selected]; }
|
||||
|
||||
|
@ -542,7 +542,7 @@ private:
|
|||
// Initially this preset contains a copy of the selected preset. Later on, this copy may be modified by the user.
|
||||
Preset m_edited_preset;
|
||||
// Selected preset.
|
||||
int m_idx_selected;
|
||||
size_t m_idx_selected;
|
||||
// Is the "- default -" preset suppressed?
|
||||
bool m_default_suppressed = true;
|
||||
size_t m_num_default_presets = 0;
|
||||
|
|
|
@ -29,8 +29,10 @@
|
|||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
||||
|
||||
// Store the print/filament/printer presets into a "presets" subdirectory of the Slic3rPE config dir.
|
||||
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
|
||||
// #define SLIC3R_PROFILE_USE_PRESETS_SUBDIR
|
||||
|
@ -971,8 +973,6 @@ static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree, co
|
|||
{
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
typedef std::pair<pt::ptree::key_type, pt::ptree> ptree_child_type;
|
||||
|
||||
// 1) For the group given by group_name, initialize the presets.
|
||||
struct Prst {
|
||||
Prst(const std::string &name, pt::ptree *node) : name(name), node(node) {}
|
||||
|
@ -1332,7 +1332,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
|
|||
|
||||
// Derive the profile logical name aka alias from the preset name if the alias was not stated explicitely.
|
||||
if (alias_name.empty()) {
|
||||
int end_pos = preset_name.find_first_of("@");
|
||||
size_t end_pos = preset_name.find_first_of("@");
|
||||
if (end_pos != std::string::npos) {
|
||||
alias_name = preset_name.substr(0, end_pos);
|
||||
if (renamed_from.empty())
|
||||
|
@ -1735,7 +1735,7 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
|
|||
if (selected_preset_item == INT_MAX)
|
||||
selected_preset_item = ui->GetCount() - 1;
|
||||
|
||||
ui->SetSelection(selected_preset_item);
|
||||
ui->SetSelection(selected_preset_item);
|
||||
ui->SetToolTip(tooltip.IsEmpty() ? ui->GetString(selected_preset_item) : tooltip);
|
||||
ui->check_selection();
|
||||
ui->Thaw();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "PresetBundle.hpp"
|
||||
#include "PresetHints.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include "slic3r/Utils/Http.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue