Tech ENABLE_TRANSFORMATIONS_BY_MATRICES - Allow skew in matrices

Fixed conflicts during rebase with master
This commit is contained in:
enricoturri1966 2022-05-05 10:12:16 +02:00
parent 63c9ce23df
commit b5d366d385
2 changed files with 28 additions and 4 deletions

View File

@ -1289,6 +1289,7 @@ void ObjectManipulation::set_uniform_scaling(const bool use_uniform_scale)
const Selection &selection = wxGetApp().plater()->canvas3D()->get_selection();
#if ENABLE_WORLD_COORDINATE_SCALE_REVISITED
if (!use_uniform_scale) {
#if !ENABLE_TRANSFORMATIONS_BY_MATRICES
int res = selection.bake_transform_if_needed();
if (res == -1) {
// Enforce uniform scaling.
@ -1296,6 +1297,7 @@ void ObjectManipulation::set_uniform_scaling(const bool use_uniform_scale)
return;
}
else if (res == 0)
#endif // !ENABLE_TRANSFORMATIONS_BY_MATRICES
// Recalculate cached values at this panel, refresh the screen.
this->UpdateAndShow(true);
}

View File

@ -75,14 +75,36 @@ bool GLGizmoScale3D::on_mouse(const wxMouseEvent &mouse_event)
{
if (mouse_event.Dragging()) {
if (m_dragging) {
#if !ENABLE_TRANSFORMATIONS_BY_MATRICES
#if ENABLE_WORLD_COORDINATE_SCALE_REVISITED
int res = 1;
if (m_scale.x() != m_scale.y() || m_scale.x() != m_scale.z())
res = m_parent.get_selection().bake_transform_if_needed();
if (res != 1) {
do_stop_dragging(true);
return true;
}
else {
#endif // ENABLE_WORLD_COORDINATE_SCALE_REVISITED
#endif // !ENABLE_TRANSFORMATIONS_BY_MATRICES
// Apply new temporary scale factors
TransformationType transformation_type(TransformationType::Local_Absolute_Joint);
if (mouse_event.AltDown()) transformation_type.set_independent();
Selection &selection = m_parent.get_selection();
selection.scale(get_scale(), transformation_type);
if (mouse_event.CmdDown()) selection.translate(m_offset, ECoordinatesType::Local);
}
Selection &selection = m_parent.get_selection();
selection.scale(m_scale, transformation_type);
#if ENABLE_WORLD_COORDINATE
if (mouse_event.CmdDown()) selection.translate(m_offset, wxGetApp().obj_manipul()->get_coordinates_type());
#else
if (mouse_event.CmdDown()) selection.translate(m_offset, true);
#endif // ENABLE_WORLD_COORDINATE
#if !ENABLE_TRANSFORMATIONS_BY_MATRICES
#if ENABLE_WORLD_COORDINATE_SCALE_REVISITED
}
#endif // ENABLE_WORLD_COORDINATE_SCALE_REVISITED
#endif // !ENABLE_TRANSFORMATIONS_BY_MATRICES
}
}
return use_grabbers(mouse_event);
}