mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-05 11:17:58 -05:00
Fix: Cant switch to scale gizmo while Modifier painting selected on object list (#17657)
This commit is contained in:
2 files changed
+18
-6
No files matched your search
@@ -297,6 +297,9 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||
wxGetApp().plater()->deselect_all();
|
||||
}
|
||||
else {
|
||||
// A click in the list opens the paint tool again, also on the painted modifier already selected.
|
||||
// Refreshes of the same selection call selection_changed() directly, so they keep the gizmo in use.
|
||||
m_painted_modifier_id = ObjectID();
|
||||
selection_changed();
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
@@ -3952,6 +3955,8 @@ void ObjectList::part_selection_changed()
|
||||
bool disable_ss_manipulation{false};
|
||||
bool disable_ununiform_scale{false};
|
||||
|
||||
const ObjectID last_painted_modifier_id = std::exchange(m_painted_modifier_id, ObjectID());
|
||||
|
||||
const auto item = GetSelection();
|
||||
if (item && m_objects_model->GetItemType(item) == itInfo && m_objects_model->GetInfoItemType(item) == InfoItemType::CutConnectors) {
|
||||
og_name = _L("Cut Connectors information");
|
||||
@@ -4092,8 +4097,12 @@ void ObjectList::part_selection_changed()
|
||||
|
||||
const ModelVolume *volume = (*m_objects)[obj_idx]->volumes[volume_id];
|
||||
enable_manipulation = !((*m_objects)[obj_idx]->is_cut() && (volume->is_cut_connector() || volume->is_model_part()));
|
||||
if (volume->is_painted_modifier() && GetSelectedItemsCount() == 1)
|
||||
open_painted_modifier_tool(*volume);
|
||||
// Open the paint tool once per selection: a refresh of the same selection must neither switch away
|
||||
// from the gizmo in use nor reopen a closed tool, while a click in the list forgets the selection to
|
||||
// open it again. Remember the selection only once the tool has opened, so that a later refresh retries
|
||||
// when the scene selection could not host the tool yet.
|
||||
if (volume->is_painted_modifier() && GetSelectedItemsCount() == 1 && (volume->id() == last_painted_modifier_id || open_painted_modifier_tool(*volume)))
|
||||
m_painted_modifier_id = volume->id();
|
||||
}
|
||||
else if (type & itInstance) {
|
||||
og_name = _L("Instance manipulation");
|
||||
@@ -5898,13 +5907,14 @@ ModelVolume *ObjectList::add_painted_modifier(int obj_idx, const ModelVolume &ho
|
||||
return painted_modifier;
|
||||
}
|
||||
|
||||
void ObjectList::open_painted_modifier_tool(const ModelVolume &painted_modifier)
|
||||
bool ObjectList::open_painted_modifier_tool(const ModelVolume &painted_modifier)
|
||||
{
|
||||
GLGizmosManager &gizmos_mgr = wxGetApp().plater()->get_view3D_canvas3D()->get_gizmos_manager();
|
||||
if (auto *gizmo = dynamic_cast<GLGizmoPaintedModifier *>(gizmos_mgr.get_gizmo(GLGizmosManager::EType::PaintedModifier)))
|
||||
gizmo->set_target(&painted_modifier);
|
||||
if (gizmos_mgr.get_current_type() != GLGizmosManager::EType::PaintedModifier)
|
||||
gizmos_mgr.open_gizmo(GLGizmosManager::EType::PaintedModifier);
|
||||
// It opens only on a single full instance in the scene.
|
||||
return gizmos_mgr.get_current_type() == GLGizmosManager::EType::PaintedModifier ||
|
||||
gizmos_mgr.open_gizmo(GLGizmosManager::EType::PaintedModifier);
|
||||
}
|
||||
|
||||
void ObjectList::add_painted_modifier()
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Operations/Outcome.hpp"
|
||||
#include "SyntheticInput.hpp"
|
||||
|
||||
#include "libslic3r/ObjectID.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
||||
class wxBitmap;
|
||||
@@ -232,6 +233,7 @@ private:
|
||||
std::vector<wxBitmap*> m_bmp_vector;
|
||||
|
||||
int m_selected_object_id = -1;
|
||||
ObjectID m_painted_modifier_id; // the selected painted modifier, once its paint tool has been opened
|
||||
bool m_prevent_list_events = false; // We use this flag to avoid circular event handling Select()
|
||||
// happens to fire a wxEVT_LIST_ITEM_SELECTED on OSX, whose event handler
|
||||
// calls this method again and again and again
|
||||
@@ -578,7 +580,7 @@ public:
|
||||
ModelVolume* add_painted_modifier(int obj_idx, const ModelVolume &host, const TriangleSelector *paint = nullptr);
|
||||
// Adds a painted modifier on the selected part or object and selects it.
|
||||
void add_painted_modifier();
|
||||
void open_painted_modifier_tool(const ModelVolume &painted_modifier);
|
||||
bool open_painted_modifier_tool(const ModelVolume &painted_modifier);
|
||||
bool is_painted_modifier_item(const wxDataViewItem &item) const;
|
||||
void apply_volumes_order();
|
||||
|
||||
|
||||
Reference in new issue
Block a user