Added a modifier selection in the object list

+ set box-subobject's center to the objects center
+ fixed bug in PrusaObjectDataViewModel.Delete(), when deleting last volume_idx
This commit is contained in:
YuSanka 2018-11-12 16:03:29 +01:00
parent df658713bf
commit d20bac7039
3 changed files with 11 additions and 4 deletions

View File

@ -704,7 +704,7 @@ void ObjectList::load_subobject(int type)
parts_changed(obj_idx);
for (int i = 0; i < part_names.size(); ++i) {
const wxDataViewItem sel_item = m_objects_model->AddVolumeChild(item, part_names.Item(i), /**m_bmp_vector[*/type/*]*/);
const wxDataViewItem sel_item = m_objects_model->AddVolumeChild(item, part_names.Item(i), type);
if (i == part_names.size() - 1)
select_item(sel_item);
@ -786,8 +786,11 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const int
const auto& sz = BoundingBoxf(bed_shape).size();
const auto side = 0.1 * std::max(sz(0), sz(1));
if (type_name == _("Box"))
if (type_name == _("Box")) {
mesh = make_cube(side, side, side);
// box sets the base coordinate at 0, 0, move to center of plate
mesh.translate(-side * 0.5, -side * 0.5, 0);
}
else if (type_name == _("Cylinder"))
mesh = make_cylinder(0.5*side, side);
else if (type_name == _("Sphere"))
@ -1251,7 +1254,8 @@ void ObjectList::update_selections()
{
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()) {
else if (selection.is_single_volume() || selection.is_modifier() ||
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())

View File

@ -86,6 +86,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent):
if (option_name == "Rotation")
def.min = -360;
else
def.min == -1000;
const std::string lower_name = boost::algorithm::to_lower_copy(option_name);
@ -164,7 +166,7 @@ int ObjectManipulation::ol_selection()
void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& selection)
{
#if ENABLE_MODELVOLUME_TRANSFORM
if (selection.is_single_full_instance())
if (selection.is_single_full_instance() || selection.is_single_full_object())
#else
if (selection.is_single_full_object())
{

View File

@ -641,6 +641,7 @@ wxDataViewItem PrusaObjectDataViewModel::Delete(const wxDataViewItem &item)
PrusaObjectDataViewModelNode *last_child_node = node_parent->GetNthChild(vol_idx);
DeleteSettings(wxDataViewItem(last_child_node));
node_parent->GetChildren().Remove(last_child_node);
node_parent->m_volumes_cnt = 0;
delete last_child_node;
#ifndef __WXGTK__