This commit is contained in:
Vojtech Bubnik 2023-03-06 10:47:47 +01:00
commit 384eebadcc
3 changed files with 30 additions and 0 deletions

View File

@ -1840,6 +1840,7 @@ void ObjectList::load_mesh_object(
const TextConfiguration *text_config /* = nullptr*/,
const Transform3d * transformation /* = nullptr*/)
{
PlaterAfterLoadAutoArrange plater_after_load_auto_arrange;
// Add mesh to model as a new object
Model& model = wxGetApp().plater()->model();

View File

@ -2440,6 +2440,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
auto *nozzle_dmrs = config->opt<ConfigOptionFloats>("nozzle_diameter");
PlaterAfterLoadAutoArrange plater_after_load_auto_arrange;
bool one_by_one = input_files.size() == 1 || printer_technology == ptSLA || nozzle_dmrs->values.size() <= 1;
if (! one_by_one) {
for (const auto &path : input_files) {
@ -2699,6 +2701,9 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
new_model->add_object(*model_object);
}
}
if (is_project_file)
plater_after_load_auto_arrange.disable();
}
}
@ -7588,4 +7593,18 @@ SuppressBackgroundProcessingUpdate::~SuppressBackgroundProcessingUpdate()
wxGetApp().plater()->schedule_background_process(m_was_scheduled);
}
PlaterAfterLoadAutoArrange::PlaterAfterLoadAutoArrange()
{
Plater* plater = wxGetApp().plater();
m_enabled = plater->model().objects.empty() &&
plater->printer_technology() == ptFFF &&
plater->fff_print().config().printer_model.value == "XL";
}
PlaterAfterLoadAutoArrange::~PlaterAfterLoadAutoArrange()
{
if (m_enabled)
wxGetApp().plater()->arrange();
}
}} // namespace Slic3r::GUI

View File

@ -507,6 +507,16 @@ private:
bool m_was_scheduled;
};
class PlaterAfterLoadAutoArrange
{
bool m_enabled{ false };
public:
PlaterAfterLoadAutoArrange();
~PlaterAfterLoadAutoArrange();
void disable() { m_enabled = false; }
};
} // namespace GUI
} // namespace Slic3r