Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Faster update of object manipulation fields while dragging gizmo Move/Rotate/Scale

This commit is contained in:
enricoturri1966 2021-10-04 08:30:04 +02:00
parent f84838028b
commit 45db1c13ba
4 changed files with 26 additions and 1 deletions

View file

@ -3215,6 +3215,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
} }
} }
else if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) { else if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) {
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (evt.LeftUp())
m_selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (m_layers_editing.state != LayersEditing::Unknown) { if (m_layers_editing.state != LayersEditing::Unknown) {
m_layers_editing.state = LayersEditing::Unknown; m_layers_editing.state = LayersEditing::Unknown;
_stop_timer(); _stop_timer();

View file

@ -631,7 +631,6 @@ void ObjectManipulation::update_if_dirty()
update(m_cache.rotation, m_cache.rotation_rounded, meRotation, m_new_rotation); update(m_cache.rotation, m_cache.rotation_rounded, meRotation, m_new_rotation);
} }
if (selection.requires_uniform_scale()) { if (selection.requires_uniform_scale()) {
m_lock_bnt->SetLock(true); m_lock_bnt->SetLock(true);
m_lock_bnt->SetToolTip(_L("You cannot use non-uniform scaling mode for multiple objects/parts selection")); m_lock_bnt->SetToolTip(_L("You cannot use non-uniform scaling mode for multiple objects/parts selection"));
@ -654,8 +653,14 @@ void ObjectManipulation::update_if_dirty()
else else
m_og->disable(); m_og->disable();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (!selection.is_dragging()) {
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
update_reset_buttons_visibility(); update_reset_buttons_visibility();
update_mirror_buttons_visibility(); update_mirror_buttons_visibility();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
}
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_dirty = false; m_dirty = false;
} }

View file

@ -112,6 +112,9 @@ Selection::Selection()
, m_type(Empty) , m_type(Empty)
, m_valid(false) , m_valid(false)
, m_scale_factor(1.0f) , m_scale_factor(1.0f)
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
, m_dragging(false)
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
{ {
this->set_bounding_boxes_dirty(); this->set_bounding_boxes_dirty();
} }
@ -676,6 +679,10 @@ void Selection::start_dragging()
if (!m_valid) if (!m_valid)
return; return;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_dragging = true;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
set_caches(); set_caches();
} }

View file

@ -220,6 +220,10 @@ private:
float m_scale_factor; float m_scale_factor;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool m_dragging;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
public: public:
Selection(); Selection();
@ -312,6 +316,10 @@ public:
const BoundingBoxf3& get_scaled_instance_bounding_box() const; const BoundingBoxf3& get_scaled_instance_bounding_box() const;
void start_dragging(); void start_dragging();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
void stop_dragging() { m_dragging = false; }
bool is_dragging() const { return m_dragging; }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
void translate(const Vec3d& displacement, bool local = false); void translate(const Vec3d& displacement, bool local = false);
void rotate(const Vec3d& rotation, TransformationType transformation_type); void rotate(const Vec3d& rotation, TransformationType transformation_type);