FIX:uniform scale can't be deselected when selecting multiple objects

Change-Id: I4e9c18410ffe45d9db9743c5e0f9c90019c372a2
(cherry picked from commit 9c669cacfce6d23a69993f36e6aebb982fb6ee3b)
This commit is contained in:
zhimin.zeng 2023-01-05 15:56:16 +08:00 committed by Lane.Wei
parent 49673b56e3
commit 3651d4ec15
3 changed files with 21 additions and 16 deletions

View file

@ -226,10 +226,11 @@ void GLGizmoScale3D::on_render()
//draw connections //draw connections
if (single_instance || single_volume) { // BBS: when select multiple objects, uniform scale can be deselected, display the connection(4,5)
//if (single_instance || single_volume) {
glsafe(::glColor4fv(m_grabbers[4].color.data())); glsafe(::glColor4fv(m_grabbers[4].color.data()));
render_grabbers_connection(4, 5); render_grabbers_connection(4, 5);
} //}
glsafe(::glColor4fv(m_grabbers[2].color.data())); glsafe(::glColor4fv(m_grabbers[2].color.data()));
render_grabbers_connection(6, 7); render_grabbers_connection(6, 7);

View file

@ -402,11 +402,12 @@ void GLGizmosManager::update_data()
enable_grabber(Rotate, 0, !is_wipe_tower); enable_grabber(Rotate, 0, !is_wipe_tower);
enable_grabber(Rotate, 1, !is_wipe_tower); enable_grabber(Rotate, 1, !is_wipe_tower);
bool enable_scale_xyz = selection.is_single_full_instance() || selection.is_single_volume() || selection.is_single_modifier(); // BBS: when select multiple objects, uniform scale can be deselected, display the 0-5 grabbers
for (unsigned int i = 0; i < 6; ++i) //bool enable_scale_xyz = selection.is_single_full_instance() || selection.is_single_volume() || selection.is_single_modifier();
{ //for (unsigned int i = 0; i < 6; ++i)
enable_grabber(Scale, i, enable_scale_xyz); //{
} // enable_grabber(Scale, i, enable_scale_xyz);
//}
if (m_common_gizmos_data) { if (m_common_gizmos_data) {
m_common_gizmos_data->update(get_current() m_common_gizmos_data->update(get_current()

View file

@ -356,7 +356,8 @@ void GizmoObjectManipulation::do_scale(int axis, const Vec3d &scale) const
transformation_type.set_local(); transformation_type.set_local();
} }
if (m_uniform_scale || selection.requires_uniform_scale()) // BBS: when select multiple objects, uniform scale can be deselected
if (m_uniform_scale/* || selection.requires_uniform_scale()*/)
scaling_factor = scale(axis) * Vec3d::Ones(); scaling_factor = scale(axis) * Vec3d::Ones();
selection.start_dragging(); selection.start_dragging();
@ -883,16 +884,18 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
bool uniform_scale = this->m_uniform_scale; bool uniform_scale = this->m_uniform_scale;
const Selection &selection = m_glcanvas.get_selection(); // BBS: when select multiple objects, uniform scale can be deselected
bool uniform_scale_only = selection.is_multiple_full_object() || selection.is_multiple_full_instance() || selection.is_mixed() || selection.is_multiple_volume() || selection.is_multiple_modifier(); //const Selection &selection = m_glcanvas.get_selection();
//bool uniform_scale_only = selection.is_multiple_full_object() || selection.is_multiple_full_instance() || selection.is_mixed() || selection.is_multiple_volume() ||
// selection.is_multiple_modifier();
if (uniform_scale_only) { //if (uniform_scale_only) {
imgui_wrapper->disabled_begin(true); // imgui_wrapper->disabled_begin(true);
imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale_only); // imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale_only);
imgui_wrapper->disabled_end(); // imgui_wrapper->disabled_end();
} else { //} else {
imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale); imgui_wrapper->bbl_checkbox(_L("uniform scale"), uniform_scale);
} //}
if (uniform_scale != this->m_uniform_scale) { this->set_uniform_scaling(uniform_scale); } if (uniform_scale != this->m_uniform_scale) { this->set_uniform_scaling(uniform_scale); }
// for (int index = 0; index < 3; index++) // for (int index = 0; index < 3; index++)