mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 14:06:13 +08:00
Hook for manipulation relativity for rotation gizmo
This commit is contained in:
parent
d0ffe16964
commit
61e2cc2403
@ -1,7 +1,6 @@
|
|||||||
#include "GLGizmoEmboss.hpp"
|
#include "GLGizmoEmboss.hpp"
|
||||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
#include "slic3r/GUI/GUI_ObjectManipulation.hpp"
|
|
||||||
#include "slic3r/GUI/GUI_ObjectList.hpp"
|
#include "slic3r/GUI/GUI_ObjectList.hpp"
|
||||||
#include "slic3r/GUI/MainFrame.hpp" // to update title when add text
|
#include "slic3r/GUI/MainFrame.hpp" // to update title when add text
|
||||||
#include "slic3r/GUI/NotificationManager.hpp"
|
#include "slic3r/GUI/NotificationManager.hpp"
|
||||||
@ -131,6 +130,7 @@ GLGizmoEmboss::GLGizmoEmboss(GLCanvas3D &parent)
|
|||||||
, m_allow_update_rendered_font(false)
|
, m_allow_update_rendered_font(false)
|
||||||
{
|
{
|
||||||
m_rotate_gizmo.set_group_id(0);
|
m_rotate_gizmo.set_group_id(0);
|
||||||
|
m_rotate_gizmo.set_using_local_coordinate(true);
|
||||||
// TODO: add suggestion to use https://fontawesome.com/
|
// TODO: add suggestion to use https://fontawesome.com/
|
||||||
// (copy & paste) unicode symbols from web
|
// (copy & paste) unicode symbols from web
|
||||||
// paste HEX unicode into notepad move cursor after unicode press [alt] + [x]
|
// paste HEX unicode into notepad move cursor after unicode press [alt] + [x]
|
||||||
@ -596,16 +596,6 @@ void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
|
|
||||||
void GLGizmoEmboss::on_set_state()
|
void GLGizmoEmboss::on_set_state()
|
||||||
{
|
{
|
||||||
// set manipulator to be able to rotate with text
|
|
||||||
ObjectManipulation *manipul = wxGetApp().obj_manipul();
|
|
||||||
static ECoordinatesType prev_coordinate_type = ECoordinatesType::World;
|
|
||||||
if (GLGizmoBase::m_state == GLGizmoBase::Off)
|
|
||||||
manipul->set_coordinates_type(prev_coordinate_type); // set previous state
|
|
||||||
else if (GLGizmoBase::m_state == GLGizmoBase::On) {
|
|
||||||
prev_coordinate_type = manipul->get_coordinates_type();
|
|
||||||
manipul->set_coordinates_type(ECoordinatesType::Local);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rotate_gizmo.set_state(GLGizmoBase::m_state);
|
m_rotate_gizmo.set_state(GLGizmoBase::m_state);
|
||||||
|
|
||||||
// Closing gizmo. e.g. selecting another one
|
// Closing gizmo. e.g. selecting another one
|
||||||
|
@ -286,7 +286,8 @@ void GLGizmoRotate::on_render_for_picking()
|
|||||||
void GLGizmoRotate::init_data_from_selection(const Selection& selection)
|
void GLGizmoRotate::init_data_from_selection(const Selection& selection)
|
||||||
{
|
{
|
||||||
ECoordinatesType coordinates_type;
|
ECoordinatesType coordinates_type;
|
||||||
if (selection.is_wipe_tower())
|
if (m_using_local_coordinate ||
|
||||||
|
selection.is_wipe_tower())
|
||||||
coordinates_type = ECoordinatesType::Local;
|
coordinates_type = ECoordinatesType::Local;
|
||||||
else
|
else
|
||||||
coordinates_type = wxGetApp().obj_manipul()->get_coordinates_type();
|
coordinates_type = wxGetApp().obj_manipul()->get_coordinates_type();
|
||||||
|
@ -57,6 +57,9 @@ private:
|
|||||||
float m_old_angle{ 0.0f };
|
float m_old_angle{ 0.0f };
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
|
// emboss need to draw rotation gizmo in local coordinate systems
|
||||||
|
bool m_using_local_coordinate{false};
|
||||||
|
|
||||||
ColorRGBA m_drag_color;
|
ColorRGBA m_drag_color;
|
||||||
ColorRGBA m_highlight_color;
|
ColorRGBA m_highlight_color;
|
||||||
|
|
||||||
@ -70,6 +73,7 @@ public:
|
|||||||
std::string get_tooltip() const override;
|
std::string get_tooltip() const override;
|
||||||
|
|
||||||
void set_group_id(int group_id) { m_group_id = group_id; }
|
void set_group_id(int group_id) { m_group_id = group_id; }
|
||||||
|
void set_using_local_coordinate(bool use) { m_using_local_coordinate =use;}
|
||||||
|
|
||||||
void start_dragging();
|
void start_dragging();
|
||||||
void stop_dragging();
|
void stop_dragging();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user