Merge remote-tracking branch 'origin/master' into ys_printable_property

This commit is contained in:
YuSanka 2019-07-31 12:04:15 +02:00
commit 02324becdb
2 changed files with 26 additions and 14 deletions

View File

@ -798,17 +798,19 @@ void ObjectList::show_context_menu()
void ObjectList::copy()
{
if (m_selection_mode & smLayer)
fill_layer_config_ranges_cache();
else
// if (m_selection_mode & smLayer)
// fill_layer_config_ranges_cache();
// else {
// m_layer_config_ranges_cache.clear();
wxPostEvent((wxEvtHandler*)wxGetApp().plater()->canvas3D()->get_wxglcanvas(), SimpleEvent(EVT_GLTOOLBAR_COPY));
// }
}
void ObjectList::paste()
{
if (!m_layer_config_ranges_cache.empty())
paste_layers_into_list();
else
// if (!m_layer_config_ranges_cache.empty())
// paste_layers_into_list();
// else
wxPostEvent((wxEvtHandler*)wxGetApp().plater()->canvas3D()->get_wxglcanvas(), SimpleEvent(EVT_GLTOOLBAR_PASTE));
}
@ -2809,7 +2811,8 @@ void ObjectList::update_selections_on_canvas()
std::vector<unsigned int> volume_idxs;
Selection::EMode mode = Selection::Volume;
auto add_to_selection = [this, &volume_idxs](const wxDataViewItem& item, const Selection& selection, int instance_idx, Selection::EMode& mode)
bool single_selection = sel_cnt == 1;
auto add_to_selection = [this, &volume_idxs, &single_selection](const wxDataViewItem& item, const Selection& selection, int instance_idx, Selection::EMode& mode)
{
const ItemType& type = m_objects_model->GetItemType(item);
const int obj_idx = m_objects_model->GetObjectIdByItem(item);
@ -2828,6 +2831,7 @@ void ObjectList::update_selections_on_canvas()
else
{
mode = Selection::Instance;
single_selection = false;
std::vector<unsigned int> idxs = selection.get_volume_idxs_from_object(obj_idx);
volume_idxs.insert(volume_idxs.end(), idxs.begin(), idxs.end());
}
@ -2869,7 +2873,7 @@ void ObjectList::update_selections_on_canvas()
// add
volume_idxs = selection.get_unselected_volume_idxs_from(volume_idxs);
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("Selection-Add from list")));
selection.add_volumes(mode, volume_idxs, sel_cnt == 1);
selection.add_volumes(mode, volume_idxs, single_selection);
}
wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state();
@ -2934,6 +2938,7 @@ void ObjectList::select_item_all_children()
// update selection mode for non-multiple selection
void ObjectList::update_selection_mode()
{
m_selected_layers_range_idx=-1;
// All items are unselected
if (!GetSelection())
{

View File

@ -59,7 +59,7 @@ bool GLGizmoSlaSupports::on_init()
void GLGizmoSlaSupports::set_sla_support_data(ModelObject* model_object, const Selection& selection)
{
if (selection.is_empty()) {
if (! model_object || selection.is_empty()) {
m_model_object = nullptr;
return;
}
@ -1031,13 +1031,18 @@ RENDER_AGAIN:
if (remove_selected || remove_all) {
force_refresh = false;
m_parent.set_as_dirty();
if (remove_all) {
if (!m_editing_mode)
bool was_in_editing = m_editing_mode;
if (! was_in_editing)
switch_to_editing_mode();
if (remove_all) {
select_point(AllPoints);
delete_selected_points(true); // true - delete regardless of locked status
editing_mode_apply_changes();
}
if (remove_selected)
delete_selected_points(false); // leave locked points
if (! was_in_editing)
editing_mode_apply_changes();
if (first_run) {
first_run = false;
goto RENDER_AGAIN;
@ -1172,7 +1177,8 @@ void GLGizmoSlaSupports::on_load(cereal::BinaryInputArchive& ar)
m_model_object_id,
m_new_point_head_diameter,
m_normal_cache,
m_editing_cache
m_editing_cache,
m_selection_empty
);
}
@ -1185,7 +1191,8 @@ void GLGizmoSlaSupports::on_save(cereal::BinaryOutputArchive& ar) const
m_model_object_id,
m_new_point_head_diameter,
m_normal_cache,
m_editing_cache
m_editing_cache,
m_selection_empty
);
}