mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
refine the plate's sliced_result logic
1. when the plate is locked, the sliced result is kept after auto-arrange; 2. when only arrange a plate, other plates' results are not affected Change-Id: I7566e11e9eec0c2b196a2e78d9dc306ea325e9ff
This commit is contained in:
parent
8386b48554
commit
516a960f71
3 changed files with 32 additions and 17 deletions
|
@ -1162,12 +1162,14 @@ void PartPlate::set_index(int index)
|
|||
m_print->set_plate_index(index);
|
||||
}
|
||||
|
||||
void PartPlate::clear()
|
||||
void PartPlate::clear(bool clear_sliced_result)
|
||||
{
|
||||
obj_to_instance_set.clear();
|
||||
instance_outside_set.clear();
|
||||
m_ready_for_slice = true;
|
||||
update_slice_result_valid_state(false);
|
||||
if (clear_sliced_result) {
|
||||
m_ready_for_slice = true;
|
||||
update_slice_result_valid_state(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -2415,14 +2417,19 @@ void PartPlateList::reset_size(int width, int depth, int height)
|
|||
}
|
||||
|
||||
//clear all the instances in the plate, but keep the plates
|
||||
void PartPlateList::clear(bool delete_plates, bool release_print_list)
|
||||
void PartPlateList::clear(bool delete_plates, bool release_print_list, bool except_locked, int plate_index)
|
||||
{
|
||||
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
||||
{
|
||||
PartPlate* plate = m_plate_list[i];
|
||||
assert(plate != NULL);
|
||||
|
||||
plate->clear();
|
||||
if (except_locked && plate->is_locked())
|
||||
plate->clear(false);
|
||||
else if ((plate_index != -1) && (plate_index != i))
|
||||
plate->clear(false);
|
||||
else
|
||||
plate->clear();
|
||||
if (delete_plates)
|
||||
delete plate;
|
||||
}
|
||||
|
@ -3202,12 +3209,12 @@ int PartPlateList::add_to_plate(int obj_id, int instance_id, int plate_id)
|
|||
}
|
||||
|
||||
//reload all objects
|
||||
int PartPlateList::reload_all_objects()
|
||||
int PartPlateList::reload_all_objects(bool except_locked, int plate_index)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int i, j, k;
|
||||
|
||||
clear();
|
||||
clear(false, false, except_locked, plate_index);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": m_model->objects.size() is %1%") % m_model->objects.size();
|
||||
//try to find a new plate
|
||||
|
@ -3945,7 +3952,7 @@ int PartPlateList::rebuild_plates_after_deserialize(std::vector<bool>& previous_
|
|||
}
|
||||
|
||||
//retruct plates structures after auto-arrangement
|
||||
int PartPlateList::rebuild_plates_after_arrangement(bool recycle_plates)
|
||||
int PartPlateList::rebuild_plates_after_arrangement(bool recycle_plates, bool except_locked, int plate_index)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -3956,7 +3963,7 @@ int PartPlateList::rebuild_plates_after_arrangement(bool recycle_plates)
|
|||
//for (auto object : m_model->objects)
|
||||
// std::sort(object->instances.begin(), object->instances.end(), [](auto a, auto b) {return a->arrange_order < b->arrange_order; });
|
||||
|
||||
ret = reload_all_objects();
|
||||
ret = reload_all_objects(except_locked, plate_index);
|
||||
|
||||
if (recycle_plates)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue