Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_seams_as_models
This commit is contained in:
commit
077dc25bfd
@ -258,6 +258,7 @@ int CLI::run(int argc, char **argv)
|
||||
Points bed = get_bed_shape(m_print_config);
|
||||
ArrangeParams arrange_cfg;
|
||||
arrange_cfg.min_obj_distance = scaled(min_object_distance(m_print_config));
|
||||
bool user_ensure_on_bed = true;
|
||||
|
||||
for (auto const &opt_key : m_transforms) {
|
||||
if (opt_key == "merge") {
|
||||
@ -330,6 +331,10 @@ int CLI::run(int argc, char **argv)
|
||||
}
|
||||
} else if (opt_key == "dont_arrange") {
|
||||
// do nothing - this option alters other transform options
|
||||
} else if (opt_key == "dont_ensure_on_bed") {
|
||||
// Remember that we saw this so we don't lift objects from the bed
|
||||
// after the other transformations are processed.
|
||||
user_ensure_on_bed = false;
|
||||
} else if (opt_key == "rotate") {
|
||||
for (auto &model : m_models)
|
||||
for (auto &o : model.objects)
|
||||
@ -432,6 +437,13 @@ int CLI::run(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
// All transforms have been dealt with. Now ensure that the objects are on bed.
|
||||
// (Unless the user said otherwise.)
|
||||
if (user_ensure_on_bed)
|
||||
for (auto &model : m_models)
|
||||
for (auto &o : model.objects)
|
||||
o->ensure_on_bed();
|
||||
|
||||
// loop through action options
|
||||
for (auto const &opt_key : m_actions) {
|
||||
if (opt_key == "help") {
|
||||
|
@ -1745,18 +1745,15 @@ void ModelVolume::scale(const Vec3d& scaling_factors)
|
||||
|
||||
void ModelObject::scale_to_fit(const Vec3d &size)
|
||||
{
|
||||
/*
|
||||
BoundingBoxf3 instance_bounding_box(size_t instance_idx, bool dont_translate = false) const;
|
||||
Vec3d orig_size = this->bounding_box().size();
|
||||
float factor = fminf(
|
||||
size.x / orig_size.x,
|
||||
fminf(
|
||||
size.y / orig_size.y,
|
||||
size.z / orig_size.z
|
||||
double factor = std::min(
|
||||
size.x() / orig_size.x(),
|
||||
std::min(
|
||||
size.y() / orig_size.y(),
|
||||
size.z() / orig_size.z()
|
||||
)
|
||||
);
|
||||
this->scale(factor);
|
||||
*/
|
||||
}
|
||||
|
||||
void ModelVolume::assign_new_unique_ids_recursive()
|
||||
|
@ -4154,6 +4154,10 @@ CLITransformConfigDef::CLITransformConfigDef()
|
||||
def->label = L("Don't arrange");
|
||||
def->tooltip = L("Do not rearrange the given models before merging and keep their original XY coordinates.");
|
||||
|
||||
def = this->add("dont_ensure_on_bed", coBool);
|
||||
def->label = L("Don't ensure on bed");
|
||||
def->tooltip = L("Do not lift the object above the bed when it is partially below.");
|
||||
|
||||
def = this->add("duplicate", coInt);
|
||||
def->label = L("Duplicate");
|
||||
def->tooltip =L("Multiply copies by this factor.");
|
||||
|
@ -433,7 +433,7 @@ wxMenu* MenuFactory::append_submenu_add_generic(wxMenu* menu, ModelVolumeType ty
|
||||
[type, item](wxCommandEvent&) { obj_list()->load_generic_subobject(item, type); }, "", menu);
|
||||
}
|
||||
|
||||
if (wxGetApp().get_mode() == comExpert) {
|
||||
if (wxGetApp().get_mode() >= comAdvanced) {
|
||||
sub_menu->AppendSeparator();
|
||||
append_menu_item(sub_menu, wxID_ANY, _L("Gallery"), "",
|
||||
[type](wxCommandEvent&) { obj_list()->load_subobject(type, true); }, "", menu);
|
||||
|
@ -2517,7 +2517,7 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
|
||||
}
|
||||
|
||||
|
||||
void ObjectList::update_info_items(size_t obj_idx)
|
||||
void ObjectList::update_info_items(size_t obj_idx, wxDataViewItemArray* selections/* = nullptr*/)
|
||||
{
|
||||
const ModelObject* model_object = (*m_objects)[obj_idx];
|
||||
wxDataViewItem item_obj = m_objects_model->GetItemById(obj_idx);
|
||||
@ -2565,9 +2565,21 @@ void ObjectList::update_info_items(size_t obj_idx)
|
||||
|
||||
}
|
||||
else if (shows && ! should_show) {
|
||||
Unselect(item);
|
||||
if (!selections)
|
||||
Unselect(item);
|
||||
m_objects_model->Delete(item);
|
||||
Select(item_obj);
|
||||
if (selections) {
|
||||
if (selections->Index(item) != wxNOT_FOUND) {
|
||||
// If info item was deleted from the list,
|
||||
// it's need to be deleted from selection array, if it was there
|
||||
selections->Remove(item);
|
||||
// Select item_obj, if info_item doesn't exist for item anymore, but was selected
|
||||
if (selections->Index(item_obj) == wxNOT_FOUND)
|
||||
selections->Add(item_obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
Select(item_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3760,7 +3772,7 @@ void ObjectList::update_object_list_by_printer_technology()
|
||||
|
||||
for (auto& object_item : object_items) {
|
||||
// update custom supports info
|
||||
update_info_items(m_objects_model->GetObjectIdByItem(object_item));
|
||||
update_info_items(m_objects_model->GetObjectIdByItem(object_item), &sel);
|
||||
|
||||
// Update Settings Item for object
|
||||
update_settings_item_and_selection(object_item, sel);
|
||||
|
@ -350,7 +350,7 @@ public:
|
||||
void update_and_show_object_settings_item();
|
||||
void update_settings_item_and_selection(wxDataViewItem item, wxDataViewItemArray& selections);
|
||||
void update_object_list_by_printer_technology();
|
||||
void update_info_items(size_t obj_idx);
|
||||
void update_info_items(size_t obj_idx, wxDataViewItemArray* selections = nullptr);
|
||||
|
||||
void instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idx);
|
||||
void instances_to_separated_objects(const int obj_idx);
|
||||
|
Loading…
Reference in New Issue
Block a user