Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_viewer
This commit is contained in:
commit
e57bc8afc1
5 changed files with 81 additions and 2 deletions
|
@ -52,6 +52,10 @@
|
||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
# Use the new builtin CMake function if possible or fall back to the old one.
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.16)
|
||||||
|
|
||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
macro(combine_arguments _variable)
|
macro(combine_arguments _variable)
|
||||||
|
@ -102,6 +106,10 @@ function(export_all_flags _filename)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(add_precompiled_header _target _input)
|
function(add_precompiled_header _target _input)
|
||||||
|
|
||||||
|
message(STATUS "Adding precompiled header ${_input} to target ${_target} with legacy method. "
|
||||||
|
"Update your cmake instance to use the native PCH functions.")
|
||||||
|
|
||||||
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
|
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
|
||||||
|
|
||||||
get_filename_component(_input_we ${_input} NAME_WE)
|
get_filename_component(_input_we ${_input} NAME_WE)
|
||||||
|
@ -241,3 +249,21 @@ function(add_precompiled_header _target _input)
|
||||||
endforeach()
|
endforeach()
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
function(add_precompiled_header _target _input)
|
||||||
|
message(STATUS "Adding precompiled header ${_input} to target ${_target}.")
|
||||||
|
target_precompile_headers(${_target} PRIVATE ${_input})
|
||||||
|
|
||||||
|
get_target_property(_sources ${_target} SOURCES)
|
||||||
|
list(FILTER _sources INCLUDE REGEX ".*\\.mm?")
|
||||||
|
|
||||||
|
if (_sources)
|
||||||
|
message(STATUS "PCH skipping sources: ${_sources}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set_source_files_properties(${_sources} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
endif (CMAKE_VERSION VERSION_LESS 3.16)
|
||||||
|
|
|
@ -234,6 +234,7 @@ add_library(libslic3r STATIC
|
||||||
SLA/Contour3D.cpp
|
SLA/Contour3D.cpp
|
||||||
SLA/EigenMesh3D.hpp
|
SLA/EigenMesh3D.hpp
|
||||||
SLA/Clustering.hpp
|
SLA/Clustering.hpp
|
||||||
|
SLA/ReprojectPointsOnMesh.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (SLIC3R_STATIC)
|
if (SLIC3R_STATIC)
|
||||||
|
|
45
src/libslic3r/SLA/ReprojectPointsOnMesh.hpp
Normal file
45
src/libslic3r/SLA/ReprojectPointsOnMesh.hpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#ifndef REPROJECTPOINTSONMESH_HPP
|
||||||
|
#define REPROJECTPOINTSONMESH_HPP
|
||||||
|
|
||||||
|
#include "libslic3r/Point.hpp"
|
||||||
|
#include "SupportPoint.hpp"
|
||||||
|
#include "Hollowing.hpp"
|
||||||
|
#include "EigenMesh3D.hpp"
|
||||||
|
#include "libslic3r/Model.hpp"
|
||||||
|
|
||||||
|
#include <tbb/parallel_for.h>
|
||||||
|
|
||||||
|
namespace Slic3r { namespace sla {
|
||||||
|
|
||||||
|
template<class Pt> Vec3d pos(const Pt &p) { return p.pos.template cast<double>(); }
|
||||||
|
template<class Pt> void pos(Pt &p, const Vec3d &pp) { p.pos = pp.cast<float>(); }
|
||||||
|
|
||||||
|
template<class PointType>
|
||||||
|
void reproject_support_points(const EigenMesh3D &mesh, std::vector<PointType> &pts)
|
||||||
|
{
|
||||||
|
tbb::parallel_for(size_t(0), pts.size(), [&mesh, &pts](size_t idx) {
|
||||||
|
int junk;
|
||||||
|
Vec3d new_pos;
|
||||||
|
mesh.squared_distance(pos(pts[idx]), junk, new_pos);
|
||||||
|
pos(pts[idx], new_pos);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void reproject_points_and_holes(ModelObject *object)
|
||||||
|
{
|
||||||
|
bool has_sppoints = !object->sla_support_points.empty();
|
||||||
|
bool has_holes = !object->sla_drain_holes.empty();
|
||||||
|
|
||||||
|
if (!object || (!has_holes && !has_sppoints)) return;
|
||||||
|
|
||||||
|
EigenMesh3D emesh{object->raw_mesh()};
|
||||||
|
|
||||||
|
if (has_sppoints)
|
||||||
|
reproject_support_points(emesh, object->sla_support_points);
|
||||||
|
|
||||||
|
if (has_holes)
|
||||||
|
reproject_support_points(emesh, object->sla_drain_holes);
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
|
#endif // REPROJECTPOINTSONMESH_HPP
|
|
@ -756,8 +756,11 @@ void GLGizmoFdmSupports::on_set_state()
|
||||||
}
|
}
|
||||||
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
|
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
|
||||||
// we are actually shutting down
|
// we are actually shutting down
|
||||||
m_setting_angle = false;
|
if (m_setting_angle) {
|
||||||
m_parent.use_slope(false);
|
m_setting_angle = false;
|
||||||
|
m_parent.use_slope(false);
|
||||||
|
}
|
||||||
|
|
||||||
wxGetApp().plater()->leave_gizmos_stack();
|
wxGetApp().plater()->leave_gizmos_stack();
|
||||||
{
|
{
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("FDM gizmo turned off")));
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("FDM gizmo turned off")));
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/SLA/Hollowing.hpp"
|
#include "libslic3r/SLA/Hollowing.hpp"
|
||||||
#include "libslic3r/SLA/SupportPoint.hpp"
|
#include "libslic3r/SLA/SupportPoint.hpp"
|
||||||
|
#include "libslic3r/SLA/ReprojectPointsOnMesh.hpp"
|
||||||
#include "libslic3r/Polygon.hpp"
|
#include "libslic3r/Polygon.hpp"
|
||||||
#include "libslic3r/Print.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
|
@ -3146,6 +3147,8 @@ void Plater::priv::reload_from_disk()
|
||||||
std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back());
|
std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back());
|
||||||
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
|
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
|
||||||
old_model_object->ensure_on_bed();
|
old_model_object->ensure_on_bed();
|
||||||
|
|
||||||
|
sla::reproject_points_and_holes(old_model_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3201,6 +3204,7 @@ void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* =
|
||||||
Plater::TakeSnapshot snapshot(q, _L("Fix Throught NetFabb"));
|
Plater::TakeSnapshot snapshot(q, _L("Fix Throught NetFabb"));
|
||||||
|
|
||||||
fix_model_by_win10_sdk_gui(*model.objects[obj_idx], vol_idx);
|
fix_model_by_win10_sdk_gui(*model.objects[obj_idx], vol_idx);
|
||||||
|
sla::reproject_points_and_holes(model.objects[obj_idx]);
|
||||||
this->update();
|
this->update();
|
||||||
this->object_list_changed();
|
this->object_list_changed();
|
||||||
this->schedule_background_process();
|
this->schedule_background_process();
|
||||||
|
|
Loading…
Add table
Reference in a new issue