Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
59b01b4908
3 changed files with 13 additions and 3 deletions
|
@ -1478,6 +1478,14 @@ bool GLCanvas3D::Selection::is_from_single_object() const
|
||||||
return (0 <= idx) && (idx < 1000);
|
return (0 <= idx) && (idx < 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GLCanvas3D::Selection::requires_uniform_scale() const
|
||||||
|
{
|
||||||
|
if (is_single_full_instance() || is_single_modifier() || is_single_volume())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int GLCanvas3D::Selection::get_object_idx() const
|
int GLCanvas3D::Selection::get_object_idx() const
|
||||||
{
|
{
|
||||||
return (m_cache.content.size() == 1) ? m_cache.content.begin()->first : -1;
|
return (m_cache.content.size() == 1) ? m_cache.content.begin()->first : -1;
|
||||||
|
|
|
@ -532,6 +532,7 @@ public:
|
||||||
bool is_wipe_tower() const { return m_type == WipeTower; }
|
bool is_wipe_tower() const { return m_type == WipeTower; }
|
||||||
bool is_modifier() const { return (m_type == SingleModifier) || (m_type == MultipleModifier); }
|
bool is_modifier() const { return (m_type == SingleModifier) || (m_type == MultipleModifier); }
|
||||||
bool is_single_modifier() const { return m_type == SingleModifier; }
|
bool is_single_modifier() const { return m_type == SingleModifier; }
|
||||||
|
bool is_multiple_modifier() const { return m_type == MultipleModifier; }
|
||||||
bool is_single_full_instance() const;
|
bool is_single_full_instance() const;
|
||||||
bool is_multiple_full_instance() const { return m_type == MultipleFullInstance; }
|
bool is_multiple_full_instance() const { return m_type == MultipleFullInstance; }
|
||||||
bool is_single_full_object() const { return m_type == SingleFullObject; }
|
bool is_single_full_object() const { return m_type == SingleFullObject; }
|
||||||
|
@ -543,6 +544,7 @@ public:
|
||||||
bool is_from_single_object() const;
|
bool is_from_single_object() const;
|
||||||
|
|
||||||
bool contains_volume(unsigned int volume_idx) const { return std::find(m_list.begin(), m_list.end(), volume_idx) != m_list.end(); }
|
bool contains_volume(unsigned int volume_idx) const { return std::find(m_list.begin(), m_list.end(), volume_idx) != m_list.end(); }
|
||||||
|
bool requires_uniform_scale() const;
|
||||||
|
|
||||||
// Returns the the object id if the selection is from a single object, otherwise is -1
|
// Returns the the object id if the selection is from a single object, otherwise is -1
|
||||||
int get_object_idx() const;
|
int get_object_idx() const;
|
||||||
|
|
|
@ -261,6 +261,8 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
||||||
{
|
{
|
||||||
reset_settings_value();
|
reset_settings_value();
|
||||||
move_label = _(L("Translate:"));
|
move_label = _(L("Translate:"));
|
||||||
|
rotate_label = _(L("Rotate:"));
|
||||||
|
scale_label = _(L("Scale:"));
|
||||||
update_size_value(selection.get_bounding_box().size());
|
update_size_value(selection.get_bounding_box().size());
|
||||||
m_og->enable();
|
m_og->enable();
|
||||||
}
|
}
|
||||||
|
@ -386,9 +388,7 @@ void ObjectManipulation::change_scale_value(const Vec3d& scale)
|
||||||
{
|
{
|
||||||
Vec3d scaling_factor = scale;
|
Vec3d scaling_factor = scale;
|
||||||
const GLCanvas3D::Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
|
const GLCanvas3D::Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
|
||||||
bool needs_uniform_scale = selection.is_single_full_object() && !selection.is_single_full_instance();
|
if (selection.requires_uniform_scale())
|
||||||
|
|
||||||
if (needs_uniform_scale)
|
|
||||||
{
|
{
|
||||||
Vec3d abs_scale_diff = (scale - cache_scale).cwiseAbs();
|
Vec3d abs_scale_diff = (scale - cache_scale).cwiseAbs();
|
||||||
double max_diff = abs_scale_diff(X);
|
double max_diff = abs_scale_diff(X);
|
||||||
|
|
Loading…
Add table
Reference in a new issue