FIX:Rotation gizmo coincides with the cut coordinate system in cut gizmo
jira: STUDIO-10868 Change-Id: Ifec448e4d0bab518c07c9d198304daa8c0e95999
This commit is contained in:
parent
06a50c35fe
commit
1f41a3da7a
|
@ -1390,6 +1390,10 @@ void GLGizmoAdvancedCut::on_render_rotate_gizmos() {
|
||||||
m_gizmos[Z].render();
|
m_gizmos[Z].render();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Transform3d rotate_tran = Geometry::translation_transform(m_plane_center) * m_rotate_matrix;
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
m_gizmos[i].set_custom_tran(rotate_tran);
|
||||||
|
}
|
||||||
m_gizmos[X].render();
|
m_gizmos[X].render();
|
||||||
m_gizmos[Y].render();
|
m_gizmos[Y].render();
|
||||||
m_gizmos[Z].render();
|
m_gizmos[Z].render();
|
||||||
|
|
|
@ -539,9 +539,16 @@ void GLGizmoRotate::init_data_from_selection(const Selection &selection) {
|
||||||
selection.get_bounding_box_in_current_reference_system();
|
selection.get_bounding_box_in_current_reference_system();
|
||||||
m_bounding_box = box;
|
m_bounding_box = box;
|
||||||
const std::pair<Vec3d, double> sphere = selection.get_bounding_sphere();
|
const std::pair<Vec3d, double> sphere = selection.get_bounding_sphere();
|
||||||
m_center = sphere.first;
|
if (m_custom_tran.has_value()) {
|
||||||
m_radius = Offset +sphere.second;
|
Geometry::Transformation tran(m_custom_tran.value());
|
||||||
m_orient_matrix = box_trafo;
|
m_center = tran.get_offset();
|
||||||
|
m_orient_matrix = tran.get_matrix();
|
||||||
|
} else {
|
||||||
|
m_center = sphere.first;
|
||||||
|
m_orient_matrix = box_trafo;
|
||||||
|
}
|
||||||
|
m_radius = Offset + sphere.second;
|
||||||
|
|
||||||
m_orient_matrix.translation() = m_center;
|
m_orient_matrix.translation() = m_center;
|
||||||
m_snap_coarse_in_radius = 1.0f / 3.0f;
|
m_snap_coarse_in_radius = 1.0f / 3.0f;
|
||||||
m_snap_coarse_out_radius = 2.0f * m_snap_coarse_in_radius;
|
m_snap_coarse_out_radius = 2.0f * m_snap_coarse_in_radius;
|
||||||
|
@ -550,6 +557,10 @@ void GLGizmoRotate::init_data_from_selection(const Selection &selection) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLGizmoRotate::set_custom_tran(const Transform3d &tran) {
|
||||||
|
m_custom_tran = tran;
|
||||||
|
}
|
||||||
|
|
||||||
BoundingBoxf3 GLGizmoRotate::get_bounding_box() const
|
BoundingBoxf3 GLGizmoRotate::get_bounding_box() const
|
||||||
{
|
{
|
||||||
BoundingBoxf3 t_aabb;
|
BoundingBoxf3 t_aabb;
|
||||||
|
@ -566,7 +577,7 @@ BoundingBoxf3 GLGizmoRotate::get_bounding_box() const
|
||||||
t_aabb.defined = true;
|
t_aabb.defined = true;
|
||||||
}
|
}
|
||||||
// end m_circle aabb
|
// end m_circle aabb
|
||||||
|
|
||||||
// m_grabber_connection aabb
|
// m_grabber_connection aabb
|
||||||
if (m_grabber_connection.model.is_initialized()) {
|
if (m_grabber_connection.model.is_initialized()) {
|
||||||
BoundingBoxf3 t_grabber_connection_aabb = m_grabber_connection.model.get_bounding_box();
|
BoundingBoxf3 t_grabber_connection_aabb = m_grabber_connection.model.get_bounding_box();
|
||||||
|
@ -586,7 +597,7 @@ BoundingBoxf3 GLGizmoRotate::get_bounding_box() const
|
||||||
t_aabb.defined = true;
|
t_aabb.defined = true;
|
||||||
}
|
}
|
||||||
// end m_grabbers aabb
|
// end m_grabbers aabb
|
||||||
|
|
||||||
// m_cone aabb
|
// m_cone aabb
|
||||||
if (m_cone.is_initialized()) {
|
if (m_cone.is_initialized()) {
|
||||||
auto t_cone_aabb = m_cone.get_bounding_box();
|
auto t_cone_aabb = m_cone.get_bounding_box();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
void set_center(const Vec3d &point) { m_custom_center = point; }
|
void set_center(const Vec3d &point) { m_custom_center = point; }
|
||||||
void set_force_local_coordinate(bool use) { m_force_local_coordinate = use; }
|
void set_force_local_coordinate(bool use) { m_force_local_coordinate = use; }
|
||||||
void init_data_from_selection(const Selection &selection);
|
void init_data_from_selection(const Selection &selection);
|
||||||
|
void set_custom_tran(const Transform3d &tran);
|
||||||
BoundingBoxf3 get_bounding_box() const override;
|
BoundingBoxf3 get_bounding_box() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -98,6 +98,9 @@ private:
|
||||||
Transform3d transform_to_local(const Selection& selection) const;
|
Transform3d transform_to_local(const Selection& selection) const;
|
||||||
// returns the intersection of the mouse ray with the plane perpendicular to the gizmo axis, in local coordinate
|
// returns the intersection of the mouse ray with the plane perpendicular to the gizmo axis, in local coordinate
|
||||||
Vec3d mouse_position_in_local_plane(const Linef3& mouse_ray, const Selection& selection) const;
|
Vec3d mouse_position_in_local_plane(const Linef3& mouse_ray, const Selection& selection) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::optional<Transform3d> m_custom_tran;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GLGizmoRotate3D : public GLGizmoBase
|
class GLGizmoRotate3D : public GLGizmoBase
|
||||||
|
|
Loading…
Reference in New Issue