mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
More robust fix for 3D view and GUI buttons not in synch when object's size is almost identical to print volume's size
This commit is contained in:
parent
973060c728
commit
71d9500b2e
11 changed files with 33 additions and 76 deletions
|
@ -643,29 +643,40 @@ void GLVolumeCollection::render_legacy() const
|
|||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void GLVolumeCollection::update_outside_state(const DynamicPrintConfig* config, bool all_inside)
|
||||
bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config)
|
||||
{
|
||||
if (config == nullptr)
|
||||
return;
|
||||
return false;
|
||||
|
||||
const ConfigOptionPoints* opt = dynamic_cast<const ConfigOptionPoints*>(config->option("bed_shape"));
|
||||
if (opt == nullptr)
|
||||
return;
|
||||
return false;
|
||||
|
||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
||||
BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min.x), unscale(bed_box_2D.min.y), 0.0), Pointf3(unscale(bed_box_2D.max.x), unscale(bed_box_2D.max.y), config->opt_float("max_print_height")));
|
||||
// Allow the objects to protrude below the print bed
|
||||
print_volume.min.z = -1e10;
|
||||
|
||||
bool contained = true;
|
||||
for (GLVolume* volume : this->volumes)
|
||||
{
|
||||
if (all_inside)
|
||||
if (volume != nullptr)
|
||||
{
|
||||
volume->is_outside = false;
|
||||
continue;
|
||||
bool state = print_volume.contains(volume->transformed_bounding_box());
|
||||
contained &= state;
|
||||
volume->is_outside = !state;
|
||||
}
|
||||
}
|
||||
|
||||
volume->is_outside = !print_volume.contains_quantized(volume->transformed_bounding_box());
|
||||
return contained;
|
||||
}
|
||||
|
||||
void GLVolumeCollection::reset_outside_state()
|
||||
{
|
||||
for (GLVolume* volume : this->volumes)
|
||||
{
|
||||
if (volume != nullptr)
|
||||
volume->is_outside = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -422,7 +422,9 @@ public:
|
|||
print_box_max[0] = max_x; print_box_max[1] = max_y; print_box_max[2] = max_z;
|
||||
}
|
||||
|
||||
void update_outside_state(const DynamicPrintConfig* config, bool all_inside);
|
||||
bool check_outside_state(const DynamicPrintConfig* config);
|
||||
void reset_outside_state();
|
||||
|
||||
void update_colors_by_extruder(const DynamicPrintConfig* config);
|
||||
|
||||
// Returns a vector containing the sorted list of all the print_zs of the volumes contained in this collection
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue