World rotations set as default

This commit is contained in:
Enrico Turri 2019-01-21 11:55:02 +01:00
parent 060fac5e55
commit a8d407b27e
3 changed files with 0 additions and 31 deletions

View file

@ -19,8 +19,6 @@
#define ENABLE_USE_UNIQUE_GLCONTEXT (1 && ENABLE_1_42_0_ALPHA1)
// Disable synchronization of unselected instances
#define DISABLE_INSTANCES_SYNCH (0 && ENABLE_1_42_0_ALPHA1)
// All rotations made using the rotate gizmo are done with respect to the world reference system
#define ENABLE_WORLD_ROTATIONS (1 && ENABLE_1_42_0_ALPHA1)
// Scene's GUI made using imgui library
#define ENABLE_IMGUI (1 && ENABLE_1_42_0_ALPHA1)
#define DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI (1 && ENABLE_IMGUI)

View file

@ -1708,7 +1708,6 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
for (unsigned int i : m_list)
{
if (is_single_full_instance())
#if ENABLE_WORLD_ROTATIONS
{
if (local)
(*m_volumes)[i]->set_instance_rotation(rotation);
@ -1719,11 +1718,7 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
(*m_volumes)[i]->set_instance_rotation(new_rotation);
}
}
#else
(*m_volumes)[i]->set_instance_rotation(rotation);
#endif // ENABLE_WORLD_ROTATIONS
else if (is_single_volume() || is_single_modifier())
#if ENABLE_WORLD_ROTATIONS
{
if (local)
(*m_volumes)[i]->set_volume_rotation(rotation);
@ -1734,9 +1729,6 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
(*m_volumes)[i]->set_volume_rotation(new_rotation);
}
}
#else
(*m_volumes)[i]->set_volume_rotation(rotation);
#endif // ENABLE_WORLD_ROTATIONS
else
{
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
@ -5432,9 +5424,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
break;
}
m_gizmos.stop_dragging();
#if ENABLE_WORLD_ROTATIONS
_update_gizmos_data();
#endif // ENABLE_WORLD_ROTATIONS
wxGetApp().obj_manipul()->update_settings_value(m_selection);
// Let the platter know that the dragging finished, so a delayed refresh
@ -6764,11 +6754,7 @@ void GLCanvas3D::_update_gizmos_data()
// all volumes in the selection belongs to the same instance, any of them contains the needed data, so we take the first
const GLVolume* volume = m_volumes.volumes[*m_selection.get_volume_idxs().begin()];
m_gizmos.set_scale(volume->get_instance_scaling_factor());
#if ENABLE_WORLD_ROTATIONS
m_gizmos.set_rotation(Vec3d::Zero());
#else
m_gizmos.set_rotation(volume->get_instance_rotation());
#endif // ENABLE_WORLD_ROTATIONS
ModelObject* model_object = m_model->objects[m_selection.get_object_idx()];
m_gizmos.set_flattening_data(model_object);
#if ENABLE_SLA_SUPPORT_GIZMO_MOD
@ -6781,11 +6767,7 @@ void GLCanvas3D::_update_gizmos_data()
{
const GLVolume* volume = m_volumes.volumes[*m_selection.get_volume_idxs().begin()];
m_gizmos.set_scale(volume->get_volume_scaling_factor());
#if ENABLE_WORLD_ROTATIONS
m_gizmos.set_rotation(Vec3d::Zero());
#else
m_gizmos.set_rotation(volume->get_volume_rotation());
#endif // ENABLE_WORLD_ROTATIONS
m_gizmos.set_flattening_data(nullptr);
#if ENABLE_SLA_SUPPORT_GIZMO_MOD
m_gizmos.set_sla_support_data(nullptr, m_selection);

View file

@ -409,9 +409,6 @@ void GLGizmoRotate::on_render(const GLCanvas3D::Selection& selection) const
return;
const BoundingBoxf3& box = selection.get_bounding_box();
#if !ENABLE_WORLD_ROTATIONS
bool single_selection = selection.is_single_full_instance() || selection.is_single_modifier() || selection.is_single_volume();
#endif // !ENABLE_WORLD_ROTATIONS
std::string axis;
switch (m_axis)
@ -421,13 +418,9 @@ void GLGizmoRotate::on_render(const GLCanvas3D::Selection& selection) const
case Z: { axis = "Z"; break; }
}
#if ENABLE_WORLD_ROTATIONS
if (!m_dragging && (m_hover_id == 0))
set_tooltip(axis);
else if (m_dragging)
#else
if ((single_selection && (m_hover_id == 0)) || m_dragging)
#endif // ENABLE_WORLD_ROTATIONS
set_tooltip(axis + ": " + format((float)Geometry::rad2deg(m_angle), 4) + "\u00B0");
else
{
@ -571,11 +564,7 @@ void GLGizmoRotate::render_angle() const
void GLGizmoRotate::render_grabber(const BoundingBoxf3& box) const
{
#if ENABLE_WORLD_ROTATIONS
double grabber_radius = (double)m_radius * (1.0 + (double)GrabberOffset);
#else
double grabber_radius = (double)m_radius * (1.0 + (double)GrabberOffset) + 2.0 * (double)m_axis * (double)m_grabbers[0].get_half_size((float)box.max_size());
#endif // ENABLE_WORLD_ROTATIONS
m_grabbers[0].center = Vec3d(::cos(m_angle) * grabber_radius, ::sin(m_angle) * grabber_radius, 0.0);
m_grabbers[0].angles(2) = m_angle;