Merge branch 'dev_native' of https://github.com/prusa3d/Slic3r into dev_native

This commit is contained in:
YuSanka 2018-10-15 10:54:20 +02:00
commit 27fea879d3
15 changed files with 314 additions and 219 deletions

View file

@ -389,14 +389,11 @@ const Transform3f& GLVolume::world_matrix() const
{
if (m_world_matrix_dirty)
{
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
m_world_matrix = Geometry::assemble_transform(m_offset, m_rotation, m_scaling_factor).cast<float>();
#else
m_world_matrix = Transform3f::Identity();
m_world_matrix.translate(m_offset.cast<float>());
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
m_world_matrix.rotate(Eigen::AngleAxisf((float)m_rotation(2), Vec3f::UnitZ()));
m_world_matrix.rotate(Eigen::AngleAxisf((float)m_rotation(1), Vec3f::UnitY()));
m_world_matrix.rotate(Eigen::AngleAxisf((float)m_rotation(0), Vec3f::UnitX()));
m_world_matrix.scale(m_scaling_factor.cast<float>());
#else
m_world_matrix.rotate(Eigen::AngleAxisf((float)m_rotation, Vec3f::UnitZ()));
m_world_matrix.scale((float)m_scaling_factor);
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM

View file

@ -10,6 +10,7 @@
#include "../../libslic3r/ClipperUtils.hpp"
#include "../../libslic3r/PrintConfig.hpp"
#include "../../libslic3r/GCode/PreviewData.hpp"
#include "../../libslic3r/Geometry.hpp"
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
#include "GUI_ObjectManipulation.hpp"
@ -1144,17 +1145,14 @@ GLCanvas3D::Selection::VolumeCache::VolumeCache(const Vec3d& position, const Vec
, m_rotation(rotation)
, m_scaling_factor(scaling_factor)
{
m_rotation_matrix = Transform3d::Identity();
m_rotation_matrix.rotate(Eigen::AngleAxisd(m_rotation(2), Vec3d::UnitZ()));
m_rotation_matrix.rotate(Eigen::AngleAxisd(m_rotation(1), Vec3d::UnitY()));
m_rotation_matrix.rotate(Eigen::AngleAxisd(m_rotation(0), Vec3d::UnitX()));
m_rotation_matrix = Geometry::assemble_transform(Vec3d::Zero(), m_rotation);
}
GLCanvas3D::Selection::Selection()
: m_volumes(nullptr)
, m_model(nullptr)
, m_mode(Instance)
, m_type(Invalid)
, m_type(Empty)
, m_valid(false)
, m_bounding_box_dirty(true)
{
@ -1409,46 +1407,48 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation)
if (!m_valid)
return;
Transform3d m = Transform3d::Identity();
if (rotation(2) != 0.0f)
m.rotate(Eigen::AngleAxisd(rotation(2), Vec3d::UnitZ()));
else if (rotation(1) != 0.0f)
m.rotate(Eigen::AngleAxisd(rotation(1), Vec3d::UnitY()));
else if (rotation(0) != 0.0f)
m.rotate(Eigen::AngleAxisd(rotation(0), Vec3d::UnitX()));
bool single_full_instance = is_single_full_instance();
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
for (unsigned int i : m_list)
{
Vec3d radius = m * (m_cache.volumes_data[i].get_position() - m_cache.dragging_center);
(*m_volumes)[i]->set_offset(m_cache.dragging_center + radius);
if (single_full_instance)
if (is_single_full_instance())
(*m_volumes)[i]->set_rotation(rotation);
else
{
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> new_rotation_matrix = (m * m_cache.volumes_data[i].get_rotation_matrix()).matrix().block(0, 0, 3, 3);
// extracts euler angles from the composed transformation
// not using Eigen eulerAngles() method because it returns weird results
// see: https://www.learnopencv.com/rotation-matrix-to-euler-angles/
double sy = ::sqrt(sqr(new_rotation_matrix(0, 0)) + sqr(new_rotation_matrix(1, 0)));
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> new_matrix = (m * m_cache.volumes_data[i].get_rotation_matrix()).matrix().block(0, 0, 3, 3);
Vec3d new_rotation = Geometry::extract_euler_angles(new_matrix);
Vec3d angles = Vec3d::Zero();
if (sy >= 1e-6)
{
angles(0) = ::atan2(new_rotation_matrix(2, 1), new_rotation_matrix(2, 2));
angles(1) = ::atan2(-new_rotation_matrix(2, 0), sy);
angles(2) = ::atan2(new_rotation_matrix(1, 0), new_rotation_matrix(0, 0));
}
else
{
angles(0) = ::atan2(-new_rotation_matrix(1, 2), new_rotation_matrix(1, 1));
angles(1) = ::atan2(-new_rotation_matrix(2, 0), sy);
angles(2) = 0.0;
}
(*m_volumes)[i]->set_offset(m_cache.dragging_center + m * (m_cache.volumes_data[i].get_position() - m_cache.dragging_center));
(*m_volumes)[i]->set_rotation(new_rotation);
}
}
(*m_volumes)[i]->set_rotation(Vec3d(angles(0), angles(1), angles(2)));
if (m_mode == Instance)
_synchronize_unselected_instances();
m_bounding_box_dirty = true;
}
void GLCanvas3D::Selection::scale(const Vec3d& scale)
{
if (!m_valid)
return;
Transform3d m = Transform3d::Identity();
m.scale(scale);
for (unsigned int i : m_list)
{
if (is_single_full_instance())
(*m_volumes)[i]->set_scaling_factor(scale);
else
{
Eigen::Matrix<double, 3, 3, Eigen::DontAlign> new_matrix = (m * m_cache.volumes_data[i].get_rotation_matrix()).matrix().block(0, 0, 3, 3);
// extracts scaling factors from the composed transformation
Vec3d new_scale(new_matrix.col(0).norm(), new_matrix.col(1).norm(), new_matrix.col(2).norm());
(*m_volumes)[i]->set_offset(m_cache.dragging_center + m * (m_cache.volumes_data[i].get_position() - m_cache.dragging_center));
(*m_volumes)[i]->set_scaling_factor(new_scale);
}
}
@ -2679,8 +2679,8 @@ wxDEFINE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent);
wxDEFINE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
wxDEFINE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDEFINE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent);
wxDEFINE_EVENT(EVT_GIZMO_ROTATE, Vec3dEvent);
#endif // !ENABLE_EXTENDED_SELECTION
wxDEFINE_EVENT(EVT_GIZMO_FLATTEN, Vec3dEvent);
@ -3236,6 +3236,11 @@ void GLCanvas3D::update_gizmos_data()
#if ENABLE_EXTENDED_SELECTION
bool enable_move_z = !m_selection.is_wipe_tower();
m_gizmos.enable_grabber(Gizmos::Move, 2, enable_move_z);
bool enable_scale_xyz = m_selection.is_single_full_instance();
for (int i = 0; i < 6; ++i)
{
m_gizmos.enable_grabber(Gizmos::Scale, i, enable_scale_xyz);
}
if (m_selection.is_single_full_instance())
{
@ -3818,11 +3823,21 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
case Gizmos::Scale:
{
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
#if ENABLE_EXTENDED_SELECTION
m_regenerate_volumes = false;
m_selection.scale(m_gizmos.get_scale());
_on_scale();
#else
post_event(Vec3dEvent(EVT_GIZMO_SCALE, m_gizmos.get_scale()));
#endif // ENABLE_EXTENDED_SELECTION
#else
m_on_gizmo_scale_uniformly_callback.call((double)m_gizmos.get_scale());
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
#if ENABLE_EXTENDED_SELECTION
wxGetApp().obj_manipul()->update_settings_value(m_selection);
#else
wxGetApp().obj_manipul()->update_scale_values();
#endif // ENABLE_EXTENDED_SELECTION
m_dirty = true;
break;
}
@ -3831,8 +3846,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
#if ENABLE_EXTENDED_SELECTION
m_regenerate_volumes = false;
const Vec3d& rotation = m_gizmos.get_rotation();
m_selection.rotate(rotation);
m_selection.rotate(m_gizmos.get_rotation());
_on_rotate();
#else
post_event(Vec3dEvent(EVT_GIZMO_ROTATE, std::move(m_gizmos.get_rotation())));
@ -4162,15 +4176,17 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
case Gizmos::Scale:
{
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
#if ENABLE_EXTENDED_SELECTION
#else
// Apply new temporary scale factors
#if ENABLE_EXTENDED_SELECTION
m_selection.scale(m_gizmos.get_scale());
wxGetApp().obj_manipul()->update_settings_value(m_selection);
#else
const Vec3d& scale = m_gizmos.get_scale();
for (GLVolume* v : volumes)
{
v->set_scaling_factor(scale);
}
wxGetApp().obj_manipul()->update_scale_values(scale);
wxGetApp().obj_manipul()->update_scale_value(scale);
#endif // ENABLE_EXTENDED_SELECTION
#else
// Apply new temporary scale factor
@ -4186,6 +4202,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
case Gizmos::Rotate:
{
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
// Apply new temporary rotations
#if ENABLE_EXTENDED_SELECTION
m_selection.rotate(m_gizmos.get_rotation());
wxGetApp().obj_manipul()->update_settings_value(m_selection);
@ -4372,7 +4389,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
case Gizmos::Scale:
{
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
post_event(Vec3dEvent(EVT_GIZMO_SCALE, m_gizmos.get_scale()));
#if ENABLE_EXTENDED_SELECTION
m_regenerate_volumes = false;
_on_scale();
#endif // ENABLE_EXTENDED_SELECTION
#else
m_on_gizmo_scale_uniformly_callback.call((double)m_gizmos.get_scale());
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
@ -6500,6 +6520,42 @@ void GLCanvas3D::_on_rotate()
// schedule_background_process
}
void GLCanvas3D::_on_scale()
{
if (m_model == nullptr)
return;
std::set<std::pair<int, int>> done; // prevent scaling instances twice
const Selection::IndicesList& selection = m_selection.get_volume_idxs();
for (unsigned int i : selection)
{
const GLVolume* v = m_volumes.volumes[i];
int object_idx = v->object_idx();
if (object_idx >= 1000)
continue;
int instance_idx = v->instance_idx();
// prevent rotating instances twice
std::pair<int, int> done_id(object_idx, instance_idx);
if (done.find(done_id) != done.end())
continue;
done.insert(done_id);
// Rotate instances.
ModelObject* model_object = m_model->objects[object_idx];
if (model_object != nullptr)
{
model_object->instances[instance_idx]->set_scaling_factor(v->get_scaling_factor());
model_object->invalidate_bounding_box();
}
}
// schedule_background_process
}
#else
void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
{

View file

@ -115,8 +115,8 @@ wxDECLARE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent);
wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event<bool>);
wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>);
wxDECLARE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent);
#if !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent);
wxDECLARE_EVENT(EVT_GIZMO_ROTATE, Vec3dEvent);
#endif // !ENABLE_EXTENDED_SELECTION
wxDECLARE_EVENT(EVT_GIZMO_FLATTEN, Vec3dEvent);
@ -491,6 +491,7 @@ public:
void translate(const Vec3d& displacement);
void rotate(const Vec3d& rotation);
void scale(const Vec3d& scale);
void render(bool show_indirect_selection) const;
@ -939,6 +940,7 @@ private:
#if ENABLE_EXTENDED_SELECTION
void _on_move();
void _on_rotate();
void _on_scale();
#else
void _on_move(const std::vector<int>& volume_idxs);
#endif // ENABLE_EXTENDED_SELECTION

View file

@ -118,7 +118,7 @@ GLGizmoBase::Grabber::Grabber()
color[2] = 1.0f;
}
void GLGizmoBase::Grabber::render(bool hover, const BoundingBoxf3& box) const
void GLGizmoBase::Grabber::render(bool hover, float size) const
{
float render_color[3];
if (hover)
@ -130,13 +130,12 @@ void GLGizmoBase::Grabber::render(bool hover, const BoundingBoxf3& box) const
else
::memcpy((void*)render_color, (const void*)color, 3 * sizeof(float));
render(box, render_color, true);
render(size, render_color, true);
}
void GLGizmoBase::Grabber::render(const BoundingBoxf3& box, const float* render_color, bool use_lighting) const
void GLGizmoBase::Grabber::render(float size, const float* render_color, bool use_lighting) const
{
float max_size = (float)box.max_size();
float half_size = dragging ? max_size * SizeFactor * DraggingScaleFactor : max_size * SizeFactor;
float half_size = dragging ? size * SizeFactor * DraggingScaleFactor : size * SizeFactor;
half_size = std::max(half_size, MinHalfSize);
if (use_lighting)
@ -300,15 +299,19 @@ float GLGizmoBase::picking_color_component(unsigned int id) const
void GLGizmoBase::render_grabbers(const BoundingBoxf3& box) const
{
float size = (float)box.max_size();
for (int i = 0; i < (int)m_grabbers.size(); ++i)
{
if (m_grabbers[i].enabled)
m_grabbers[i].render((m_hover_id == i), box);
m_grabbers[i].render((m_hover_id == i), size);
}
}
void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
{
float size = (float)box.max_size();
for (unsigned int i = 0; i < (unsigned int)m_grabbers.size(); ++i)
{
if (m_grabbers[i].enabled)
@ -316,7 +319,7 @@ void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
m_grabbers[i].color[0] = 1.0f;
m_grabbers[i].color[1] = 1.0f;
m_grabbers[i].color[2] = picking_color_component(i);
m_grabbers[i].render_for_picking(box);
m_grabbers[i].render_for_picking(size);
}
}
}
@ -709,7 +712,6 @@ GLGizmoScale3D::GLGizmoScale3D(GLCanvas3D& parent)
: GLGizmoBase(parent)
, m_scale(Vec3d::Ones())
, m_starting_scale(Vec3d::Ones())
, m_show_starting_box(false)
{
}
@ -752,7 +754,6 @@ void GLGizmoScale3D::on_start_dragging(const BoundingBoxf3& box)
if (m_hover_id != -1)
{
m_starting_drag_position = m_grabbers[m_hover_id].center;
m_show_starting_box = true;
m_starting_box = BoundingBoxf3(box.min - OffsetVec, box.max + OffsetVec);
}
}
@ -817,10 +818,10 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
::memcpy((void*)m_grabbers[5].color, (const void*)&AXES_COLOR[2], 3 * sizeof(float));
// uniform
m_grabbers[6].center = Vec3d(m_box.min(0), m_box.min(1), m_box.min(2));
m_grabbers[7].center = Vec3d(m_box.max(0), m_box.min(1), m_box.min(2));
m_grabbers[8].center = Vec3d(m_box.max(0), m_box.max(1), m_box.min(2));
m_grabbers[9].center = Vec3d(m_box.min(0), m_box.max(1), m_box.min(2));
m_grabbers[6].center = Vec3d(m_box.min(0), m_box.min(1), center(2));
m_grabbers[7].center = Vec3d(m_box.max(0), m_box.min(1), center(2));
m_grabbers[8].center = Vec3d(m_box.max(0), m_box.max(1), center(2));
m_grabbers[9].center = Vec3d(m_box.min(0), m_box.max(1), center(2));
for (int i = 6; i < 10; ++i)
{
::memcpy((void*)m_grabbers[i].color, (const void*)m_highlight_color, 3 * sizeof(float));
@ -828,11 +829,10 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
::glLineWidth((m_hover_id != -1) ? 2.0f : 1.5f);
float box_max_size = (float)m_box.max_size();
if (m_hover_id == -1)
{
// draw box
::glColor3fv(m_base_color);
render_box(m_box);
// draw connections
if (m_grabbers[0].enabled && m_grabbers[1].enabled)
{
@ -849,78 +849,53 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const
::glColor3fv(m_grabbers[4].color);
render_grabbers_connection(4, 5);
}
::glColor3fv(m_base_color);
render_grabbers_connection(6, 7);
render_grabbers_connection(7, 8);
render_grabbers_connection(8, 9);
render_grabbers_connection(9, 6);
// draw grabbers
render_grabbers(m_box);
}
else if ((m_hover_id == 0) || (m_hover_id == 1))
{
// draw starting box
if (m_show_starting_box)
{
::glColor3fv(m_base_color);
render_box(m_starting_box);
}
// draw current box
::glColor3fv(m_drag_color);
render_box(m_box);
// draw connection
::glColor3fv(m_grabbers[0].color);
render_grabbers_connection(0, 1);
// draw grabbers
m_grabbers[0].render(true, m_box);
m_grabbers[1].render(true, m_box);
m_grabbers[0].render(true, box_max_size);
m_grabbers[1].render(true, box_max_size);
}
else if ((m_hover_id == 2) || (m_hover_id == 3))
{
// draw starting box
if (m_show_starting_box)
{
::glColor3fv(m_base_color);
render_box(m_starting_box);
}
// draw current box
::glColor3fv(m_drag_color);
render_box(m_box);
// draw connection
::glColor3fv(m_grabbers[2].color);
render_grabbers_connection(2, 3);
// draw grabbers
m_grabbers[2].render(true, m_box);
m_grabbers[3].render(true, m_box);
m_grabbers[2].render(true, box_max_size);
m_grabbers[3].render(true, box_max_size);
}
else if ((m_hover_id == 4) || (m_hover_id == 5))
{
// draw starting box
if (m_show_starting_box)
{
::glColor3fv(m_base_color);
render_box(m_starting_box);
}
// draw current box
::glColor3fv(m_drag_color);
render_box(m_box);
// draw connection
::glColor3fv(m_grabbers[4].color);
render_grabbers_connection(4, 5);
// draw grabbers
m_grabbers[4].render(true, m_box);
m_grabbers[5].render(true, m_box);
m_grabbers[4].render(true, box_max_size);
m_grabbers[5].render(true, box_max_size);
}
else if (m_hover_id >= 6)
{
// draw starting box
if (m_show_starting_box)
{
::glColor3fv(m_base_color);
render_box(m_starting_box);
}
// draw current box
// draw connection
::glColor3fv(m_drag_color);
render_box(m_box);
render_grabbers_connection(6, 7);
render_grabbers_connection(7, 8);
render_grabbers_connection(8, 9);
render_grabbers_connection(9, 6);
// draw grabbers
for (int i = 6; i < 10; ++i)
{
m_grabbers[i].render(true, m_box);
m_grabbers[i].render(true, box_max_size);
}
}
}
@ -932,33 +907,6 @@ void GLGizmoScale3D::on_render_for_picking(const BoundingBoxf3& box) const
render_grabbers_for_picking(box);
}
void GLGizmoScale3D::render_box(const BoundingBoxf3& box) const
{
// bottom face
::glBegin(GL_LINE_LOOP);
::glVertex3f((GLfloat)box.min(0), (GLfloat)box.min(1), (GLfloat)box.min(2));
::glVertex3f((GLfloat)box.min(0), (GLfloat)box.max(1), (GLfloat)box.min(2));
::glVertex3f((GLfloat)box.max(0), (GLfloat)box.max(1), (GLfloat)box.min(2));
::glVertex3f((GLfloat)box.max(0), (GLfloat)box.min(1), (GLfloat)box.min(2));
::glEnd();
// top face
::glBegin(GL_LINE_LOOP);
::glVertex3f((GLfloat)box.min(0), (GLfloat)box.min(1), (GLfloat)box.max(2));
::glVertex3f((GLfloat)box.min(0), (GLfloat)box.max(1), (GLfloat)box.max(2));
::glVertex3f((GLfloat)box.max(0), (GLfloat)box.max(1), (GLfloat)box.max(2));
::glVertex3f((GLfloat)box.max(0), (GLfloat)box.min(1), (GLfloat)box.max(2));
::glEnd();
// vertical edges
::glBegin(GL_LINES);
::glVertex3f((GLfloat)box.min(0), (GLfloat)box.min(1), (GLfloat)box.min(2)); ::glVertex3f((GLfloat)box.min(0), (GLfloat)box.min(1), (GLfloat)box.max(2));
::glVertex3f((GLfloat)box.min(0), (GLfloat)box.max(1), (GLfloat)box.min(2)); ::glVertex3f((GLfloat)box.min(0), (GLfloat)box.max(1), (GLfloat)box.max(2));
::glVertex3f((GLfloat)box.max(0), (GLfloat)box.max(1), (GLfloat)box.min(2)); ::glVertex3f((GLfloat)box.max(0), (GLfloat)box.max(1), (GLfloat)box.max(2));
::glVertex3f((GLfloat)box.max(0), (GLfloat)box.min(1), (GLfloat)box.min(2)); ::glVertex3f((GLfloat)box.max(0), (GLfloat)box.min(1), (GLfloat)box.max(2));
::glEnd();
}
void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int id_2) const
{
unsigned int grabbers_count = (unsigned int)m_grabbers.size();
@ -1189,7 +1137,7 @@ void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const
::glEnd();
// draw grabber
m_grabbers[m_hover_id].render(true, box);
m_grabbers[m_hover_id].render(true, box.max_size());
}
}

View file

@ -34,11 +34,11 @@ protected:
Grabber();
void render(bool hover, const BoundingBoxf3& box) const;
void render_for_picking(const BoundingBoxf3& box) const { render(box, color, false); }
void render(bool hover, float size) const;
void render_for_picking(float size) const { render(size, color, false); }
private:
void render(const BoundingBoxf3& box, const float* render_color, bool use_lighting) const;
void render(float size, const float* render_color, bool use_lighting) const;
void render_face(float half_size) const;
};
@ -277,7 +277,6 @@ class GLGizmoScale3D : public GLGizmoBase
Vec3d m_starting_scale;
Vec3d m_starting_drag_position;
bool m_show_starting_box;
BoundingBoxf3 m_starting_box;
public:
@ -302,7 +301,6 @@ public:
protected:
virtual bool on_init();
virtual void on_start_dragging(const BoundingBoxf3& box);
virtual void on_stop_dragging() { m_show_starting_box = false; }
virtual void on_update(const Linef3& mouse_ray);
#if ENABLE_GIZMOS_RESET
virtual void on_process_double_click();
@ -311,7 +309,6 @@ protected:
virtual void on_render_for_picking(const BoundingBoxf3& box) const;
private:
void render_box(const BoundingBoxf3& box) const;
void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const;
void do_scale_x(const Linef3& mouse_ray);

View file

@ -274,6 +274,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
update_position_value(volume->get_offset());
update_rotation_value(volume->get_rotation());
update_scale_value(volume->get_scaling_factor());
m_og->enable();
}
else
@ -285,6 +286,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
update_position_value(volume->get_offset());
update_rotation_value(volume->get_rotation());
update_scale_value(volume->get_scaling_factor());
m_og->enable();
}
else if (selection.is_wipe_tower())
@ -293,6 +295,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
update_position_value(volume->get_offset());
update_rotation_value(volume->get_rotation());
update_scale_value(volume->get_scaling_factor());
m_og->enable();
}
else if (selection.is_modifier())
@ -301,6 +304,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
update_position_value(volume->get_offset());
update_rotation_value(volume->get_rotation());
update_scale_value(volume->get_scaling_factor());
m_og->enable();
}
else
@ -420,7 +424,7 @@ void ObjectManipulation::update_position_value(const Vec3d& position)
}
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
void ObjectManipulation::update_scale_values(const Vec3d& scaling_factor)
void ObjectManipulation::update_scale_value(const Vec3d& scaling_factor)
{
// this is temporary
// to be able to update the values as size

View file

@ -62,7 +62,7 @@ public:
// update scale values after scale unit changing or "gizmos"
void update_scale_values();
#if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM
void update_scale_values(const Vec3d& scaling_factor);
void update_scale_value(const Vec3d& scaling_factor);
#else
void update_scale_values(double scaling_factor);
#endif // ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM