fixed bug with instancing
This commit is contained in:
parent
49b68b936c
commit
a57e2a22f6
@ -202,6 +202,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GeneratedSupportPoints{
|
||||||
|
Transform3d object_transform; // for frontend object mapping
|
||||||
|
SupportSpotsGenerator::SupportPoints support_points;
|
||||||
|
};
|
||||||
|
|
||||||
std::vector<std::unique_ptr<PrintRegion>> all_regions;
|
std::vector<std::unique_ptr<PrintRegion>> all_regions;
|
||||||
std::vector<LayerRangeRegions> layer_ranges;
|
std::vector<LayerRangeRegions> layer_ranges;
|
||||||
// Transformation of this ModelObject into one of the associated PrintObjects (all PrintObjects derived from a single modelObject differ by a Z rotation only).
|
// Transformation of this ModelObject into one of the associated PrintObjects (all PrintObjects derived from a single modelObject differ by a Z rotation only).
|
||||||
@ -209,7 +214,7 @@ public:
|
|||||||
Transform3d trafo_bboxes;
|
Transform3d trafo_bboxes;
|
||||||
std::vector<ObjectID> cached_volume_ids;
|
std::vector<ObjectID> cached_volume_ids;
|
||||||
|
|
||||||
SupportSpotsGenerator::SupportPoints generated_support_points;
|
std::optional<GeneratedSupportPoints> generated_support_points;
|
||||||
|
|
||||||
void ref_cnt_inc() { ++ m_ref_cnt; }
|
void ref_cnt_inc() { ++ m_ref_cnt; }
|
||||||
void ref_cnt_dec() { if (-- m_ref_cnt == 0) delete this; }
|
void ref_cnt_dec() { if (-- m_ref_cnt == 0) delete this; }
|
||||||
@ -217,7 +222,7 @@ public:
|
|||||||
all_regions.clear();
|
all_regions.clear();
|
||||||
layer_ranges.clear();
|
layer_ranges.clear();
|
||||||
cached_volume_ids.clear();
|
cached_volume_ids.clear();
|
||||||
generated_support_points.clear();
|
generated_support_points.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -419,10 +419,12 @@ void PrintObject::generate_support_spots()
|
|||||||
if (this->set_started(posSupportSpotsSearch)) {
|
if (this->set_started(posSupportSpotsSearch)) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Searching support spots - start";
|
BOOST_LOG_TRIVIAL(debug) << "Searching support spots - start";
|
||||||
m_print->set_status(75, L("Searching support spots"));
|
m_print->set_status(75, L("Searching support spots"));
|
||||||
SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values};
|
if (!this->shared_regions()->generated_support_points.has_value()) {
|
||||||
SupportSpotsGenerator::SupportPoints supp_points = SupportSpotsGenerator::full_search(this, params);
|
SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values};
|
||||||
this->m_shared_regions->generated_support_points = supp_points;
|
SupportSpotsGenerator::SupportPoints supp_points = SupportSpotsGenerator::full_search(this, params);
|
||||||
m_print->throw_if_canceled();
|
this->m_shared_regions->generated_support_points = {this->trafo_centered(), supp_points};
|
||||||
|
m_print->throw_if_canceled();
|
||||||
|
}
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Searching support spots - end";
|
BOOST_LOG_TRIVIAL(debug) << "Searching support spots - end";
|
||||||
this->set_done(posSupportSpotsSearch);
|
this->set_done(posSupportSpotsSearch);
|
||||||
}
|
}
|
||||||
|
@ -405,13 +405,17 @@ void GLGizmoFdmSupports::apply_data_from_backend()
|
|||||||
if (!has_backend_supports())
|
if (!has_backend_supports())
|
||||||
return;
|
return;
|
||||||
ModelObject *mo = m_c->selection_info()->model_object();
|
ModelObject *mo = m_c->selection_info()->model_object();
|
||||||
|
if (!mo) {
|
||||||
|
this->waiting_for_autogenerated_supports = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// find the respective PrintObject, we need a pointer to it
|
// find the respective PrintObject, we need a pointer to it
|
||||||
for (const PrintObject *po : m_parent.fff_print()->objects()) {
|
for (const PrintObject *po : m_parent.fff_print()->objects()) {
|
||||||
if (po->model_object()->id() == mo->id()) {
|
if (po->model_object()->id() == mo->id()) {
|
||||||
std::unordered_map<size_t, TriangleSelectorWrapper> selectors;
|
std::unordered_map<size_t, TriangleSelectorWrapper> selectors;
|
||||||
SupportSpotsGenerator::SupportPoints support_points = po->shared_regions()->generated_support_points;
|
SupportSpotsGenerator::SupportPoints support_points = po->shared_regions()->generated_support_points->support_points;
|
||||||
auto obj_transform = po->trafo_centered();
|
auto obj_transform = po->shared_regions()->generated_support_points->object_transform;
|
||||||
for (ModelVolume *model_volume : po->model_object()->volumes) {
|
for (ModelVolume *model_volume : po->model_object()->volumes) {
|
||||||
if (model_volume->is_model_part()) {
|
if (model_volume->is_model_part()) {
|
||||||
Transform3d mesh_transformation = obj_transform * model_volume->get_matrix();
|
Transform3d mesh_transformation = obj_transform * model_volume->get_matrix();
|
||||||
|
Loading…
Reference in New Issue
Block a user