Merge branch 'master' into fs_emboss
# Conflicts: # src/libslic3r/Technologies.hpp # src/slic3r/GUI/GLCanvas3D.cpp
This commit is contained in:
commit
fce4f1f24e
@ -10,7 +10,6 @@ namespace Measure {
|
||||
|
||||
|
||||
constexpr double feature_hover_limit = 0.5; // how close to a feature the mouse must be to highlight it
|
||||
constexpr double edge_endpoint_limit = 0.5; // how close to an edge endpoint the mouse ...
|
||||
|
||||
static std::pair<Vec3d, double> get_center_and_radius(const std::vector<Vec3d>& border, int start_idx, int end_idx, const Transform3d& trafo)
|
||||
{
|
||||
@ -467,6 +466,8 @@ std::optional<SurfaceFeature> MeasuringImpl::get_feature(size_t face_idx, const
|
||||
MeasurementResult res;
|
||||
SurfaceFeature point_sf(point);
|
||||
|
||||
assert(plane.surface_features.empty() || plane.surface_features.back().get_type() == SurfaceFeatureType::Plane);
|
||||
|
||||
for (size_t i=0; i<plane.surface_features.size() - 1; ++i) {
|
||||
// The -1 is there to prevent measuring distance to the plane itself,
|
||||
// which is needless and relatively expensive.
|
||||
@ -484,9 +485,12 @@ std::optional<SurfaceFeature> MeasuringImpl::get_feature(size_t face_idx, const
|
||||
const SurfaceFeature& f = plane.surface_features[closest_feature_idx];
|
||||
if (f.get_type() == SurfaceFeatureType::Edge) {
|
||||
// If this is an edge, check if we are not close to the endpoint. If so,
|
||||
// we will include the endpoint as well.
|
||||
constexpr double limit_sq = edge_endpoint_limit * edge_endpoint_limit;
|
||||
// we will include the endpoint as well. Close = 10% of the lenghth of
|
||||
// the edge, clamped between 0.025 and 0.5 mm.
|
||||
const auto& [sp, ep] = f.get_edge();
|
||||
double len_sq = (ep-sp).squaredNorm();
|
||||
double limit_sq = std::max(0.025*0.025, std::min(0.5*0.5, 0.1 * 0.1 * len_sq));
|
||||
|
||||
if ((point-sp).squaredNorm() < limit_sq)
|
||||
return std::make_optional(SurfaceFeature(sp));
|
||||
if ((point-ep).squaredNorm() < limit_sq)
|
||||
|
@ -55,8 +55,6 @@
|
||||
#define ENABLE_RELOAD_FROM_DISK_REWORK (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable editing volumes transformation in world coordinates and instances in local coordinates
|
||||
#define ENABLE_WORLD_COORDINATE (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable modified camera control using mouse
|
||||
#define ENABLE_NEW_CAMERA_MOVEMENTS (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable alternative version of file_wildcards()
|
||||
#define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable processing of gcode G2 and G3 lines
|
||||
|
@ -2997,7 +2997,6 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||
// set_cursor(Standard);
|
||||
}
|
||||
else if (keyCode == WXK_CONTROL) {
|
||||
#if ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
#if ENABLE_RAYCAST_PICKING
|
||||
if (m_mouse.dragging && !m_moving) {
|
||||
#else
|
||||
@ -3008,7 +3007,6 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||
m_mouse.drag.move_volume_idx = -1;
|
||||
m_mouse.set_start_position_3D_as_invalid();
|
||||
}
|
||||
#endif // ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
m_ctrl_kar_filter.reset_count();
|
||||
m_dirty = true;
|
||||
}
|
||||
@ -3515,10 +3513,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
m_volumes.volumes[volume_idx]->hover = GLVolume::HS_None;
|
||||
// The dragging operation is initiated.
|
||||
m_mouse.drag.move_volume_idx = volume_idx;
|
||||
#if ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
m_selection.setup_cache();
|
||||
if (!evt.CmdDown())
|
||||
#endif // ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
m_mouse.drag.start_position_3D = m_mouse.scene_position;
|
||||
m_sequential_print_clearance_first_displacement = true;
|
||||
#if !ENABLE_RAYCAST_PICKING
|
||||
@ -3529,12 +3525,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
else if (evt.Dragging() && evt.LeftIsDown() && !evt.CmdDown() && m_layers_editing.state == LayersEditing::Unknown &&
|
||||
m_mouse.drag.move_volume_idx != -1 && m_mouse.is_start_position_3D_defined()) {
|
||||
#else
|
||||
else if (evt.Dragging() && evt.LeftIsDown() && m_layers_editing.state == LayersEditing::Unknown && m_mouse.drag.move_volume_idx != -1) {
|
||||
#endif // ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
if (!m_mouse.drag.move_requires_threshold) {
|
||||
m_mouse.dragging = true;
|
||||
Vec3d cur_pos = m_mouse.drag.start_position_3D;
|
||||
@ -3602,18 +3594,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
}
|
||||
}
|
||||
// do not process the dragging if the left mouse was set down in another canvas
|
||||
#if ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
else if (evt.LeftIsDown()) {
|
||||
// if dragging over blank area with left button, rotate
|
||||
#if ENABLE_RAYCAST_PICKING
|
||||
if (!m_moving) {
|
||||
#endif // ENABLE_RAYCAST_PICKING
|
||||
if ((any_gizmo_active || evt.CmdDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
|
||||
#else
|
||||
// if dragging over blank area with left button, rotate
|
||||
else if (evt.LeftIsDown()) {
|
||||
if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
|
||||
#endif // ENABLE_NEW_CAMERA_MOVEMENTS
|
||||
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.0) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.0);
|
||||
if (wxGetApp().app_config->get("use_free_camera") == "1")
|
||||
// Virtual track ball (similar to the 3DConnexion mouse).
|
||||
@ -6745,6 +6731,10 @@ void GLCanvas3D::_render_selection_sidebar_hints()
|
||||
|
||||
void GLCanvas3D::_update_volumes_hover_state()
|
||||
{
|
||||
// skip update if the Gizmo Measure is active
|
||||
if (m_gizmos.get_current_type() == GLGizmosManager::Measure)
|
||||
return;
|
||||
|
||||
for (GLVolume* v : m_volumes.volumes) {
|
||||
v->hover = GLVolume::HS_None;
|
||||
}
|
||||
@ -6752,9 +6742,9 @@ void GLCanvas3D::_update_volumes_hover_state()
|
||||
if (m_hover_volume_idxs.empty())
|
||||
return;
|
||||
|
||||
bool ctrl_pressed = wxGetKeyState(WXK_CONTROL); // additive select/deselect
|
||||
bool shift_pressed = wxGetKeyState(WXK_SHIFT); // select by rectangle
|
||||
bool alt_pressed = wxGetKeyState(WXK_ALT); // deselect by rectangle
|
||||
const bool ctrl_pressed = wxGetKeyState(WXK_CONTROL);
|
||||
const bool shift_pressed = wxGetKeyState(WXK_SHIFT);
|
||||
const bool alt_pressed = wxGetKeyState(WXK_ALT);
|
||||
|
||||
if (alt_pressed && (shift_pressed || ctrl_pressed)) {
|
||||
// illegal combinations of keys
|
||||
@ -6789,22 +6779,22 @@ void GLCanvas3D::_update_volumes_hover_state()
|
||||
if (volume.hover != GLVolume::HS_None)
|
||||
continue;
|
||||
|
||||
bool deselect = volume.selected && ((shift_pressed && m_rectangle_selection.is_empty()) || (alt_pressed && !m_rectangle_selection.is_empty()));
|
||||
bool select = !volume.selected && (m_rectangle_selection.is_empty() || (shift_pressed && !m_rectangle_selection.is_empty()));
|
||||
const bool deselect = volume.selected && ((shift_pressed && m_rectangle_selection.is_empty()) || (alt_pressed && !m_rectangle_selection.is_empty()));
|
||||
const bool select = !volume.selected && (m_rectangle_selection.is_empty() || (shift_pressed && !m_rectangle_selection.is_empty()));
|
||||
|
||||
if (select || deselect) {
|
||||
bool as_volume =
|
||||
const bool as_volume =
|
||||
volume.is_modifier && hover_from_single_instance && !ctrl_pressed &&
|
||||
(
|
||||
(!deselect) ||
|
||||
(deselect && !m_selection.is_single_full_instance() && (volume.object_idx() == m_selection.get_object_idx()) && (volume.instance_idx() == m_selection.get_instance_idx()))
|
||||
!deselect ||
|
||||
(deselect && !m_selection.is_single_full_instance() && volume.object_idx() == m_selection.get_object_idx() && volume.instance_idx() == m_selection.get_instance_idx())
|
||||
);
|
||||
|
||||
if (as_volume)
|
||||
volume.hover = deselect ? GLVolume::HS_Deselect : GLVolume::HS_Select;
|
||||
else {
|
||||
int object_idx = volume.object_idx();
|
||||
int instance_idx = volume.instance_idx();
|
||||
const int object_idx = volume.object_idx();
|
||||
const int instance_idx = volume.instance_idx();
|
||||
|
||||
for (GLVolume* v : m_volumes.volumes) {
|
||||
if (v->object_idx() == object_idx && v->instance_idx() == instance_idx)
|
||||
|
@ -310,6 +310,10 @@ bool GLGizmoMeasure::on_mouse(const wxMouseEvent &mouse_event)
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
// if the mouse pointer is on any volume, filter out the event to prevent the user to move it
|
||||
// equivalent tp: return (m_parent.get_first_hover_volume_idx() != -1);
|
||||
return m_curr_feature.has_value();
|
||||
|
||||
// fix: prevent restart gizmo when reselect object
|
||||
// take responsibility for left up
|
||||
@ -401,6 +405,7 @@ void GLGizmoMeasure::on_set_state()
|
||||
restore_scene_raycasters_state();
|
||||
m_editing_distance = false;
|
||||
m_is_editing_distance_first_frame = true;
|
||||
m_measuring.reset();
|
||||
}
|
||||
else {
|
||||
m_mode = EMode::BasicSelection;
|
||||
|
@ -86,7 +86,7 @@ void read_used_binary(std::vector<std::string>& ids)
|
||||
BOOST_LOG_TRIVIAL(warning) << "Failed to load to hints.cereal. File does not exists. " << path.string();
|
||||
return;
|
||||
}
|
||||
boost::nowide::ifstream file(path.string());
|
||||
boost::nowide::ifstream file(path.string(), std::ios::binary);
|
||||
cereal::BinaryInputArchive archive(file);
|
||||
HintsCerealData cd;
|
||||
try
|
||||
|
@ -228,35 +228,6 @@ int SceneRaycaster::base_id(EType type)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if ENABLE_RAYCAST_PICKING_DEBUG
|
||||
size_t SceneRaycaster::active_beds_count() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (const auto& item : m_bed) {
|
||||
if (item->is_active()) ++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
size_t SceneRaycaster::active_volumes_count() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (const auto& item : m_volumes) {
|
||||
if (item->is_active()) ++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
size_t SceneRaycaster::active_gizmos_count() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (const auto& item : m_gizmos) {
|
||||
if (item->is_active()) ++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif // ENABLE_RAYCAST_PICKING_DEBUG
|
||||
|
||||
int SceneRaycaster::encode_id(EType type, int id) { return base_id(type) + id; }
|
||||
int SceneRaycaster::decode_id(EType type, int id) { return id - base_id(type); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user