Merge branch 'master' into fs_emboss
This commit is contained in:
commit
735edf7990
8 changed files with 34 additions and 40 deletions
|
@ -705,7 +705,7 @@ bool CLI::setup(int argc, char **argv)
|
||||||
|
|
||||||
// Initialize with defaults.
|
// Initialize with defaults.
|
||||||
for (const t_optiondef_map *options : { &cli_actions_config_def.options, &cli_transform_config_def.options, &cli_misc_config_def.options })
|
for (const t_optiondef_map *options : { &cli_actions_config_def.options, &cli_transform_config_def.options, &cli_misc_config_def.options })
|
||||||
for (const std::pair<t_config_option_key, ConfigOptionDef> &optdef : *options)
|
for (const t_optiondef_map::value_type &optdef : *options)
|
||||||
m_config.option(optdef.first, true);
|
m_config.option(optdef.first, true);
|
||||||
|
|
||||||
set_data_dir(m_config.opt_string("datadir"));
|
set_data_dir(m_config.opt_string("datadir"));
|
||||||
|
|
|
@ -577,7 +577,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template<class Level>
|
template<class Level>
|
||||||
Shapes calcnfp(const Item &trsh, Level)
|
Shapes calcnfp(const Item &/*trsh*/, Level)
|
||||||
{ // Function for arbitrary level of nfp implementation
|
{ // Function for arbitrary level of nfp implementation
|
||||||
|
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
|
|
|
@ -33,7 +33,8 @@ public:
|
||||||
PackResult(Item& item):
|
PackResult(Item& item):
|
||||||
item_ptr_(&item),
|
item_ptr_(&item),
|
||||||
move_(item.translation()),
|
move_(item.translation()),
|
||||||
rot_(item.rotation()) {}
|
rot_(item.rotation()),
|
||||||
|
overfit_(1.0) {}
|
||||||
|
|
||||||
PackResult(double overfit = 1.0):
|
PackResult(double overfit = 1.0):
|
||||||
item_ptr_(nullptr), overfit_(overfit) {}
|
item_ptr_(nullptr), overfit_(overfit) {}
|
||||||
|
|
|
@ -40,36 +40,6 @@ Point ConcaveHull::centroid(const Points &pp)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// As it shows, the current offset_ex in ClipperUtils hangs if used in jtRound
|
|
||||||
// mode
|
|
||||||
template<typename PolygonsProvider>
|
|
||||||
static ClipperLib::Paths fast_offset(PolygonsProvider &&paths,
|
|
||||||
coord_t delta,
|
|
||||||
ClipperLib::JoinType jointype)
|
|
||||||
{
|
|
||||||
using ClipperLib::ClipperOffset;
|
|
||||||
using ClipperLib::etClosedPolygon;
|
|
||||||
using ClipperLib::Paths;
|
|
||||||
using ClipperLib::Path;
|
|
||||||
|
|
||||||
ClipperOffset offs;
|
|
||||||
offs.ArcTolerance = scaled<double>(0.01);
|
|
||||||
|
|
||||||
for (auto &p : paths)
|
|
||||||
// If the input is not at least a triangle, we can not do this algorithm
|
|
||||||
if(p.size() < 3) {
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "Invalid geometry for offsetting!";
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
offs.AddPaths(std::forward<PolygonsProvider>(paths), jointype, etClosedPolygon);
|
|
||||||
|
|
||||||
Paths result;
|
|
||||||
offs.Execute(result, static_cast<double>(delta));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Points ConcaveHull::calculate_centroids() const
|
Points ConcaveHull::calculate_centroids() const
|
||||||
{
|
{
|
||||||
// We get the centroids of all the islands in the 2D slice
|
// We get the centroids of all the islands in the 2D slice
|
||||||
|
@ -158,15 +128,17 @@ ExPolygons ConcaveHull::to_expolygons() const
|
||||||
|
|
||||||
ExPolygons offset_waffle_style_ex(const ConcaveHull &hull, coord_t delta)
|
ExPolygons offset_waffle_style_ex(const ConcaveHull &hull, coord_t delta)
|
||||||
{
|
{
|
||||||
ExPolygons ret = ClipperPaths_to_Slic3rExPolygons(
|
return to_expolygons(offset_waffle_style(hull, delta));
|
||||||
fast_offset(fast_offset(ClipperUtils::PolygonsProvider(hull.polygons()), 2 * delta, ClipperLib::jtRound), -delta, ClipperLib::jtRound));
|
|
||||||
for (ExPolygon &p : ret) p.holes.clear();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygons offset_waffle_style(const ConcaveHull &hull, coord_t delta)
|
Polygons offset_waffle_style(const ConcaveHull &hull, coord_t delta)
|
||||||
{
|
{
|
||||||
return to_polygons(offset_waffle_style_ex(hull, delta));
|
Polygons res = closing(hull.polygons(), 2 * delta, delta, ClipperLib::jtRound);
|
||||||
|
|
||||||
|
auto it = std::remove_if(res.begin(), res.end(), [](Polygon &p) { return p.is_clockwise(); });
|
||||||
|
res.erase(it, res.end());
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::sla
|
}} // namespace Slic3r::sla
|
||||||
|
|
|
@ -1216,7 +1216,7 @@ DynamicConfig SLAPrintStatistics::config() const
|
||||||
DynamicConfig SLAPrintStatistics::placeholders()
|
DynamicConfig SLAPrintStatistics::placeholders()
|
||||||
{
|
{
|
||||||
DynamicConfig config;
|
DynamicConfig config;
|
||||||
for (const std::string &key : {
|
for (const char *key : {
|
||||||
"print_time", "total_cost", "total_weight",
|
"print_time", "total_cost", "total_weight",
|
||||||
"objects_used_material", "support_used_material" })
|
"objects_used_material", "support_used_material" })
|
||||||
config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}"));
|
config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}"));
|
||||||
|
|
|
@ -2568,12 +2568,15 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||||
if (camera_space) {
|
if (camera_space) {
|
||||||
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> inv_view_3x3 = wxGetApp().plater()->get_camera().get_view_matrix().inverse().matrix().block(0, 0, 3, 3);
|
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> inv_view_3x3 = wxGetApp().plater()->get_camera().get_view_matrix().inverse().matrix().block(0, 0, 3, 3);
|
||||||
displacement = multiplier * (inv_view_3x3 * direction);
|
displacement = multiplier * (inv_view_3x3 * direction);
|
||||||
displacement(2) = 0.0;
|
displacement.z() = 0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
displacement = multiplier * direction;
|
displacement = multiplier * direction;
|
||||||
|
|
||||||
m_selection.translate(displacement);
|
m_selection.translate(displacement);
|
||||||
|
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
|
m_selection.stop_dragging();
|
||||||
|
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2672,6 +2675,9 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||||
auto do_rotate = [this](double angle_z_rad) {
|
auto do_rotate = [this](double angle_z_rad) {
|
||||||
m_selection.start_dragging();
|
m_selection.start_dragging();
|
||||||
m_selection.rotate(Vec3d(0.0, 0.0, angle_z_rad), TransformationType(TransformationType::World_Relative_Joint));
|
m_selection.rotate(Vec3d(0.0, 0.0, angle_z_rad), TransformationType(TransformationType::World_Relative_Joint));
|
||||||
|
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
|
m_selection.stop_dragging();
|
||||||
|
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
// wxGetApp().obj_manipul()->set_dirty();
|
// wxGetApp().obj_manipul()->set_dirty();
|
||||||
};
|
};
|
||||||
|
|
|
@ -820,6 +820,9 @@ void ObjectManipulation::change_position_value(int axis, double value)
|
||||||
Selection& selection = canvas->get_selection();
|
Selection& selection = canvas->get_selection();
|
||||||
selection.start_dragging();
|
selection.start_dragging();
|
||||||
selection.translate(position - m_cache.position, selection.requires_local_axes());
|
selection.translate(position - m_cache.position, selection.requires_local_axes());
|
||||||
|
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
|
selection.stop_dragging();
|
||||||
|
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
canvas->do_move(L("Set Position"));
|
canvas->do_move(L("Set Position"));
|
||||||
|
|
||||||
m_cache.position = position;
|
m_cache.position = position;
|
||||||
|
@ -851,6 +854,9 @@ void ObjectManipulation::change_rotation_value(int axis, double value)
|
||||||
selection.rotate(
|
selection.rotate(
|
||||||
(M_PI / 180.0) * (transformation_type.absolute() ? rotation : rotation - m_cache.rotation),
|
(M_PI / 180.0) * (transformation_type.absolute() ? rotation : rotation - m_cache.rotation),
|
||||||
transformation_type);
|
transformation_type);
|
||||||
|
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
|
selection.stop_dragging();
|
||||||
|
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
canvas->do_rotate(L("Set Orientation"));
|
canvas->do_rotate(L("Set Orientation"));
|
||||||
|
|
||||||
m_cache.rotation = rotation;
|
m_cache.rotation = rotation;
|
||||||
|
@ -923,6 +929,9 @@ void ObjectManipulation::do_scale(int axis, const Vec3d &scale) const
|
||||||
|
|
||||||
selection.start_dragging();
|
selection.start_dragging();
|
||||||
selection.scale(scaling_factor, transformation_type);
|
selection.scale(scaling_factor, transformation_type);
|
||||||
|
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
|
selection.stop_dragging();
|
||||||
|
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale"));
|
wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -723,6 +723,12 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||||
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
|
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
|
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
|
else if (evt.LeftUp()) {
|
||||||
|
selection.stop_dragging();
|
||||||
|
wxGetApp().obj_manipul()->set_dirty();
|
||||||
|
}
|
||||||
|
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// mouse inside toolbar
|
// mouse inside toolbar
|
||||||
|
|
Loading…
Add table
Reference in a new issue