Merge branch 'dev_native' of https://github.com/prusa3d/Slic3r into dev_native
This commit is contained in:
commit
259aed3bf3
7 changed files with 39 additions and 52 deletions
|
@ -1242,7 +1242,7 @@ void ModelInstance::transform_polygon(Polygon* polygon) const
|
|||
}
|
||||
|
||||
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||
Transform3d ModelInstance::world_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
|
||||
Transform3d ModelInstance::get_matrix(bool dont_translate, bool dont_rotate, bool dont_scale, bool dont_mirror) const
|
||||
{
|
||||
Vec3d translation = dont_translate ? Vec3d::Zero() : m_offset;
|
||||
Vec3d rotation = dont_rotate ? Vec3d::Zero() : m_rotation;
|
||||
|
|
|
@ -1980,11 +1980,6 @@ void _3DScene::update_volumes_colors_by_extruder(wxGLCanvas* 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)
|
||||
{
|
||||
s_canvas_mgr.render(canvas);
|
||||
|
|
|
@ -565,7 +565,6 @@ public:
|
|||
static void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
||||
|
||||
static void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
||||
static void update_gizmos_data(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);
|
||||
}
|
||||
|
||||
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 in either screen or viewport coords.
|
||||
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)
|
||||
{
|
||||
|
@ -3802,12 +3772,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
else if (!m_selection.is_empty() && gizmos_overlay_contains_mouse)
|
||||
{
|
||||
m_gizmos.update_on_off_state(*this, m_mouse.position, m_selection);
|
||||
update_gizmos_data();
|
||||
_update_gizmos_data();
|
||||
m_dirty = true;
|
||||
}
|
||||
else if (evt.LeftDown() && !m_selection.is_empty() && m_gizmos.grabber_contains_mouse())
|
||||
{
|
||||
update_gizmos_data();
|
||||
_update_gizmos_data();
|
||||
m_selection.start_dragging();
|
||||
m_gizmos.start_dragging(m_selection);
|
||||
|
||||
|
@ -3851,7 +3821,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
}
|
||||
|
||||
m_gizmos.update_on_off_state(m_selection);
|
||||
update_gizmos_data();
|
||||
_update_gizmos_data();
|
||||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||
m_dirty = true;
|
||||
|
@ -3894,7 +3864,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
m_selection.add(m_hover_volume_id);
|
||||
m_gizmos.update_on_off_state(m_selection);
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||
update_gizmos_data();
|
||||
_update_gizmos_data();
|
||||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||
// forces a frame render to update the view before the context menu is shown
|
||||
render();
|
||||
|
@ -4050,7 +4020,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
m_selection.clear();
|
||||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||
update_gizmos_data();
|
||||
_update_gizmos_data();
|
||||
}
|
||||
#if ENABLE_GIZMOS_RESET
|
||||
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
|
||||
{
|
||||
return m_layers_editing.get_cursor_z_relative(*this);
|
||||
|
|
|
@ -742,7 +742,7 @@ public:
|
|||
void set_viewport_from_scene(const GLCanvas3D& other);
|
||||
|
||||
void update_volumes_colors_by_extruder();
|
||||
void update_gizmos_data();
|
||||
|
||||
Rect get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const;
|
||||
bool gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, float y) const;
|
||||
|
||||
|
@ -822,6 +822,7 @@ private:
|
|||
#endif // ENABLE_SHOW_CAMERA_TARGET
|
||||
|
||||
void _update_volumes_hover_state() const;
|
||||
void _update_gizmos_data();
|
||||
|
||||
float _get_layers_editing_cursor_z_relative() const;
|
||||
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();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
|
|
|
@ -135,7 +135,6 @@ public:
|
|||
void set_viewport_from_scene(wxGLCanvas* canvas, wxGLCanvas* other);
|
||||
|
||||
void update_volumes_colors_by_extruder(wxGLCanvas* canvas);
|
||||
void update_gizmos_data(wxGLCanvas* canvas);
|
||||
|
||||
void render(wxGLCanvas* canvas) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue