Fixed extra "Add_Selection" snapshot on call context menu from scene

+ Added take_snapshot for toggle_instance_printable_state
This commit is contained in:
YuSanka 2019-08-09 09:49:10 +02:00
parent 52702769d4
commit 0a9c5a9433
3 changed files with 13 additions and 3 deletions

View file

@ -2921,7 +2921,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
&& m_gizmos.get_current_type() != GLGizmosManager::SlaSupports) // disable context menu when the gizmo is open
{
// forces the selection of the volume
m_selection.add(volume_idx);
/* m_selection.add(volume_idx); // #et_FIXME_if_needed
* To avoid extra "Add-Selection" snapshots,
* call add() with check_for_already_contained=true
* */
m_selection.add(volume_idx, true, true);
m_gizmos.refresh_on_off_state();
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
m_gizmos.update_data();

View file

@ -2646,7 +2646,6 @@ void Plater::priv::reset()
void Plater::priv::mirror(Axis axis)
{
this->take_snapshot(_(L("Mirror")));
view3D->mirror_selection(axis);
}

View file

@ -1475,7 +1475,14 @@ void Selection::toggle_instance_printable_state()
if ((0 <= instance_idx) && (instance_idx < (int)model_object->instances.size()))
{
ModelInstance* instance = model_object->instances[instance_idx];
instance->printable = !instance->printable;
const bool printable = !instance->printable;
wxString snapshot_text = model_object->instances.size() == 1 ? wxString::Format("%s %s",
printable ? _(L("Set Printable")) : _(L("Set Unprintable")), model_object->name) :
printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance"));
wxGetApp().plater()->take_snapshot(snapshot_text);
instance->printable = printable;
for (GLVolume* volume : *m_volumes)
{