mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
GLCanvas3D::update_gizmos_data() set as private
This commit is contained in:
parent
00ec33ef16
commit
7751d991d4
6 changed files with 38 additions and 51 deletions
|
@ -1980,11 +1980,6 @@ void _3DScene::update_volumes_colors_by_extruder(wxGLCanvas* canvas)
|
||||||
s_canvas_mgr.update_volumes_colors_by_extruder(canvas);
|
s_canvas_mgr.update_volumes_colors_by_extruder(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _3DScene::update_gizmos_data(wxGLCanvas* canvas)
|
|
||||||
{
|
|
||||||
s_canvas_mgr.update_gizmos_data(canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _3DScene::render(wxGLCanvas* canvas)
|
void _3DScene::render(wxGLCanvas* canvas)
|
||||||
{
|
{
|
||||||
s_canvas_mgr.render(canvas);
|
s_canvas_mgr.render(canvas);
|
||||||
|
|
|
@ -565,7 +565,6 @@ public:
|
||||||
static void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
static void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
||||||
|
|
||||||
static void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
static void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
||||||
static void update_gizmos_data(wxGLCanvas* canvas);
|
|
||||||
|
|
||||||
static void render(wxGLCanvas* canvas);
|
static void render(wxGLCanvas* canvas);
|
||||||
|
|
||||||
|
|
|
@ -3184,36 +3184,6 @@ void GLCanvas3D::update_volumes_colors_by_extruder()
|
||||||
m_volumes.update_colors_by_extruder(m_config);
|
m_volumes.update_colors_by_extruder(m_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::update_gizmos_data()
|
|
||||||
{
|
|
||||||
if (!m_gizmos.is_enabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
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())
|
|
||||||
{
|
|
||||||
ModelObject* model_object = m_model->objects[m_selection.get_object_idx()];
|
|
||||||
ModelInstance* model_instance = model_object->instances[m_selection.get_instance_idx()];
|
|
||||||
m_gizmos.set_scale(model_instance->get_scaling_factor());
|
|
||||||
m_gizmos.set_rotation(model_instance->get_rotation());
|
|
||||||
m_gizmos.set_flattening_data(model_object);
|
|
||||||
m_gizmos.set_model_object_ptr(model_object);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_gizmos.set_scale(Vec3d::Ones());
|
|
||||||
m_gizmos.set_rotation(Vec3d::Zero());
|
|
||||||
m_gizmos.set_flattening_data(nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns a Rect object denoting size and position of the Reset button used by a gizmo.
|
// Returns a Rect object denoting size and position of the Reset button used by a gizmo.
|
||||||
// Returns in either screen or viewport coords.
|
// Returns in either screen or viewport coords.
|
||||||
Rect GLCanvas3D::get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const
|
Rect GLCanvas3D::get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const
|
||||||
|
@ -3397,7 +3367,7 @@ void GLCanvas3D::reload_scene(bool force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_gizmos_data();
|
_update_gizmos_data();
|
||||||
|
|
||||||
if (m_regenerate_volumes)
|
if (m_regenerate_volumes)
|
||||||
{
|
{
|
||||||
|
@ -3802,12 +3772,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
else if (!m_selection.is_empty() && gizmos_overlay_contains_mouse)
|
else if (!m_selection.is_empty() && gizmos_overlay_contains_mouse)
|
||||||
{
|
{
|
||||||
m_gizmos.update_on_off_state(*this, m_mouse.position, m_selection);
|
m_gizmos.update_on_off_state(*this, m_mouse.position, m_selection);
|
||||||
update_gizmos_data();
|
_update_gizmos_data();
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
else if (evt.LeftDown() && !m_selection.is_empty() && m_gizmos.grabber_contains_mouse())
|
else if (evt.LeftDown() && !m_selection.is_empty() && m_gizmos.grabber_contains_mouse())
|
||||||
{
|
{
|
||||||
update_gizmos_data();
|
_update_gizmos_data();
|
||||||
m_selection.start_dragging();
|
m_selection.start_dragging();
|
||||||
m_gizmos.start_dragging(m_selection);
|
m_gizmos.start_dragging(m_selection);
|
||||||
|
|
||||||
|
@ -3851,7 +3821,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gizmos.update_on_off_state(m_selection);
|
m_gizmos.update_on_off_state(m_selection);
|
||||||
update_gizmos_data();
|
_update_gizmos_data();
|
||||||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
@ -3894,7 +3864,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
m_selection.add(m_hover_volume_id);
|
m_selection.add(m_hover_volume_id);
|
||||||
m_gizmos.update_on_off_state(m_selection);
|
m_gizmos.update_on_off_state(m_selection);
|
||||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||||
update_gizmos_data();
|
_update_gizmos_data();
|
||||||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||||
// forces a frame render to update the view before the context menu is shown
|
// forces a frame render to update the view before the context menu is shown
|
||||||
render();
|
render();
|
||||||
|
@ -4050,7 +4020,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
m_selection.clear();
|
m_selection.clear();
|
||||||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||||
update_gizmos_data();
|
_update_gizmos_data();
|
||||||
}
|
}
|
||||||
#if ENABLE_GIZMOS_RESET
|
#if ENABLE_GIZMOS_RESET
|
||||||
else if (m_mouse.ignore_up_event)
|
else if (m_mouse.ignore_up_event)
|
||||||
|
@ -4856,6 +4826,36 @@ void GLCanvas3D::_update_volumes_hover_state() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::_update_gizmos_data()
|
||||||
|
{
|
||||||
|
if (!m_gizmos.is_enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
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())
|
||||||
|
{
|
||||||
|
ModelObject* model_object = m_model->objects[m_selection.get_object_idx()];
|
||||||
|
ModelInstance* model_instance = model_object->instances[m_selection.get_instance_idx()];
|
||||||
|
m_gizmos.set_scale(model_instance->get_scaling_factor());
|
||||||
|
m_gizmos.set_rotation(model_instance->get_rotation());
|
||||||
|
m_gizmos.set_flattening_data(model_object);
|
||||||
|
m_gizmos.set_model_object_ptr(model_object);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_gizmos.set_scale(Vec3d::Ones());
|
||||||
|
m_gizmos.set_rotation(Vec3d::Zero());
|
||||||
|
m_gizmos.set_flattening_data(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float GLCanvas3D::_get_layers_editing_cursor_z_relative() const
|
float GLCanvas3D::_get_layers_editing_cursor_z_relative() const
|
||||||
{
|
{
|
||||||
return m_layers_editing.get_cursor_z_relative(*this);
|
return m_layers_editing.get_cursor_z_relative(*this);
|
||||||
|
|
|
@ -742,7 +742,7 @@ public:
|
||||||
void set_viewport_from_scene(const GLCanvas3D& other);
|
void set_viewport_from_scene(const GLCanvas3D& other);
|
||||||
|
|
||||||
void update_volumes_colors_by_extruder();
|
void update_volumes_colors_by_extruder();
|
||||||
void update_gizmos_data();
|
|
||||||
Rect get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const;
|
Rect get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const;
|
||||||
bool gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, float y) const;
|
bool gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, float y) const;
|
||||||
|
|
||||||
|
@ -822,6 +822,7 @@ private:
|
||||||
#endif // ENABLE_SHOW_CAMERA_TARGET
|
#endif // ENABLE_SHOW_CAMERA_TARGET
|
||||||
|
|
||||||
void _update_volumes_hover_state() const;
|
void _update_volumes_hover_state() const;
|
||||||
|
void _update_gizmos_data();
|
||||||
|
|
||||||
float _get_layers_editing_cursor_z_relative() const;
|
float _get_layers_editing_cursor_z_relative() const;
|
||||||
void _perform_layer_editing_action(wxMouseEvent* evt = nullptr);
|
void _perform_layer_editing_action(wxMouseEvent* evt = nullptr);
|
||||||
|
|
|
@ -485,13 +485,6 @@ void GLCanvas3DManager::update_volumes_colors_by_extruder(wxGLCanvas* canvas)
|
||||||
it->second->update_volumes_colors_by_extruder();
|
it->second->update_volumes_colors_by_extruder();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3DManager::update_gizmos_data(wxGLCanvas* canvas)
|
|
||||||
{
|
|
||||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
|
||||||
if (it != m_canvases.end())
|
|
||||||
it->second->update_gizmos_data();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLCanvas3DManager::render(wxGLCanvas* canvas) const
|
void GLCanvas3DManager::render(wxGLCanvas* canvas) const
|
||||||
{
|
{
|
||||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||||
|
|
|
@ -135,7 +135,6 @@ public:
|
||||||
void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
||||||
|
|
||||||
void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
||||||
void update_gizmos_data(wxGLCanvas* canvas);
|
|
||||||
|
|
||||||
void render(wxGLCanvas* canvas) const;
|
void render(wxGLCanvas* canvas) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue