mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-27 00:24:00 -06:00
Print/PrintObject/PrintRegion refactoring:
Newly the PrintObjects own PrintRegions and Print contains references to PrintRegions owned by PrintObjects, so that a PrintRegion of the same content is referenced by Print only once. The refactoring is a WIP to support multi-material painting.
This commit is contained in:
parent
123c5af347
commit
0ca6b12da1
5 changed files with 122 additions and 149 deletions
|
@ -31,6 +31,9 @@ namespace Slic3r {
|
|||
template class PrintState<PrintStep, psCount>;
|
||||
template class PrintState<PrintObjectStep, posCount>;
|
||||
|
||||
PrintRegion::PrintRegion(const PrintRegionConfig &config) : PrintRegion(config, config.hash()) {}
|
||||
PrintRegion::PrintRegion(PrintRegionConfig &&config) : PrintRegion(std::move(config), config.hash()) {}
|
||||
|
||||
void Print::clear()
|
||||
{
|
||||
tbb::mutex::scoped_lock lock(this->state_mutex());
|
||||
|
@ -39,24 +42,10 @@ void Print::clear()
|
|||
for (PrintObject *object : m_objects)
|
||||
delete object;
|
||||
m_objects.clear();
|
||||
for (PrintRegion *region : m_print_regions)
|
||||
delete region;
|
||||
m_print_regions.clear();
|
||||
m_model.clear_objects();
|
||||
}
|
||||
|
||||
PrintRegion* Print::add_print_region()
|
||||
{
|
||||
m_print_regions.emplace_back(new PrintRegion());
|
||||
return m_print_regions.back();
|
||||
}
|
||||
|
||||
PrintRegion* Print::add_print_region(const PrintRegionConfig &config)
|
||||
{
|
||||
m_print_regions.emplace_back(new PrintRegion(config));
|
||||
return m_print_regions.back();
|
||||
}
|
||||
|
||||
// Called by Print::apply().
|
||||
// This method only accepts PrintConfig option keys.
|
||||
bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* new_config */, const std::vector<t_config_option_key> &opt_keys)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue