ENH: Add "Drop" button to move gizmo for objects, parts, and modifiers. And unify all Drop actions / checks (#16323)

* Add Drop to bed button for objects, parts and modifiers to the Position panel

Ported from BambuStudio PR #11511. The button appears under the position
inputs when the selection is not resting on the bed and moves it along
global Z. Works for a single full instance as well as a single part or
modifier, and is undoable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N7uDtamzhNGT6PFwmVdRJ8

* Reuse existing 'Drop to Bed' string so the button is already translated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N7uDtamzhNGT6PFwmVdRJ8

* Add tooltip to the Drop to Bed button

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N7uDtamzhNGT6PFwmVdRJ8

* unify function usage across UI

* Update GizmoObjectManipulation.cpp

* show tooltip even its disabled

* update

* Update GizmoObjectManipulation.cpp

* update

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: yw4z <ywsyildiz@gmail.com>
This commit is contained in:
Eldenroot
2026-10-15 03:22:28 +03:00
committed by GitHub
co-authored by Claude Sonnet 5.5 yw4z
parent 70e5b330be
commit 6a7763f08d
6 changed files with 46 additions and 28 deletions
+26 -4
View File
@@ -558,15 +558,37 @@ void Selection::center()
return;
}
double Selection::get_drop_min_z() const
{
if (!m_valid)
return 0.;
if (m_mode == Volume)
return get_bounding_box().min.z();
double min_z = DBL_MAX;
for (const auto& [obj_idx, inst_idxs] : m_cache.content) {
if (obj_idx >= (int)m_model->objects.size())
continue; // wipe tower
for (int inst_idx : inst_idxs)
min_z = std::min(min_z, m_model->objects[obj_idx]->get_instance_min_z(inst_idx));
}
return min_z == DBL_MAX ? 0. : min_z;
}
bool Selection::can_drop() const
{
return std::abs(get_drop_min_z()) > -SINKING_Z_THRESHOLD;
}
void Selection::drop()
{
if (std::abs(this->get_bounding_box().min.z()) < -SINKING_Z_THRESHOLD) {
return; // shouldnt happen, but better check anyways, already checked in append_menu_item_drop()
}
const double min_z = get_drop_min_z();
if (std::abs(min_z) < -SINKING_Z_THRESHOLD)
return; // already checked in can_drop()
wxGetApp().plater()->take_snapshot(L("Move object"));
this->move_to_center(Vec3d(0, 0, -this->get_bounding_box().min.z()));
this->move_to_center(Vec3d(0, 0, -min_z));
for (unsigned int i : m_list) {
GLVolume& volume = *(*m_volumes)[i];