mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 19:12:17 +00:00
Remap paint after split to parts
This commit is contained in:
@@ -2731,7 +2731,7 @@ std::string ModelVolume::type_to_string(const ModelVolumeType t)
|
||||
// Split this volume, append the result to the object owning this volume.
|
||||
// Return the number of volumes created from this one.
|
||||
// This is useful to assign different materials to different volumes of an object.
|
||||
size_t ModelVolume::split(unsigned int max_extruders)
|
||||
size_t ModelVolume::split(unsigned int max_extruders, bool remap_paint)
|
||||
{
|
||||
std::vector<TriangleMesh> meshes = this->mesh().split();
|
||||
if (meshes.size() <= 1)
|
||||
@@ -2741,6 +2741,9 @@ size_t ModelVolume::split(unsigned int max_extruders)
|
||||
if (text_configuration.has_value())
|
||||
text_configuration.reset();
|
||||
|
||||
std::optional<TriangleSelector::SavedPainting> saved_painting = remap_paint ? save_painting() :
|
||||
std::optional<TriangleSelector::SavedPainting>{};
|
||||
|
||||
size_t idx = 0;
|
||||
size_t ivolume = std::find(this->object->volumes.begin(), this->object->volumes.end(), this) - this->object->volumes.begin();
|
||||
const std::string name = this->name;
|
||||
@@ -2776,6 +2779,8 @@ size_t ModelVolume::split(unsigned int max_extruders)
|
||||
this->object->volumes[ivolume]->config.set("extruder", this->extruder_id());
|
||||
//this->object->volumes[ivolume]->config.set("extruder", auto_extruder_id(max_extruders, extruder_counter));
|
||||
this->object->volumes[ivolume]->m_is_splittable = 0;
|
||||
this->object->volumes[ivolume]->restore_painting(saved_painting);
|
||||
|
||||
++ idx;
|
||||
}
|
||||
|
||||
|
||||
@@ -930,7 +930,7 @@ public:
|
||||
// Split this volume, append the result to the object owning this volume.
|
||||
// Return the number of volumes created from this one.
|
||||
// This is useful to assign different materials to different volumes of an object.
|
||||
size_t split(unsigned int max_extruders);
|
||||
size_t split(unsigned int max_extruders, bool remap_paint);
|
||||
void translate(double x, double y, double z) { translate(Vec3d(x, y, z)); }
|
||||
void translate(const Vec3d& displacement);
|
||||
void scale(const Vec3d& scaling_factors);
|
||||
|
||||
@@ -2849,7 +2849,7 @@ void ObjectList::split()
|
||||
|
||||
take_snapshot("Split to parts");
|
||||
|
||||
volume->split(filament_cnt);
|
||||
volume->split(filament_cnt, wxGetApp().app_config->get_bool("keep_painting"));
|
||||
|
||||
wxBusyCursor wait;
|
||||
|
||||
|
||||
@@ -1908,7 +1908,7 @@ GLGizmoCut3D::PartSelection::PartSelection(const ModelObject* mo, const Transfor
|
||||
// split to parts
|
||||
for (int id = int(volumes.size())-1; id >= 0; id--)
|
||||
if (volumes[id]->is_splittable())
|
||||
volumes[id]->split(1);
|
||||
volumes[id]->split(1, false); // TODO: fix this
|
||||
|
||||
m_parts.clear();
|
||||
for (const ModelVolume* volume : volumes) {
|
||||
|
||||
@@ -112,7 +112,7 @@ bool fix_model_with_cgal_gui(ModelObject &model_object, int volume_idx, GUI::Pro
|
||||
// Orca: Split splittable volumes into parts for individual processing.
|
||||
size_t parts_count = 1;
|
||||
if (volume->is_splittable()) {
|
||||
parts_count = volume->split(1);
|
||||
parts_count = volume->split(1, false); // TODO: fix this
|
||||
if (parts_count > 1) {
|
||||
const std::string msg = Slic3r::format(L("Split into %1% parts"), parts_count);
|
||||
on_progress(msg.c_str(), 10);
|
||||
|
||||
Reference in New Issue
Block a user