Tech ENABLE_TRANSFORMATIONS_BY_MATRICES - Allow for relative rotations only when using the object manipulator panel

This commit is contained in:
enricoturri1966 2022-05-12 14:33:41 +02:00
parent 3fcfd04921
commit 243985173e

View File

@ -677,9 +677,16 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
else { else {
#if ENABLE_WORLD_COORDINATE #if ENABLE_WORLD_COORDINATE
m_new_move_label_string = L("Translate"); m_new_move_label_string = L("Translate");
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_rotate_label_string = L("Rotate");
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_position = Vec3d::Zero(); m_new_position = Vec3d::Zero();
#endif // ENABLE_WORLD_COORDINATE #endif // ENABLE_WORLD_COORDINATE
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_rotation = Vec3d::Zero();
#else
m_new_rotation = volume->get_instance_rotation() * (180.0 / M_PI); m_new_rotation = volume->get_instance_rotation() * (180.0 / M_PI);
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_size = volume->get_instance_scaling_factor().cwiseProduct(wxGetApp().model().objects[volume->object_idx()]->raw_mesh_bounding_box().size()); m_new_size = volume->get_instance_scaling_factor().cwiseProduct(wxGetApp().model().objects[volume->object_idx()]->raw_mesh_bounding_box().size());
m_new_scale = volume->get_instance_scaling_factor() * 100.0; m_new_scale = volume->get_instance_scaling_factor() * 100.0;
} }
@ -728,8 +735,15 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
} }
else if (is_local_coordinates()) { else if (is_local_coordinates()) {
m_new_move_label_string = L("Translate"); m_new_move_label_string = L("Translate");
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_rotate_label_string = L("Rotate");
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_position = Vec3d::Zero(); m_new_position = Vec3d::Zero();
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_rotation = Vec3d::Zero();
#else
m_new_rotation = volume->get_volume_rotation() * (180.0 / M_PI); m_new_rotation = volume->get_volume_rotation() * (180.0 / M_PI);
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
m_new_scale = volume->get_volume_scaling_factor() * 100.0; m_new_scale = volume->get_volume_scaling_factor() * 100.0;
m_new_size = volume->get_volume_scaling_factor().cwiseProduct(volume->bounding_box().size()); m_new_size = volume->get_volume_scaling_factor().cwiseProduct(volume->bounding_box().size());
} }
@ -1178,19 +1192,27 @@ void ObjectManipulation::change_rotation_value(int axis, double value)
GLCanvas3D* canvas = wxGetApp().plater()->canvas3D(); GLCanvas3D* canvas = wxGetApp().plater()->canvas3D();
Selection& selection = canvas->get_selection(); Selection& selection = canvas->get_selection();
TransformationType transformation_type(TransformationType::World_Relative_Joint);
#if ENABLE_WORLD_COORDINATE #if ENABLE_WORLD_COORDINATE
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
TransformationType transformation_type;
transformation_type.set_relative();
#else
TransformationType transformation_type(TransformationType::World_Relative_Joint);
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
if (selection.is_single_full_instance()) if (selection.is_single_full_instance())
transformation_type.set_independent(); transformation_type.set_independent();
if (is_local_coordinates()) { if (is_local_coordinates()) {
transformation_type.set_local(); transformation_type.set_local();
#if !ENABLE_TRANSFORMATIONS_BY_MATRICES
transformation_type.set_absolute(); transformation_type.set_absolute();
#endif // !ENABLE_TRANSFORMATIONS_BY_MATRICES
} }
if (is_instance_coordinates()) if (is_instance_coordinates())
transformation_type.set_instance(); transformation_type.set_instance();
#else #else
TransformationType transformation_type(TransformationType::World_Relative_Joint);
if (selection.is_single_full_instance() || selection.requires_local_axes()) if (selection.is_single_full_instance() || selection.requires_local_axes())
transformation_type.set_independent(); transformation_type.set_independent();
if (selection.is_single_full_instance() && ! m_world_coordinates) { if (selection.is_single_full_instance() && ! m_world_coordinates) {