mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision
This commit is contained in:
commit
29340c1560
56 changed files with 673 additions and 361 deletions
|
|
@ -1,5 +1,4 @@
|
|||
#include "GUI_ObjectManipulation.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "BitmapComboBox.hpp"
|
||||
|
||||
|
|
@ -132,7 +131,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
return;
|
||||
|
||||
wxGetApp().obj_list()->fix_through_netfabb();
|
||||
update_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors());
|
||||
update_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors_info());
|
||||
});
|
||||
|
||||
sizer->Add(m_fix_throught_netfab_bitmap);
|
||||
|
|
@ -548,8 +547,8 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
|
|||
}
|
||||
else {
|
||||
m_new_rotation = volume->get_instance_rotation() * (180. / M_PI);
|
||||
m_new_size = volume->get_instance_transformation().get_scaling_factor().cwiseProduct(wxGetApp().model().objects[volume->object_idx()]->raw_mesh_bounding_box().size());
|
||||
m_new_scale = volume->get_instance_scaling_factor() * 100.;
|
||||
m_new_size = volume->get_instance_scaling_factor().cwiseProduct(wxGetApp().model().objects[volume->object_idx()]->raw_mesh_bounding_box().size());
|
||||
m_new_scale = volume->get_instance_scaling_factor() * 100.;
|
||||
}
|
||||
|
||||
m_new_enabled = true;
|
||||
|
|
@ -570,7 +569,7 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
|
|||
m_new_position = volume->get_volume_offset();
|
||||
m_new_rotation = volume->get_volume_rotation() * (180. / M_PI);
|
||||
m_new_scale = volume->get_volume_scaling_factor() * 100.;
|
||||
m_new_size = volume->get_instance_transformation().get_scaling_factor().cwiseProduct(volume->get_volume_transformation().get_scaling_factor().cwiseProduct(volume->bounding_box().size()));
|
||||
m_new_size = volume->get_instance_scaling_factor().cwiseProduct(volume->get_volume_scaling_factor().cwiseProduct(volume->bounding_box().size()));
|
||||
m_new_enabled = true;
|
||||
}
|
||||
else if (obj_list->multiple_selection() || obj_list->is_selected(itInstanceRoot)) {
|
||||
|
|
@ -786,12 +785,12 @@ void ObjectManipulation::update_item_name(const wxString& item_name)
|
|||
m_item_name->SetLabel(item_name);
|
||||
}
|
||||
|
||||
void ObjectManipulation::update_warning_icon_state(const std::pair<wxString, std::string>& warning)
|
||||
void ObjectManipulation::update_warning_icon_state(const MeshErrorsInfo& warning)
|
||||
{
|
||||
if (const std::string& warning_icon_name = warning.second;
|
||||
if (const std::string& warning_icon_name = warning.warning_icon_name;
|
||||
!warning_icon_name.empty())
|
||||
m_manifold_warning_bmp = ScalableBitmap(m_parent, warning_icon_name);
|
||||
const wxString& tooltip = warning.first;
|
||||
const wxString& tooltip = warning.tooltip;
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp.bmp());
|
||||
m_fix_throught_netfab_bitmap->SetMinSize(tooltip.IsEmpty() ? wxSize(0,0) : m_manifold_warning_bmp.bmp().GetSize());
|
||||
m_fix_throught_netfab_bitmap->SetToolTip(tooltip);
|
||||
|
|
@ -867,7 +866,7 @@ void ObjectManipulation::change_scale_value(int axis, double value)
|
|||
Vec3d scale = m_cache.scale;
|
||||
scale(axis) = value;
|
||||
|
||||
this->do_scale(axis, scale);
|
||||
this->do_scale(axis, 0.01 * scale);
|
||||
|
||||
m_cache.scale = scale;
|
||||
m_cache.scale_rounded(axis) = DBL_MAX;
|
||||
|
|
@ -886,14 +885,21 @@ void ObjectManipulation::change_size_value(int axis, double value)
|
|||
const Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
|
||||
|
||||
Vec3d ref_size = m_cache.size;
|
||||
if (selection.is_single_volume() || selection.is_single_modifier())
|
||||
ref_size = selection.get_volume(*selection.get_volume_idxs().begin())->bounding_box().size();
|
||||
if (selection.is_single_volume() || selection.is_single_modifier()) {
|
||||
const GLVolume* v = selection.get_volume(*selection.get_volume_idxs().begin());
|
||||
const Vec3d local_size = size.cwiseQuotient(v->get_instance_scaling_factor());
|
||||
const Vec3d local_ref_size = v->bounding_box().size().cwiseProduct(v->get_volume_scaling_factor());
|
||||
const Vec3d local_change = local_size.cwiseQuotient(local_ref_size);
|
||||
|
||||
size = local_change.cwiseProduct(v->get_volume_scaling_factor());
|
||||
ref_size = Vec3d::Ones();
|
||||
}
|
||||
else if (selection.is_single_full_instance())
|
||||
ref_size = m_world_coordinates ?
|
||||
selection.get_unscaled_instance_bounding_box().size() :
|
||||
wxGetApp().model().objects[selection.get_volume(*selection.get_volume_idxs().begin())->object_idx()]->raw_mesh_bounding_box().size();
|
||||
|
||||
this->do_scale(axis, 100. * Vec3d(size(0) / ref_size(0), size(1) / ref_size(1), size(2) / ref_size(2)));
|
||||
this->do_scale(axis, size.cwiseQuotient(ref_size));
|
||||
|
||||
m_cache.size = size;
|
||||
m_cache.size_rounded(axis) = DBL_MAX;
|
||||
|
|
@ -916,7 +922,7 @@ void ObjectManipulation::do_scale(int axis, const Vec3d &scale) const
|
|||
scaling_factor = scale(axis) * Vec3d::Ones();
|
||||
|
||||
selection.start_dragging();
|
||||
selection.scale(scaling_factor * 0.01, transformation_type);
|
||||
selection.scale(scaling_factor, transformation_type);
|
||||
wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue