This commit is contained in:
Enrico Turri 2018-12-18 14:10:07 +01:00
commit 4b55126765
3 changed files with 13 additions and 3 deletions

View File

@ -1478,6 +1478,14 @@ bool GLCanvas3D::Selection::is_from_single_object() const
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
{
return (m_cache.content.size() == 1) ? m_cache.content.begin()->first : -1;

View File

@ -532,6 +532,7 @@ public:
bool is_wipe_tower() const { return m_type == WipeTower; }
bool is_modifier() const { return (m_type == SingleModifier) || (m_type == MultipleModifier); }
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_multiple_full_instance() const { return m_type == MultipleFullInstance; }
bool is_single_full_object() const { return m_type == SingleFullObject; }
@ -543,6 +544,7 @@ public:
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 requires_uniform_scale() const;
// Returns the the object id if the selection is from a single object, otherwise is -1
int get_object_idx() const;

View File

@ -261,6 +261,8 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
{
reset_settings_value();
move_label = _(L("Translate:"));
rotate_label = _(L("Rotate:"));
scale_label = _(L("Scale:"));
update_size_value(selection.get_bounding_box().size());
m_og->enable();
}
@ -386,9 +388,7 @@ void ObjectManipulation::change_scale_value(const Vec3d& scale)
{
Vec3d scaling_factor = scale;
const GLCanvas3D::Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
bool needs_uniform_scale = selection.is_single_full_object() && !selection.is_single_full_instance();
if (needs_uniform_scale)
if (selection.requires_uniform_scale())
{
Vec3d abs_scale_diff = (scale - cache_scale).cwiseAbs();
double max_diff = abs_scale_diff(X);