Added type "MultipleFullObject" to Selection
+ Fixed updating of the name of the manipulation pane + Changed logic of "Ctrl+A" inside the object list
This commit is contained in:
parent
96249792f6
commit
aa3e4c294a
@ -1863,6 +1863,19 @@ void GLCanvas3D::Selection::_update_type()
|
||||
else if ((selected_instances_count > 1) && (selected_instances_count * volumes_count == (unsigned int)m_list.size()))
|
||||
m_type = MultipleFullInstance;
|
||||
}
|
||||
else
|
||||
{
|
||||
int sels_cntr = 0;
|
||||
for (ObjectIdxsToInstanceIdxsMap::iterator it = m_cache.content.begin(); it != m_cache.content.end(); ++it)
|
||||
{
|
||||
const ModelObject* model_object = m_model->objects[it->first];
|
||||
unsigned int volumes_count = (unsigned int)model_object->volumes.size();
|
||||
unsigned int instances_count = (unsigned int)model_object->instances.size();
|
||||
sels_cntr += volumes_count * instances_count;
|
||||
}
|
||||
if (sels_cntr == (unsigned int)m_list.size())
|
||||
m_type = MultipleFullObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1915,6 +1928,11 @@ void GLCanvas3D::Selection::_update_type()
|
||||
std::cout << "selection type: SingleFullObject" << std::endl;
|
||||
break;
|
||||
}
|
||||
case MultipleFullObject:
|
||||
{
|
||||
std::cout << "selection type: MultipleFullObject" << std::endl;
|
||||
break;
|
||||
}
|
||||
case SingleFullInstance:
|
||||
{
|
||||
std::cout << "selection type: SingleFullInstance" << std::endl;
|
||||
|
@ -378,6 +378,7 @@ public:
|
||||
SingleVolume,
|
||||
MultipleVolume,
|
||||
SingleFullObject,
|
||||
MultipleFullObject,
|
||||
SingleFullInstance,
|
||||
MultipleFullInstance,
|
||||
Mixed
|
||||
@ -491,6 +492,7 @@ public:
|
||||
bool is_single_full_instance() const;
|
||||
bool is_multiple_full_instance() const { return m_type == MultipleFullInstance; }
|
||||
bool is_single_full_object() const { return m_type == SingleFullObject; }
|
||||
bool is_multiple_full_object() const { return m_type == MultipleFullObject; }
|
||||
bool is_single_volume() const { return m_type == SingleVolume; }
|
||||
bool is_multiple_volume() const { return m_type == MultipleVolume; }
|
||||
bool is_mixed() const { return m_type == Mixed; }
|
||||
|
@ -324,7 +324,7 @@ void ObjectList::key_event(wxKeyEvent& event)
|
||||
remove();
|
||||
}
|
||||
else if (wxGetKeyState(wxKeyCode('A')) && wxGetKeyState(WXK_CONTROL))
|
||||
select_all();
|
||||
select_item_all_children();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
@ -996,11 +996,16 @@ void ObjectList::parts_changed(int obj_idx)
|
||||
|
||||
void ObjectList::part_selection_changed()
|
||||
{
|
||||
auto item = GetSelection();
|
||||
int obj_idx = -1;
|
||||
ConfigOptionsGroup* og = wxGetApp().obj_manipul()->get_og();
|
||||
m_config = nullptr;
|
||||
wxString object_name = wxEmptyString;
|
||||
|
||||
if (multiple_selection())
|
||||
og->set_name(" " + _(L("Group manipulation")) + " ");
|
||||
else
|
||||
{
|
||||
const auto item = GetSelection();
|
||||
if (item)
|
||||
{
|
||||
const bool is_settings_item = m_objects_model->IsSettingsItem(item);
|
||||
@ -1035,6 +1040,9 @@ void ObjectList::part_selection_changed()
|
||||
const auto volume_id = m_objects_model->GetVolumeIdByItem(item);
|
||||
m_config = &(*m_objects)[obj_idx]->volumes[volume_id]->config;
|
||||
}
|
||||
else if (m_objects_model->GetItemType(item) == itInstance) {
|
||||
og_name = _(L("Instance manipulation"));
|
||||
}
|
||||
}
|
||||
|
||||
og->set_name(" " + og_name + " ");
|
||||
@ -1042,6 +1050,7 @@ void ObjectList::part_selection_changed()
|
||||
if (m_default_config) delete m_default_config;
|
||||
m_default_config = DynamicPrintConfig::new_from_defaults_keys(get_options(is_part));
|
||||
}
|
||||
}
|
||||
og->set_value("object_name", object_name);
|
||||
|
||||
wxGetApp().obj_manipul()->update_settings_list();
|
||||
@ -1209,9 +1218,16 @@ void ObjectList::update_selections()
|
||||
auto& selection = _3DScene::get_canvas(wxGetApp().canvas3D())->get_selection();
|
||||
wxDataViewItemArray sels;
|
||||
|
||||
if (selection.is_single_full_object() || selection.is_single_volume() || selection.is_multiple_volume()) {
|
||||
if (selection.is_single_full_object())
|
||||
{
|
||||
sels.Add(m_objects_model->GetItemById(selection.get_object_idx()));
|
||||
}
|
||||
else if (selection.is_single_volume() || selection.is_multiple_volume() || selection.is_multiple_full_object()) {
|
||||
for (auto idx : selection.get_volume_idxs()) {
|
||||
const auto gl_vol = selection.get_volume(idx);
|
||||
if (selection.is_multiple_full_object())
|
||||
sels.Add(m_objects_model->GetItemById(gl_vol->object_idx()));
|
||||
else
|
||||
sels.Add(m_objects_model->GetItemByVolumeId(gl_vol->object_idx(), gl_vol->volume_idx()));
|
||||
}
|
||||
}
|
||||
@ -1303,6 +1319,27 @@ void ObjectList::select_all()
|
||||
selection_changed();
|
||||
}
|
||||
|
||||
void ObjectList::select_item_all_children()
|
||||
{
|
||||
wxDataViewItemArray sels;
|
||||
|
||||
// There is no selection before OR some object is selected => select all objects
|
||||
if (!GetSelection() || m_objects_model->GetItemType(GetSelection()) == itObject) {
|
||||
for (int i = 0; i < m_objects->size(); i++)
|
||||
sels.Add(m_objects_model->GetItemById(i));
|
||||
}
|
||||
else {
|
||||
const auto item = GetSelection();
|
||||
// Some volume(instance) is selected => select all volumes(instances) inside the current object
|
||||
if (m_objects_model->GetItemType(item) & (itVolume | itInstance)) {
|
||||
m_objects_model->GetChildren(m_objects_model->GetParent(item), sels);
|
||||
}
|
||||
}
|
||||
|
||||
SetSelections(sels);
|
||||
selection_changed();
|
||||
}
|
||||
|
||||
void ObjectList::fix_multiselection_conflicts()
|
||||
{
|
||||
if (GetSelectedItemsCount() <= 1)
|
||||
@ -1314,7 +1351,7 @@ void ObjectList::fix_multiselection_conflicts()
|
||||
GetSelections(sels);
|
||||
|
||||
for (auto item : sels) {
|
||||
if (m_objects_model->IsSettingsItem(item))
|
||||
if (m_objects_model->GetItemType(item) & (itSettings|itInstanceRoot))
|
||||
Unselect(item);
|
||||
else if (m_objects_model->GetParent(item) != wxDataViewItem(0))
|
||||
Unselect(m_objects_model->GetParent(item));
|
||||
|
@ -143,6 +143,7 @@ public:
|
||||
void select_item(const wxDataViewItem& item);
|
||||
void select_items(const wxDataViewItemArray& sels);
|
||||
void select_all();
|
||||
void select_item_all_children();
|
||||
// correct current selections to avoid of the possible conflicts
|
||||
void fix_multiselection_conflicts();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user