Skip to content

Commit

Permalink
Fix model load in debug build (#4656)
Browse files Browse the repository at this point in the history
* Fix model load in debug build

Debug build exit with error on model load due to failed assertion (file
path redacted):

    orca-slicer: <...>/OrcaSlicer/src/libslic3r/Model.cpp:1361: void Slic3r::ModelObject::update_min_max_z(): Assertion `! this->instances.empty()' failed.

Assertion failed due to model->ensure_on_bed() being called for object
which yet to be load from file.

Do not call ensure_on_bed() for models read from file since they may be
read with no default instance.

ensure_on_bed() called later within withing Plater::load_model_objects()
for each object added.

* Rework according to code review comment
  • Loading branch information
buzzhuzz authored Apr 4, 2024
1 parent 9d81245 commit ff7faca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4056,7 +4056,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
return empty_result;
}

model_object->ensure_on_bed(is_project_file);
if (!model_object->instances.empty())
model_object->ensure_on_bed(is_project_file);
}

tolal_model_count += model_idx;
Expand Down

0 comments on commit ff7faca

Please sign in to comment.