Another fix on volumes translation
This commit is contained in:
parent
918cb48d45
commit
2548253d59
@ -1549,7 +1549,7 @@ void GLCanvas3D::Selection::start_dragging()
|
|||||||
_set_caches();
|
_set_caches();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::Selection::translate(const Vec3d& displacement)
|
void GLCanvas3D::Selection::translate(const Vec3d& displacement, bool local)
|
||||||
{
|
{
|
||||||
if (!m_valid)
|
if (!m_valid)
|
||||||
return;
|
return;
|
||||||
@ -1559,7 +1559,7 @@ void GLCanvas3D::Selection::translate(const Vec3d& displacement)
|
|||||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||||
if ((m_mode == Volume) || (*m_volumes)[i]->is_wipe_tower)
|
if ((m_mode == Volume) || (*m_volumes)[i]->is_wipe_tower)
|
||||||
{
|
{
|
||||||
if (_requires_local_axes())
|
if (local)
|
||||||
(*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
|
(*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1614,7 +1614,7 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
|
|||||||
else if (is_single_volume() || is_single_modifier())
|
else if (is_single_volume() || is_single_modifier())
|
||||||
#if ENABLE_WORLD_ROTATIONS
|
#if ENABLE_WORLD_ROTATIONS
|
||||||
{
|
{
|
||||||
if (_requires_local_axes())
|
if (requires_local_axes())
|
||||||
(*m_volumes)[i]->set_volume_rotation(rotation);
|
(*m_volumes)[i]->set_volume_rotation(rotation);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2118,6 +2118,11 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
|
|||||||
}
|
}
|
||||||
#endif // ENABLE_SIDEBAR_VISUAL_HINTS
|
#endif // ENABLE_SIDEBAR_VISUAL_HINTS
|
||||||
|
|
||||||
|
bool GLCanvas3D::Selection::requires_local_axes() const
|
||||||
|
{
|
||||||
|
return (m_mode == Volume) && is_from_single_instance();
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::Selection::_update_valid()
|
void GLCanvas3D::Selection::_update_valid()
|
||||||
{
|
{
|
||||||
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
|
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
|
||||||
@ -2746,11 +2751,6 @@ void GLCanvas3D::Selection::_ensure_on_bed()
|
|||||||
}
|
}
|
||||||
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
||||||
|
|
||||||
bool GLCanvas3D::Selection::_requires_local_axes() const
|
|
||||||
{
|
|
||||||
return (m_mode == Volume) && is_from_single_instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
const float GLCanvas3D::Gizmos::OverlayIconsScale = 1.0f;
|
const float GLCanvas3D::Gizmos::OverlayIconsScale = 1.0f;
|
||||||
const float GLCanvas3D::Gizmos::OverlayBorder = 5.0f;
|
const float GLCanvas3D::Gizmos::OverlayBorder = 5.0f;
|
||||||
const float GLCanvas3D::Gizmos::OverlayGapY = 5.0f * OverlayIconsScale;
|
const float GLCanvas3D::Gizmos::OverlayGapY = 5.0f * OverlayIconsScale;
|
||||||
|
@ -578,7 +578,7 @@ public:
|
|||||||
|
|
||||||
void start_dragging();
|
void start_dragging();
|
||||||
|
|
||||||
void translate(const Vec3d& displacement);
|
void translate(const Vec3d& displacement, bool local = false);
|
||||||
void rotate(const Vec3d& rotation, bool local);
|
void rotate(const Vec3d& rotation, bool local);
|
||||||
void flattening_rotate(const Vec3d& normal);
|
void flattening_rotate(const Vec3d& normal);
|
||||||
void scale(const Vec3d& scale, bool local);
|
void scale(const Vec3d& scale, bool local);
|
||||||
@ -597,6 +597,8 @@ public:
|
|||||||
void render_sidebar_hints(const std::string& sidebar_field) const;
|
void render_sidebar_hints(const std::string& sidebar_field) const;
|
||||||
#endif // ENABLE_SIDEBAR_VISUAL_HINTS
|
#endif // ENABLE_SIDEBAR_VISUAL_HINTS
|
||||||
|
|
||||||
|
bool requires_local_axes() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _update_valid();
|
void _update_valid();
|
||||||
void _update_type();
|
void _update_type();
|
||||||
@ -626,7 +628,6 @@ public:
|
|||||||
#if ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
#if ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
||||||
void _ensure_on_bed();
|
void _ensure_on_bed();
|
||||||
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
||||||
bool _requires_local_axes() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClippingPlane
|
class ClippingPlane
|
||||||
|
@ -361,8 +361,9 @@ void ObjectManipulation::update_rotation_value(const Vec3d& rotation)
|
|||||||
void ObjectManipulation::change_position_value(const Vec3d& position)
|
void ObjectManipulation::change_position_value(const Vec3d& position)
|
||||||
{
|
{
|
||||||
auto canvas = wxGetApp().plater()->canvas3D();
|
auto canvas = wxGetApp().plater()->canvas3D();
|
||||||
canvas->get_selection().start_dragging();
|
GLCanvas3D::Selection& selection = canvas->get_selection();
|
||||||
canvas->get_selection().translate(position - cache_position);
|
selection.start_dragging();
|
||||||
|
selection.translate(position - cache_position, selection.requires_local_axes());
|
||||||
canvas->do_move();
|
canvas->do_move();
|
||||||
|
|
||||||
cache_position = position;
|
cache_position = position;
|
||||||
|
Loading…
Reference in New Issue
Block a user